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

Touchscreen Monitor?

Started by KeeganDeathman, 05 August 2013 - 02:53 PM
KeeganDeathman #1
Posted 05 August 2013 - 04: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
Lyqyd #2
Posted 05 August 2013 - 06:56 PM
Moved to Ask a Pro.
Kingdaro #3
Posted 05 August 2013 - 07: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
KeeganDeathman #4
Posted 05 August 2013 - 07:15 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

thats embarasing, thanks