220 posts
Location
Germany
Posted 14 April 2013 - 09:06 AM
local done = false
while not done do
local event, x, y = os.pullEvent("mouse_click")
if (x >= 14) and (x <= 20) and ((y <= 2) and (y >= 4)) then
play()
done = true
end
end
Doesn't work. What now?
1511 posts
Location
Pennsylvania
Posted 14 April 2013 - 09:28 AM
Done is false. You are using a double negative, the loop never occurs..
2088 posts
Location
South Africa
Posted 14 April 2013 - 09:30 AM
Well…
y = 4
Your if statement of the y values is saying this:
If y is 2 or LESS AND y is 4 or MORE then continue
Which isn't possible :P/>
If you wanted it to be if y is 3, use and y == 3.
Also brackets aren't required for that if :)Edit: wow when I type the y parts of his if statement not the full thing comes out. I'm getting so annoyed with this -_-Edited it like 6 times with no success
1511 posts
Location
Pennsylvania
Posted 14 April 2013 - 09:33 AM
You also miss the button arg for mouse_click so x will always be -1 or 1
local event, button,x,y = os.pullEvent("mouse_click")
2088 posts
Location
South Africa
Posted 14 April 2013 - 09:38 AM
Done is false. You are using a double negative, the loop never occurs..
No.
While not done do
Is the same as
While done == false do
And yeah you missed the button argument :]
1511 posts
Location
Pennsylvania
Posted 14 April 2013 - 09:41 AM
Done is false. You are using a double negative, the loop never occurs..
No.
Ok, I didn't see the not part. *stupid phone*
220 posts
Location
Germany
Posted 14 April 2013 - 09:45 AM
So how else can I make a huge clickable button? ^^Btw I'm using the brackets just to read it better
2088 posts
Location
South Africa
Posted 14 April 2013 - 09:46 AM
Done is false. You are using a double negative, the loop never occurs..
No.
Ok, I didn't see the not part. *stupid phone*
O_o then where did you get the double negative explanation from?Yeah phones on these forums are a pain!
Edit: try changing the signs of where your y values to the oppisite. < To > and > to < and it should work for the first button
1522 posts
Location
The Netherlands
Posted 14 April 2013 - 09:49 AM
Spoiler
So how else can I make a huge clickable button? ^^Btw I'm using the brackets just to read it better
I have made a tutorial on this:
http://www.computercraft.info/forums2/index.php?/topic/11046-clickable-buttons-in-cc/I love legal advertisement :P/>
1511 posts
Location
Pennsylvania
Posted 14 April 2013 - 09:49 AM
Done is false. You are using a double negative, the loop never occurs..
No.
Ok, I didn't see the not part. *stupid phone*
O_o then where did you get the double negative explanation from?Yeah phones on these forums are a pain!
hmm, I guess it wouldn't be a double negative. What would the opposite be? :P/>
220 posts
Location
Germany
Posted 14 April 2013 - 09:56 AM
(y <= 2) and (y >= 4)
Finally understood that …. I always mix them
Correct one:
(y >= 2) and (y <= 4)
God dangit
220 posts
Location
Germany
Posted 14 April 2013 - 09:57 AM
Spoiler
So how else can I make a huge clickable button? ^^
Btw I'm using the brackets just to read it better
I have made a tutorial on this:
http://www.computerc...-buttons-in-cc/I love legal advertisement :P/>
Guess where I always look stuff like this up :P/>
I used a tutorial like yours, but it didn't work so I posted it here >.<
1522 posts
Location
The Netherlands
Posted 14 April 2013 - 10:03 AM
I see what you did wrong! :o/>
But I see remiX have answered it already:
Edit: try changing the signs of where your y values to the oppisite. < To > and > to < and it should work for the first button
That is the solution :P/>
220 posts
Location
Germany
Posted 14 April 2013 - 10:10 AM
Yep :P/>
But I just understood it right now xD