Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- m = peripheral.wrap("top")
- m.clear()
- f = false
- H = false
- T = false
- FH = false
- Turtleid = 0
- function fillTable()
- button.setTable("Miner1", Miner1, 3,13,3,5)
- button.setTable("Miner2", Miner2, 3,13,7,9)
- button.setTable("Miner3", Miner3, 3,13,11,13)
- button.setTable("Miner4", Miner4, 3,13,15,17)
- button.setTable("50", Fifty, 30,38,3,5)
- button.setTable("100", Hundred, 30,38,7,9)
- button.setTable("200", TwoHund, 30,38,11,13)
- button.setTable("500", FiveHund, 30,38,15,17)
- button.setTable("Reset", Reset, 30,38,19,20)
- button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- function Check()
- if f == true then
- button.toggleButton("50")
- f = false
- rednet.send(Turtleid,"mine50")
- elseif H == true then
- button.toggleButton("100")
- H = false
- rednet.send(Turtleid,"mine100")
- elseif T == true then
- button.toggleButton("200")
- T= false
- rednet.send(Turtleid,"mine200")
- elseif FH == true then
- button.toggleButton("500")
- FH = false
- rednet.send(Turtleid,"mine500")
- end
- end
- function Miner1()
- button.toggleButton("Miner1")
- Turtleid = 5
- Check()
- end
- function Miner2()
- button.toggleButton("Miner2")
- Turtleid = 6
- Check()
- end
- function Miner3()
- button.toggleButton("Miner3")
- Turtleid = 7
- Check()
- end
- function Miner4()
- button.toggleButton("Miner4")
- Turtleid = 8
- Check()
- end
- function Fifty()
- button.toggleButton("50")
- f = true
- end
- function Hundred()
- button.toggleButton("100")
- H = true
- end
- function TwoHund()
- button.toggleButton("200")
- T = true
- end
- function FiveHund()
- button.toggleButton("500")
- FH = true
- end
- function Reset()
- button.flash("Reset")
- if f == true then
- button.toggleButton("50")
- f = false
- elseif H == true then
- button.toggleButton("100")
- H = false
- elseif T == true then
- button.toggleButton("200")
- T = false
- elseif FH == true then
- button.toggleButton("500")
- FH = false
- end
- end
- rednet.open("right")
- fillTable()
- button.heading("Miner Controller")
- while true do
- getClick()
- id, Report = rednet.receive(1)
- if Report == "done" then
- if id == 5 then
- button.toggleButton("Miner1")
- elseif id == 6 then
- button.toggleButton("Miner2")
- elseif id == 7 then
- button.toggleButton("Miner3")
- elseif id == 8 then
- button.toggleButton("Miner4")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement