Jump to content




Touchscreen Monitor?

lua

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

#1 KeeganDeathman

  • Members
  • 61 posts

Posted 05 August 2013 - 03:53 PM

I want to make a monitor touchscreen menu for a minigame, it will be a minigame selector computer.
But I keep right clicking inside the button area, and the ouput comes up saying the right clcik wasn't a button.
rednet.open('top')
mon = peripheral.wrap('bottom')
term.redirect(mon)
print("			    GLaDOS minigame control")
print(" ")
print(" ----------------")
print(" |			  |")
print(" |  Core Change |")
print(" |			  |")
print(" ----------------")
term.restore()
while true do
  event,side, X, Y = os.pullEvent("monitor_touch")
  if side == "bottom" and X <= 2 and X >= 17 and Y <= 3 and Y >= 7 then
    print("screen touched, button is CORE CHANGE")
    shell.run("DeadlyNerotoxin")
  else
    print("what are you dong! Thats not a button!")
  end
 
end


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 05 August 2013 - 05:56 PM

Moved to Ask a Pro.

#3 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 05 August 2013 - 06:04 PM

You got your comparisons mixed up. Instead of checking if it's inside the area, you're checking if it's not inside the area. Just flip the comparisons, and it should be fixed.
if side == "bottom" and X >= 2 and X <= 17 and Y >= 3 and Y <= 7 then


#4 KeeganDeathman

  • Members
  • 61 posts

Posted 05 August 2013 - 06:15 PM

View PostKingdaro, on 05 August 2013 - 06:04 PM, said:

You got your comparisons mixed up. Instead of checking if it's inside the area, you're checking if it's not inside the area. Just flip the comparisons, and it should be fixed.
if side == "bottom" and X >= 2 and X <= 17 and Y >= 3 and Y <= 7 then

thats embarasing, thanks





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users