soiza1000

TouchToggle

Oct 30th, 2020 (edited)
749
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("left")
  2.  
  3. while true do
  4.   mon.clear()
  5.   mon.setBackgroundColor(colors.green)
  6.   mon.setCursorPos(2,2)
  7.   mon.write("switch")
  8.   event, side, xPos, yPos = os.pullEvent("monitor_touch")
  9.   if side=="left" and (xPos==2 or xPos==3 or xPos==4 or xPos==5 or xPos==6 or xPos==7) and yPos==2 then
  10.     redstone.setOutput("back", true)
  11.     sleep(1)
  12.     redstone.setOutput("back", false)
  13.    end
  14. end
RAW Paste Data