Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- m = peripheral.wrap("right")
- m.clear()
- rednet.open("left")
- rednet.broadcast("door-on")
- local doorStatus = "ON"
- local wheatStatus = "RDY"
- function fillTable()
- button.setTable("Porte", door, 10,20,3,5)
- button.setTable("Grano", wheat, 22,32,3,5)
- --button.setTable("Energia", checkEnergy, 10,20,8,10)
- --button.setTable("Test4", test4, 22,32,8,10)
- button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent()
- id = side
- msg = x
- if event == "monitor_touch" then
- button.checkxy(x,y)
- elseif event == "rednet_message" then
- if msg == "wheat-end" then
- button.toggleButton("Grano")
- wheatStatus = "RDY"
- end
- end
- end
- function door()
- button.toggleButton("Porte")
- if doorStatus == "ON" then
- rednet.broadcast("door-off")
- doorStatus = "OFF"
- else
- rednet.broadcast("door-on")
- doorStatus = "ON"
- end
- end
- function wheat()
- if wheatStatus == "RDY" then
- rednet.broadcast("wheat-start")
- button.toggleButton("Grano")
- wheatStatus = "RUN"
- end
- end
- function checkEnergy()
- end
- function test4()
- print("test4")
- end
- fillTable()
- button.toggleButton("Porte")
- button.toggleButton("Grano")
- button.heading("FedericOS")
- button.label(1,5,"Beta!")
- while true do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement