Leon669, on 28 February 2015 - 05:11 PM, said:
KingofGamesYami, on 27 February 2015 - 06:55 PM, said:
while true do
local event, button, x, y = os.pullEvent( "mouse_click" )
if x == 1 and y == 1 and button == 1 then
shell.run( "clear" )
shell.run( "desktop" )
end
end
...should work. All you're missing is a second end.
while true do
local event, button, x, y = os.pullEvent( "mouse_click" )
if x == 1 , 2 and y == 1 and button == 1 then
shell.run( "clear" )
shell.run( "desktop" )
end
end
not working ...
To get multiple points you will want to use the < and > operators.
while true do
local event, button, x, y = os.pullEvent("mouse_click")
if x >=1 and x<=5 and y == 1 and button == 1 then
shell.run("clear")
shell.run("desktop")
end
end
What this will do is check if x is greater than or equal to 1 and if x is less than or equal to 5 and y is equal to one and it was button 1.
For example if x is 3 then it will return true and run the if statement, but if x is above 5 or less than 1 it will not.
Btw. if you write [.code] at the beginning of your code and [./code] at the end without the .'s it will put it in the code block like the code I posted.
Edited by valithor, 28 February 2015 - 06:08 PM.