Advertisement
soiza1000

TouchToggle

Oct 30th, 2020 (edited)
1,868
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.40 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement