Advertisement
Cookie042

move

Jun 8th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. local args = {...}
  2. local dir = args[1]
  3. local steps = tonumber(args[2]) or 1
  4. local side = "left"
  5.  
  6. up = colors.blue
  7. down = colors.black
  8. left = colors.magenta
  9. right = colors.orange
  10. front = colors.white
  11. back = colors.red
  12. armdown = colors.lightGray
  13. armup = colors.lightBlue
  14.  
  15. if dir == "l" then dir = left
  16. elseif dir == "r" or dir == "right" then dir = right
  17. elseif dir == "u" or dir == "up" then dir = up
  18. elseif dir == "d" or dir == "down" then dir = down
  19. elseif dir == "f" or dir == "forward" then dir = front
  20. elseif dir == "b" or dir == "back" then dir = back
  21. elseif dir == "ad" then dir = armdown
  22. elseif dir == "au" then dir = armup end
  23.  
  24. function pulse(col, num,time)
  25. num = num or 1
  26.   for i=1, num do
  27.     rs.setBundledOutput(side,col)
  28.     sleep(time)
  29.     rs.setBundledOutput(side,0)
  30.     sleep(time)
  31.   end
  32. end
  33.  
  34. local t = 1
  35. if dir == armup or dir == armdown then t =.3 end
  36. pulse(dir,steps,t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement