Guest User

Correct.way

a guest
Jun 23rd, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. function up()
  2. uu = req - cur
  3. u = uu * 9
  4. for i=1,u do
  5. rs.setBundledOutput("left", colors.white)
  6. sleep(0.75)
  7. rs.setBundledOutput("left", 0)
  8. sleep(0.06)
  9. end
  10. main()
  11. end
  12.  
  13. function down()
  14. dd = cur - req
  15. d = dd * 9
  16. for i=1,d do
  17. rs.setBundledOutput("left", colors.black)
  18. sleep(0.75)
  19. rs.setBundledOutput("left", 0)
  20. sleep(0.06)
  21. end
  22. main()
  23. end
  24.  
  25. function elevator()
  26. if rs.testBundledInput("left", colors.blue) then
  27. req = 1
  28. elseif rs.testBundledInput("left", colors.red) then
  29. req = 2
  30. elseif rs.testBundledInput("left", colors.green) then
  31. req = 3
  32. elseif rs.testBundledInput("left", colors.purple) then
  33. req = 4
  34. elseif rs.testBundledInput("left", colors.orange) then
  35. req = 5
  36. elseif rs.testBundledInput("left", colors.gray) then
  37. req = 6
  38. elseif rs.testBundledInput("left", colors.brown) then
  39. req = 7
  40. end
  41.  
  42. if rs.testBundledInput("left", colors.lightblue) then
  43. cur = 1
  44. elseif rs.testBundledInput("left", colors.pink) then
  45. cur = 2
  46. elseif rs.testBundledInput("left", colors.lime) then
  47. cur = 3
  48. elseif rs.testBundledInput("left", colors.magenta) then
  49. cur = 4
  50. elseif rs.testBundledInput("left", colors.yellow) then
  51. cur = 5
  52. elseif rs.testBundledInput("left", colors.lightgray) then
  53. cur = 6
  54. elseif rs.testBundledInput("left", colors.cyan) then
  55. cur = 7
  56. end
  57.  
  58. if cur < req then
  59. up()
  60. elseif cur > req then
  61. down()
  62. end
  63. main()
  64. end
  65.  
  66. function main()
  67. while true do
  68. os.pullEvent("redstone")
  69. elevator()
  70. end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment