[SOLVED] odd eT,x,y os.pullEvent() bug? (as long as x is same as statement requests, it's fine, y is irrelevant.)
#1
Posted 12 January 2013 - 10:06 AM
I have this..odd, to say the least, problem in my code..
here's the program: http://pastebin.com/hAm0LKJH (lol, ham.. mm..).
Try clicking on x one, any y for x one, and once you do that, x two, and have any y. I, temporarily, put a spacebar-to-exit, if your spacebar returns 57 it should work.
It miiiight exit to the shell if you hit any coordinate with an x of three, but that proved unreliable so I put the spacebar-to-exit "feature".
#2
Posted 12 January 2013 - 10:12 AM
eT,x,y = os.pullEvent()use this:
eT,button,x,y = os.pullEvent()So 'button' will be 1 on left click. Don't forget to change:
if eT == "key" and x == 57 then break endto:
if eT == "key" and button == 57 then break endas well then.
Edit: Stuff like this is also on the wiki.
#3
Posted 12 January 2013 - 10:15 AM
#4
Posted 12 January 2013 - 11:10 AM
Orwell, on 12 January 2013 - 10:12 AM, said:
if eT == "key" and x == 57 then break endto:
if eT == "key" and button == 57 then break endas well then.
if eT == "key" and button == 1 and x == 57 then break endButton would never be 57, as you said it's 1, 2 or 3
#5
Posted 12 January 2013 - 11:11 AM
TheOriginalBIT, on 12 January 2013 - 11:10 AM, said:
Orwell, on 12 January 2013 - 10:12 AM, said:
if eT == "key" and x == 57 then break endto:
if eT == "key" and button == 57 then break endas well then.
if eT == "key" and button == 1 and x == 57 then break endButton would never be 57, as you said it's 1, 2 or 3
#6
Posted 12 January 2013 - 11:17 AM
Orwell, on 12 January 2013 - 11:11 AM, said:
TheOriginalBIT, on 12 January 2013 - 11:10 AM, said:
Orwell, on 12 January 2013 - 10:12 AM, said:
if eT == "key" and x == 57 then break endto:
if eT == "key" and button == 57 then break endas well then.
if eT == "key" and button == 1 and x == 57 then break endButton would never be 57, as you said it's 1, 2 or 3
This made me laugh. xD TOB probably didn't check the event
#7
Posted 12 January 2013 - 11:20 AM
remiX, on 12 January 2013 - 11:17 AM, said:
Orwell, on 12 January 2013 - 11:11 AM, said:
TheOriginalBIT, on 12 January 2013 - 11:10 AM, said:
Orwell, on 12 January 2013 - 10:12 AM, said:
if eT == "key" and x == 57 then break endto:
if eT == "key" and button == 57 then break endas well then.
if eT == "key" and button == 1 and x == 57 then break endButton would never be 57, as you said it's 1, 2 or 3
This made me laugh. xD TOB probably didn't check the event
#8
Posted 12 January 2013 - 12:24 PM
The if eT == "key" and x == 57 then break end, was so if you hit the spacebar, it quits.. which I will have to adjust once I edit eT, x, y = os.pullEvent() to eT, button, x , y = os.pullEvent()
Thanks guys! It works now! (In the case you want the corrected code, with a term.setCursorPos(1,9), a term.clear(), and a paintutils make black cell so it won't be fully blue, to happen upon spacebar, and a bug fix here: http://pastebin.com/jUvfw0uC )
EDIT: ugh, nevermind, the one bug fix was supposed to be if push == "true" then allow "INDEED" to be printed, but it does it with or without that. ugh.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











