Advertisement
Ferruccioboss

Minecraft>MonitorTouch

May 22nd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. os.loadAPI("button")
  2. m = peripheral.wrap("right")
  3. m.clear()
  4. rednet.open("left")
  5. rednet.broadcast("door-on")
  6. local doorStatus = "ON"
  7. local wheatStatus = "RDY"
  8.  
  9. function fillTable()
  10.     button.setTable("Porte", door, 10,20,3,5)
  11.     button.setTable("Grano", wheat, 22,32,3,5)
  12.     --button.setTable("Energia", checkEnergy, 10,20,8,10)
  13.     --button.setTable("Test4", test4, 22,32,8,10)
  14.     button.screen()
  15. end
  16.  
  17. function getClick()
  18.     event,side,x,y = os.pullEvent()
  19.     id = side
  20.     msg = x
  21.     if event == "monitor_touch" then
  22.         button.checkxy(x,y)
  23.     elseif event == "rednet_message" then
  24.             if msg == "wheat-end" then
  25.             button.toggleButton("Grano")
  26.             wheatStatus = "RDY"
  27.         end
  28.     end
  29. end
  30.  
  31. function door()
  32.     button.toggleButton("Porte")
  33.     if doorStatus == "ON" then
  34.     rednet.broadcast("door-off")
  35.     doorStatus = "OFF"
  36.     else
  37.     rednet.broadcast("door-on")
  38.     doorStatus = "ON"
  39.     end
  40. end
  41.  
  42. function wheat()
  43.     if wheatStatus == "RDY" then
  44.         rednet.broadcast("wheat-start")
  45.         button.toggleButton("Grano")
  46.         wheatStatus = "RUN"
  47.     end
  48. end
  49.  
  50. function checkEnergy()
  51.    
  52. end
  53.  
  54. function test4()
  55.     print("test4")
  56. end
  57.  
  58. fillTable()
  59. button.toggleButton("Porte")
  60. button.toggleButton("Grano")
  61. button.heading("FedericOS")
  62. button.label(1,5,"Beta!")
  63.  
  64. while true do
  65.     getClick()
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement