Advertisement
loepie

Move frame with bundled cable

May 11th, 2013
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. term.clear()
  2.  
  3. dn = colors.lime
  4. de = colors.purple
  5. ds = colors.orange
  6. dw = colors.lightBlue
  7. rs = redstone
  8.  
  9. function moveNorth()
  10.     rs.setBundledOutput("left", dn)
  11.     sleep(0.1)
  12.     rs.setBundledOutput("left", 0)
  13.     sleep(1)
  14.     movement()
  15. end
  16.  
  17. function moveEast()
  18.     rs.setBundledOutput("left", de)
  19.     sleep(0.1)
  20.     rs.setBundledOutput("left", 0)
  21.     sleep(1)
  22.     movement()
  23. end
  24.  
  25. function moveSouth()
  26.     rs.setBundledOutput("left", ds)
  27.     sleep(0.1)
  28.     rs.setBundledOutput("left", 0)
  29.     sleep(1)
  30.     movement()
  31. end
  32.  
  33. function moveWest()
  34.     rs.setBundledOutput("left", dw)
  35.     sleep(0.1)
  36.     rs.setBundledOutput("left", 0)
  37.     sleep(1)
  38.     movement()
  39. end
  40.  
  41. function movement()
  42.     while true do
  43.         print("What direction do you want to move?")
  44.         print("Use (n) for North")
  45.         print("Use (e) for East")
  46.         print("Use (s) for South")
  47.         print("Use (w) for West")
  48.         print("Use (q) to Exit")
  49.  
  50.         direction = io.read()
  51.         if direction == "n" then
  52.             moveNorth()
  53.             if direction == "e" then
  54.                 moveEast()
  55.             else
  56.                 if direction == "s" then
  57.                     moveSouth()
  58.                 else
  59.                     if direction == "w" then
  60.                         moveWest()
  61.                     else
  62.                         if direction == "q" then
  63.                             break
  64.                         else
  65.                             print("Wrong choice")
  66.                         end
  67.                     end
  68.                 end
  69.             end    
  70.         end
  71.     end
  72. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement