Advertisement
Guest User

screenZ

a guest
Aug 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. os.loadAPI("button")
  2. m = peripheral.wrap("top")
  3. local station = "Vezna Station"
  4. local krabID = 9
  5. local daveID = 10
  6. local messageOut = "incoming_cart"
  7.  
  8. rednet.open("left")
  9. m.clear()
  10.  
  11. function fillTable()
  12.    button.setTable("Krab Mountain", routeOakKrab, 3,20,9,11)
  13.    button.setTable("Dave Factory", routeOakDave, 22,37,9,11)
  14.    button.setTable("DISPENSE CART", dispenseCart, 3,37,13,18)
  15.    button.screen()
  16. end
  17.  
  18. function getClick()
  19.    event,side,x,y = os.pullEvent("monitor_touch")
  20.    button.checkxy(x,y)
  21. end
  22.  
  23. function test1()
  24.    button.flash("Krab Mountain")
  25.    print("Test1")
  26. end
  27.  
  28. function routeOakDave()
  29.    button.toggleButton("Dave Factory")
  30.    print("Test2")
  31. end
  32.  
  33. function dispenseCart()
  34.    button.toggleButton("DISPENSE CART")
  35.    print("Dispensed")
  36.    rs.setOutput("front",true)
  37.    sleep(1)
  38.    rs.setOutput("front", false)
  39.    button.toggleButton("DISPENSE CART")
  40. end
  41.  
  42. function routeOakKrab()
  43.   print("OakToKrab")
  44.   button.toggleButton("Krab Mountain")
  45.   id, message = rednet.receive(5)
  46.   if message == "incoming_cart" then
  47.       print("Incoming Cart")
  48.       button.warningFormat()
  49.    m.clear()
  50.    button.addTexts("INCOMING TRAIN", 3, 7, "Waiting few seconds...")
  51.    sleep(10)
  52.   end
  53.   rs.setOutput("front", true)
  54.   button.messageFormat()
  55.   m.clear()
  56.   button.addTexts("TRAIN LEAVING", 3, 7, "Have a nice trip!")
  57.   sleep(15)
  58.   for i = 15, 1, -1 do
  59.    rednet.send(krabID, messageOut)
  60.    sleep(1)
  61.   end
  62.   rs.setOutput("front", false)
  63.   button.resetFormat()
  64.   m.clear()
  65.   button.resetTexts(station)
  66.   fillTable()
  67. end
  68.  
  69. button.resetTexts(station)
  70. fillTable()
  71.  
  72. while true do
  73.    getClick()
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement