Guest User

startup

a guest
Jul 27th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. os.loadAPI("button")
  2. m = peripheral.wrap("top")
  3. m.clear()
  4. local btn = "TOGGLE BRIDGE"
  5.  
  6. function fillTable()
  7.   button.setTable(btn, bridge, "", 1, 18, 1, 5)
  8.   button.screen()
  9. end
  10.  
  11. function getClick()
  12.   event,side,x,y = os.pullEvent("monitor_touch")
  13.   button.checkxy(x,y)
  14. end
  15.  
  16. function setOutput(arg)
  17.   if arg then
  18.     print("Opening bridge...")
  19.   else
  20.     print("Closing bridge...")
  21.   end
  22.   redstone.setOutput("left", arg)
  23. end
  24.  
  25. function bridge(arg)
  26.   button.toggleButton(btn)  
  27.   setOutput(button.button[btn]["active"])
  28. end
  29.  
  30. redstone.getSides()
  31. fillTable()
  32. while true do
  33.   getClick()
  34. end
Advertisement
Add Comment
Please, Sign In to add comment