Advertisement
Pandana

LiftTerminal

Jan 25th, 2021 (edited)
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. rednet_side = "top"
  2. raise_lift_message = "raise_lift"
  3. lower_lift_message = "lower_lift"
  4. activate_lift_message = "startup_lift"
  5. deactivate_lift_message = "shutdown_lift"
  6. -- This is the time delay in seconds before the lift starts moving.
  7. activation_delay = 3
  8.  
  9. rednet.open(rednet_side)
  10.  
  11. function bc (message)
  12.  
  13.     rednet.broadcast(message)
  14.  
  15. end
  16.  
  17. while true do
  18.  
  19.     command = io.read()
  20.  
  21.     if command == "r" then
  22.  
  23.         os.sleep(activation_delay)
  24.         bc("raise_lift")
  25.         bc("startup_lift")
  26.  
  27.     elseif command == "l" then
  28.  
  29.         os.sleep(activation_delay)
  30.         bc("lower_lift")
  31.         bc("startup_lift")
  32.        
  33.     elseif command == "a" then
  34.  
  35.         bc("startup_lift")
  36.  
  37.     elseif command == "d" then
  38.  
  39.         bc("shutdown_lift")
  40.  
  41.     end
  42.  
  43.     term.clear()
  44.     term.setCursorPos(0, 0)
  45.  
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement