Advertisement
Guest User

startup.lua

a guest
Aug 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. forward = false
  2.  
  3. function pulse(colour)
  4.     redstone.setBundledOutput("back", colour)
  5.     os.sleep(.1)
  6.     redstone.setBundledOutput("back", 0)
  7. end
  8.  
  9. function moveForward()
  10.     pulse(colours.blue)
  11.     print("Moving forwards")
  12. end
  13.  
  14. function moveBackward()
  15.     pulse(colours.white)
  16.     print("Moving backwards")
  17. end
  18.  
  19. while true do
  20.     local wait
  21.     if colors.test(redstone.getBundledInput("back"), colors.pink) == true then
  22.         forward = false
  23.     end
  24.    
  25.     if colors.test(redstone.getBundledInput("back"), colors.red) == true then
  26.         wait = true
  27.         forward = true
  28.     end
  29.          
  30.     if forward == true then
  31.         if wait then
  32.             for i=1, 6 do
  33.                 print("Waiting... " .. i)
  34.                 os.sleep(1)
  35.             end
  36.         end
  37.         wait = false
  38.        
  39.         moveForward()
  40.     else
  41.         moveBackward()          
  42.     end
  43.    
  44.     os.sleep(1)
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement