Advertisement
Vortalos

Frame Elevator

Dec 9th, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. --pastebin get 32mBeCwc
  2. --orange is up, magenta is down
  3.  
  4. local drive = peripheral.wrap("left")
  5. local ismovepossible
  6.  
  7. function checkmotion(direction)
  8.     ismovepossible=drive.move(direction, true, false)
  9. end
  10.  
  11. function move(direction)
  12.     checkmotion(direction)
  13.     if ismovepossible==true then
  14.         drive.move(direction, false, false)
  15.     else
  16.         os.sleep(1)
  17.     end
  18. end
  19.  
  20.  
  21. os.sleep(1)
  22.  
  23. while true do
  24.     if rs.testBundledInput("right",colours.orange) == true then
  25.         move(1)
  26.     elseif rs.testBundledInput("right",colours.magenta) == true then
  27.         move(0)
  28.     end
  29.     os.sleep(0.1)
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement