Jharakn

Untitled

Jan 27th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1.  
  2. -- ***************** --
  3. -- Jim's Door Opener --
  4. -- By Jharakn --
  5. -- ***************** --
  6.  
  7. function whitePulse(BundleDirection, number)
  8. for i = 1, number do
  9. redstone.setBundledOutput(BundleDirection, colors.white)
  10. sleep(1)
  11. redstone.setBundledOutput(BundleDirection, 0)
  12. sleep(1)
  13. end
  14. end
  15.  
  16. function orangePulse(BundleDirection, number)
  17. for i = 1, number do
  18. redstone.setBundledOutput(BundleDirection, colors.orange)
  19. sleep(1)
  20. redstone.setBundledOutput(BundleDirection, 0)
  21. sleep(1)
  22. end
  23. end
  24.  
  25. function magentaPulse(BundleDirection, number)
  26. for i = 1, number do
  27. redstone.setBundledOutput(BundleDirection, colors.magenta)
  28. sleep(1)
  29. redstone.setBundledOutput(BundleDirection, 0)
  30. sleep(1)
  31. end
  32. end
  33.  
  34. function lightBluePulse(BundleDirection, number)
  35. for i = 1, number do
  36. redstone.setBundledOutput(BundleDirection, colors.lightBlue)
  37. sleep(1)
  38. redstone.setBundledOutput(BundleDirection, 0)
  39. sleep(1)
  40. end
  41. end
  42.  
  43. function yellowPulse(BundleDirection, number)
  44. for i = 1, number do
  45. redstone.setBundledOutput(BundleDirection, colors.yellow)
  46. sleep(1)
  47. redstone.setBundledOutput(BundleDirection, 0)
  48. sleep(1)
  49. end
  50. end
  51.  
  52. function limePulse(BundleDirection, number)
  53. for i = 1, number do
  54. redstone.setBundledOutput(BundleDirection, colors.lime)
  55. sleep(1)
  56. redstone.setBundledOutput(BundleDirection, 0)
  57. sleep(1)
  58. end
  59. end
  60.  
  61. function pinkPulse(BundleDirection, number)
  62. for i = 1, number do
  63. redstone.setBundledOutput(BundleDirection, colors.pink)
  64. sleep(1)
  65. redstone.setBundledOutput(BundleDirection, 0)
  66. sleep(1)
  67. end
  68. end
  69.  
  70. function grayPulse(BundleDirection, number)
  71. for i = 1, number do
  72. redstone.setBundledOutput(BundleDirection, colors.gray)
  73. sleep(1)
  74. redstone.setBundledOutput(BundleDirection, 0)
  75. sleep(1)
  76. end
  77. end
  78.  
  79. function lightGrayPulse(BundleDirection, number)
  80. for i = 1, number do
  81. redstone.setBundledOutput(BundleDirection, colors.lightGray)
  82. sleep(1)
  83. redstone.setBundledOutput(BundleDirection, 0)
  84. sleep(1)
  85. end
  86. end
  87.  
  88. function cyanPulse(BundleDirection, number)
  89. for i = 1, number do
  90. redstone.setBundledOutput(BundleDirection, colors.cyan)
  91. sleep(1)
  92. redstone.setBundledOutput(BundleDirection, 0)
  93. sleep(1)
  94. end
  95. end
  96.  
  97. -- Main Program --
  98.  
  99.  
  100. local pulseNumber = 3
  101.  
  102. while true do
  103.  
  104. local leftInput = rs.getInput("left")
  105. local rightInput = rs.getInput("right")
  106.  
  107. os.pullEvent("redstone")
  108. sleep(0.5)
  109.  
  110. if rs.getInput("right") == true then
  111. print("Opening Door")
  112. limePulse("top", pulseNumber)
  113. grayPulse("top", pulseNumber)
  114. cyanPulse("top", pulseNumber)
  115. lightGrayPulse("top", pulseNumber)
  116. pinkPulse("top", pulseNumber)
  117. end
  118.  
  119. if rs.getInput("left") == true then
  120. print("Closing Door")
  121. magentaPulse("top", pulseNumber)
  122. yellowPulse("top", pulseNumber)
  123. whitePulse("top", pulseNumber)
  124. orangePulse("top", pulseNumber)
  125. lightBluePulse("top", pulseNumber)
  126. end
Advertisement
Add Comment
Please, Sign In to add comment