This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
SuicidalSTDz's profile picture

Mouse Clicks

Started by SuicidalSTDz, 01 January 2013 - 04:29 AM
SuicidalSTDz #1
Posted 01 January 2013 - 05:29 AM
local event, button, xPos, yPos = os.pullEvent("mouse_click")
if button == 1 then
if xPos => 8 and xPos <= 17 and yPos => 10 and yPos <= 12 then
os.reboot()
elseif (xPos => 35 and xPos <= 46 and yPos => 10 and yPos <= 12) then
os.shutdown()
elseif (xPos => 22 and xPos <= 30 and yPos => 10 and yPos <= 12) then
term.setCursorPos(23,8)
end
end

On startup it states that in line 4 ,there is a "then" expected. I don't understand why.
If I comment out line 3 it returns the same with a "then" expected on line 5, as does commenting out line 5, it returns expected "then" on line 7.
There is much more to the code than this. The program is over 700 lines but this is the only confict as I test it all thoroughly before adding more.
GravityScore #2
Posted 01 January 2013 - 05:48 AM
if xPos => 8 and xPos <= 17 and yPos => 10 and yPos <= 12 then

It's because of the =>. It should be >= (greater than or equal to, not equal to or greater than). You'll need to change all of them.
SuicidalSTDz #3
Posted 01 January 2013 - 05:51 AM
if xPos => 8 and xPos <= 17 and yPos => 10 and yPos <= 12 then

It's because of the =>. It should be >= (greater than or equal to, not equal to or greater than). You'll need to change all of them.
Thank you very much, I didn't even notice that. (Such a noob sometimes) Have a great day sir.
GravityScore #4
Posted 01 January 2013 - 05:59 AM
if xPos => 8 and xPos <= 17 and yPos => 10 and yPos <= 12 then

It's because of the =>. It should be >= (greater than or equal to, not equal to or greater than). You'll need to change all of them.
Thank you very much, I didn't even notice that. (Such a noob sometimes) Have a great day sir.

Thanks! Glad I could help :)/>