Jump to content




Mouse Clicks


  • You cannot reply to this topic
3 replies to this topic

#1 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

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.

#2 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

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.

#3 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 01 January 2013 - 05:51 AM

View PostGravityScore, on 01 January 2013 - 05:48 AM, said:

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.

#4 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 01 January 2013 - 05:59 AM

View PostSuicidalSTDz, on 01 January 2013 - 05:51 AM, said:

View PostGravityScore, on 01 January 2013 - 05:48 AM, said:

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 :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users