Jump to content




[LUA][NEED HELP] button showing wrong function


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

#1 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 15 April 2013 - 06:42 AM

Hi! I'm working on a saving/loading thing with a "new" button
for a new game.

But it shows the load function.

Code:

function main()
slc = 0
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
term.clear()
term.setCursorPos(1,1)
print("[Load]")
print("      ")
print("[New] ")
 while true do
     event, X, Y = os.pullEvent("mouse_click")
     if slc == 0 then
       if event == "mouse_click" then
          if X >= 1 and X <= 7 and Y == 1 then
            load()
      elseif X >= 1 and X <= 7 and Y == 3 then
             game()
end
end
end
end
end

Whats wrong?

#2 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 15 April 2013 - 07:22 AM

The parameters for 'mouse_click' are:
event, button, x, y

#3 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 15 April 2013 - 07:37 AM

The button arguement is an integer. 1 for left click and 2 for right click. Just for future reference.

So in your code, X is either 1 or 2.

#4 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 15 April 2013 - 07:19 PM

Oh.. Thanks





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users