Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- m = peripheral.wrap("top")
- local station = "Vezna Station"
- local krabID = 9
- local daveID = 10
- local messageOut = "incoming_cart"
- rednet.open("left")
- m.clear()
- function fillTable()
- button.setTable("Krab Mountain", routeOakKrab, 3,20,9,11)
- button.setTable("Dave Factory", routeOakDave, 22,37,9,11)
- button.setTable("DISPENSE CART", dispenseCart, 3,37,13,18)
- button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- function test1()
- button.flash("Krab Mountain")
- print("Test1")
- end
- function routeOakDave()
- button.toggleButton("Dave Factory")
- print("Test2")
- end
- function dispenseCart()
- button.toggleButton("DISPENSE CART")
- print("Dispensed")
- rs.setOutput("front",true)
- sleep(1)
- rs.setOutput("front", false)
- button.toggleButton("DISPENSE CART")
- end
- function routeOakKrab()
- print("OakToKrab")
- button.toggleButton("Krab Mountain")
- id, message = rednet.receive(5)
- if message == "incoming_cart" then
- print("Incoming Cart")
- button.warningFormat()
- m.clear()
- button.addTexts("INCOMING TRAIN", 3, 7, "Waiting few seconds...")
- sleep(10)
- end
- rs.setOutput("front", true)
- button.messageFormat()
- m.clear()
- button.addTexts("TRAIN LEAVING", 3, 7, "Have a nice trip!")
- sleep(15)
- for i = 15, 1, -1 do
- rednet.send(krabID, messageOut)
- sleep(1)
- end
- rs.setOutput("front", false)
- button.resetFormat()
- m.clear()
- button.resetTexts(station)
- fillTable()
- end
- button.resetTexts(station)
- fillTable()
- while true do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement