Advertisement
Guest User

stationScreens.lua

a guest
Aug 24th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. monL = peripheral.wrap("left")
  2. monR = peripheral.wrap("right")
  3. rednet.open("top")
  4. local station = "OAK HILL"
  5. local cartMSG = "INCOMING CART"
  6.  
  7. function setDefault(mon)
  8.     mon.setBackgroundColor(colors.blue)
  9.     mon.clear()
  10.     mon.setTextScale(4)
  11.     mon.setTextColor(colors.white)
  12.     mon.setCursorPos(5,1)
  13.     mon.write(station)
  14. end
  15.  
  16. function receiveMSG(mon)
  17.     id, message = rednet.receive(3)
  18.     if message == "incoming_cart" then
  19.         mon.setBackgroundColor(colors.red)
  20.         mon.clear()
  21.         mon.setCursorPos(2,1)
  22.         mon.write(cartMSG)
  23.         sleep(15)
  24.     else
  25.         sleep(1)
  26.     end
  27.     setDefault(mon)
  28. end
  29.  
  30. setDefault(monL)
  31. setDefault(monR)
  32.  
  33. while true do
  34.     receiveMSG(monL)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement