Jump to content




Problems With A (2) Button


  • You cannot reply to this topic
1 reply to this topic

#1 CaosTECH

  • Members
  • 131 posts
  • LocationIn your closet

Posted 07 November 2015 - 07:39 PM

My brain is absolutely blown to pieces. It is not making sense and the code is right, it could be a problem with CC or something though

In my game, in the pause menu, I made buttons. But whenever I run the program, it says theres in error in line 117. It says it expected "then"
Here my code: I will try my best to explain the problem
while pauseMenu do
term.clear()
term.setCursorPos(2,2)
print("PAUSED")
term.setCursorPos(4,4)
term.setBackgroundColor(colors.blue)
print("		   ")
term.setCursorPos(4,5)
print("  UNPAUSE  ")
term.setCursorPos(4,6)
print("		   ")
term.setCursorPos(4,9)
term.setBackgroundColor(colors.red)
print("		   ")
term.setCursorPos(4,10)
print("   EXIT?   ")
term.setCursorPos(4,11)
print("		   ")
local event, button, x, y = os.pullEvent("mouse_click")
slc = 0
if (slc == 0) then

  if (event == "mouse_click")
  
	if (x >= 4 and x <= 15 and y >= 4 and y <= 6 and button == 1) then
	  pauseMenu = false
	  game = true
	elseif (x >= 4 and x <= 15 and y >= 9 and y <= 11 and button == 1) then
	  term.clear()
	  term.setCursorPos(1,1)
	  term.setBackgroundColor(colors.black)
	  term.setTextColor(colors.yellow)
	  term.clear()
	  print("Thanks for playing!")
	  break
	end
  end
end
end
This is Line 117:
	if (x >= 4 and x <= 15 and y >= 4 and y <= 6 and button == 1) then
It just doesn't make sense at all.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 07 November 2015 - 07:45 PM

It's expecting a then from the previous line, but still hasn't gotten it by the time it hits something else, so that's the line it throws the error on. This is covered in my favorite sticky post.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users