59 posts
Posted 05 January 2016 - 11:41 AM
I have a problem with this code
while true do
event, button, x, y =os.pullEvent("mouse_click")
if x == nil or y == nil then
cPrint("Invalid Click")
end
if x>=2 and x<=16 and y>=5 and y<=7 then
start()
break
end
end
It doesn't work on normal computer.
Is it normal? I'm using Computercraft 1.75 for minecraft 1.7.10
Thank you!
Edited on 05 January 2016 - 10:41 AM
570 posts
Posted 05 January 2016 - 11:55 AM
Only advanced computers and monitors can detect mouse clicks. So yes, this is normal.
59 posts
Posted 05 January 2016 - 12:08 PM
Only advanced computers and monitors can detect mouse clicks. So yes, this is normal.
Thank you!
570 posts
Posted 05 January 2016 - 12:11 PM
You're welcome!
463 posts
Location
Star Wars
Posted 08 January 2016 - 05:42 PM
You have to add a local before you declare multiple variables:
while true do
local event, button, x, y = os.pullEvent("mouse_click")
if x == nil or y == nil then
cPrint("Invalid Click")
end
if x>=2 and x<=16 and y>=5 and y<=7 then
start()
break
end
end
But you need a advanced computer too.
Edited on 08 January 2016 - 04:45 PM
3057 posts
Location
United States of America
Posted 08 January 2016 - 05:54 PM
You have to add a local before you declare multiple variables:
This is wrong.
463 posts
Location
Star Wars
Posted 08 January 2016 - 08:38 PM
You have to add a local before you declare multiple variables:
This is wrong.
Really? Thanks!
7083 posts
Location
Tasmania (AU)
Posted 09 January 2016 - 02:31 AM
Well, wrong in that you don't
have to do it. In the context the code was written, it would've been good practise to do so anyway.
http://lua-users.org/wiki/ScopeTutorial