Advertisement
dlord

/lift/liftcontrol

Nov 16th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. local args = { ... }
  2.  
  3. local isLiftDown=colors.red
  4. local frameUp=colors.black
  5. local frameDown=colors.red
  6.  
  7. local controlLift = function(liftDirection, rate, height)
  8. for i=1,height do
  9. redstone.setBundledOutput("top", liftDirection)
  10. sleep(0.100)
  11. redstone.setBundledOutput("top", 0)
  12. sleep(rate-0.100)
  13. end
  14. end
  15.  
  16. local liftUp = function()
  17. if redstone.testBundledInput("top", isLiftDown) then
  18. controlLift(frameUp, 0.800, 32)
  19. end
  20. end
  21.  
  22. local liftDown = function()
  23. if redstone.testBundledInput("top", isLiftDown) ~= true then
  24. controlLift(frameDown, 0.800, 32)
  25. end
  26. end
  27.  
  28. local checkArguments = function()
  29. local action = args[1]
  30.  
  31. if action == "up" then
  32. print("Going Up...")
  33. liftUp()
  34. elseif action == "down" then
  35. print("Going Down...")
  36. liftDown()
  37. else
  38. print("lift [up/down]")
  39. end
  40. end
  41.  
  42. -- check arguments
  43.  
  44. if #args > 0 then
  45. checkArguments()
  46. else
  47. print("liftcontrol [up/down]")
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement