Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help on LINE & INPUT
#1
Code:
LET txtnumx1% = 0
LET txtnumy1% = 0
LET txtnumx2% = 0
LET txtnumy2% = 0

LINE (50, 50)-(80, 70), 15, B
IF bx = 1 THEN
IF dx > 50 AND dx < 80 THEN
IF cx > 50 AND cx < 70 THEN
LOCATE 2, 1: line (txtnumx%, txtnumx1%) - (txtnumy%, txtnumy1%)
END IF
END IF
END IF

LINE (100, 100)-(160, 140), 15, B
IF bx = 1 THEN
IF dx > 100 AND dx < 160 THEN
IF cx > 100 AND cx < 140 THEN
input ""; txtnumx1%
END IF
END IF
END IF

LINE (25, 25)-(90, 80), 15, B
IF bx = 1 THEN
IF dx > 25 AND dx < 90 THEN
IF cx > 25 AND cx < 80 THEN
input ""; txtnumx1%
END IF
END IF
END IF

LINE (60, 60)-(120, 110), 15, B
IF bx = 1 THEN
IF dx > 60 AND dx < 120 THEN
IF cx > 60 AND cx < 110 THEN
input ""; txtnumx1%
END IF
END IF
END IF

LINE (200, 200)-(180, 170), 15, B
IF bx = 1 THEN
IF dx > 200 AND dx < 180 THEN
IF cx > 200 AND cx < 170 THEN
input ""; txtnumx1%
END IF
END IF
END IF


I want it so I can type in the x, y & then when I click the botton, it will make me a line of that x, y on the screen. I hate asking for help but I'm working it with a mouse script & I'm all confused.

LINE (200, 200)-(180, 170), 15, B Of course I'm going to change these Line numbers around so the bottons fit better on the screen. Just haven't got to it yet :roll:[/code]
Reply
#2
:o LET????? You must be just starting out, right?

You do know that all four of your inputs a storing into:

txtnumx1%

Right? your only getting that one position.... And LINE is (x1, y1)-(x2, y2),... not (x1, x2)-(y1, y2) ,. you also have vulues x1, x2, y1, y2, and in the LINE you have x, x1, y, y1... Here...

[syntax="qbasic"]txtnumx1% = 0
txtnumy1% = 0
txtnumx2% = 0
txtnumy2% = 0

LINE (50, 50)-(80, 70), 15, B
IF bx = 1 THEN
IF dx > 50 AND dx < 80 THEN
IF cx > 50 AND cx < 70 THEN
LOCATE 2, 1: line (txtnumx1%, txtnumy1%) - (txtnumx2%, txtnumy2%)
END IF
END IF
END IF

LINE (100, 100)-(160, 140), 15, B
IF bx = 1 THEN
IF dx > 100 AND dx < 160 THEN
IF cx > 100 AND cx < 140 THEN
input ""; txtnumx1%
END IF
END IF
END IF

LINE (25, 25)-(90, 80), 15, B
IF bx = 1 THEN
IF dx > 25 AND dx < 90 THEN
IF cx > 25 AND cx < 80 THEN
input ""; txtnumy1%
END IF
END IF
END IF

LINE (60, 60)-(120, 110), 15, B
IF bx = 1 THEN
IF dx > 60 AND dx < 120 THEN
IF cx > 60 AND cx < 110 THEN
input ""; txtnumx2%
END IF
END IF
END IF

LINE (200, 200)-(180, 170), 15, B
IF bx = 1 THEN
IF dx > 200 AND dx < 180 THEN
IF cx > 200 AND cx < 170 THEN
input ""; txtnumy2%
END IF
END IF
END IF[/syntax]

Hope that helps,. :wink: ,. ne more Qs, I'll be glad to try and answer 'em, If I can't, then someone else should be able to. Smile
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#3
Yeah sorry about that, I wrote that quick in a notpad in fact what you wrote in code is what i have in the program. The INPUT I don't think i have the problem with bit I'm pretty sure that this..

Code:
LINE (50, 50)-(80, 70), 15, B
IF bx = 1 THEN
IF dx > 50 AND dx < 80 THEN
IF cx > 50 AND cx < 70 THEN
LOCATE 2, 1: line (txtnumx%, txtnumx1%) - (txtnumy%, txtnumy1%)
END IF
END IF
END IF

Is causing the problems, see when I click on the box after writing in the x, y the line it doesn't show up.[/code]
Reply
#4
Smile Yeah, Like I was saying, you input values (aka Variables) are:

txtnumx1%
txtnumx2%
txtnumy1%
txtnumy2%

And in you LINE statment you have:

LINE (txtnumx%, txtnumx1%)-(txtnumy%, txtnumy1%)

Hmm? Whats the "LOCATE 2, 1" for? Thats for PRINT, not LINE..
You need this in you line statment:

LINE (txtnumx1%, txtnumy1%)-(txtnumx2%, txtnumy2%)

That should do it,. :wink: ,..
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)