xavierlebel

Untitled

Mar 18th, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("right")
  2. p = peripheral.wrap("left")
  3.  
  4. function pulse()
  5. redstone.setOutput("left", true)
  6. sleep(2)
  7. redstone.setOutput("left", false)
  8. end
  9.  
  10. function trains()
  11. mon.setTextColor(colors.white)
  12. mon.setCursorPos(2,5)
  13. mon.write("TRAIN 1 - Water")
  14. mon.setCursorPos(2,6)
  15. mon.write("TRAIN 2 - Oil")
  16. mon.setCursorPos(2,7)
  17. mon.write("TRAIN 3 -")
  18. mon.setCursorPos(2,8)
  19. mon.write("TRAIN 4 -")
  20. mon.setCursorPos(2,9)
  21. mon.write("TRAIN 5 -")
  22. mon.setCursorPos(2,10)
  23. mon.write("TRAIN 6 -")
  24. mon.setCursorPos(2,11)
  25. mon.write("TRAIN 7 -")
  26. mon.setCursorPos(2,12)
  27. mon.write("TRAIN 8 -")
  28. end
  29.  
  30. function stop1()
  31.  
  32. if event == "redstone" and rs.getInput("back") == true then
  33.  
  34. mon.setTextColor(colors.red)
  35. mon.setCursorPos(22,5)
  36. mon.write("CANCELLED")
  37. mon.setCursorPos(22,6)
  38. mon.write("CANCELLED")
  39. mon.setCursorPos(22,7)
  40. mon.write("CANCELLED")
  41. mon.setCursorPos(22,8)
  42. mon.write("CANCELLED")
  43. mon.setCursorPos(22,9)
  44. mon.write("CANCELLED")
  45. mon.setCursorPos(22,10)
  46. mon.write("CANCELLED")
  47. mon.setCursorPos(22,11)
  48. mon.write("CANCELLED")
  49. mon.setCursorPos(22,12)
  50. mon.write("CANCELLED")
  51. end
  52. end
  53.  
  54. function start1()
  55.  
  56.  
  57. if event == "redstone" and rs.getInput("back") == false then
  58.  
  59. mon.setTextColor(colors.green)
  60.  
  61. mon.setCursorPos(22,12)
  62. mon.write("DEPARTING")
  63. p.setFreq(108)
  64. pulse()
  65. sleep(2)
  66. mon.setCursorPos(22,11)
  67. mon.write("DEPARTING")
  68. p.setFreq(107)
  69. pulse()
  70. sleep(2)
  71. mon.setCursorPos(22,10)
  72. mon.write("DEPARTING")
  73. p.setFreq(106)
  74. pulse()
  75. sleep(2)
  76. mon.setCursorPos(22,9)
  77. mon.write("DEPARTING")
  78. p.setFreq(105)
  79. pulse()
  80. sleep(2)
  81. mon.setCursorPos(22,8)
  82. mon.write("DEPARTING")
  83. p.setFreq(104)
  84. pulse()
  85. sleep(2)
  86. mon.setCursorPos(22,7)
  87. mon.write("DEPARTING")
  88. p.setFreq(103)
  89. pulse()
  90. sleep(2)
  91. mon.setCursorPos(22,6)
  92. mon.write("DEPARTING")
  93. p.setFreq(102)
  94. pulse()
  95. sleep(2)
  96. mon.setCursorPos(22,5)
  97. mon.write("DEPARTING")
  98. p.setFreq(101)
  99. pulse()
  100. end
  101. end
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110. local function loop1 ()
  111. while true do
  112. trains()
  113. stop1()
  114. sleep(1)
  115. end
  116. end
  117.  
  118. local function loop2 ()
  119. while true do
  120. trains()
  121. start1()
  122. sleep(1)
  123. end
  124. end
  125.  
  126. while(true) do
  127. parallel.waitForAny(loop1, loop2)
  128. end
Advertisement
Add Comment
Please, Sign In to add comment