Advertisement
MihailPro

Untitled

Sep 21st, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. boolean lefts
  2. lefts = true
  3. local ki = 100
  4. local dep = 16
  5. monitor = peripheral.wrap("bottom")
  6. monitor.setTextScale(1)
  7. monitor.write("Line 1 -> Terminal")
  8. monitor.setCursorPos(1,2)
  9. local i
  10. i = 0
  11.  
  12. while true do
  13. if i == 0 then
  14. os.pullEvent("redstone") -- wait for a "redstone" event
  15. if rs.getInput("right") then -- check the input
  16. redstone.setOutput("back", true)
  17. sleep(1)
  18. i = i + 1
  19. lefts = false
  20. monitor.setCursorPos(1,2)
  21. monitor.clearLine()
  22. monitor.write("Arrived! Departure in " + dep " sec.")
  23. ki = 100
  24. else
  25. monitor.setCursorPos(1,2)
  26. monitor.clearLine()
  27. monitor.write("Arrival in " + ki + "seconds")
  28. ki = ki - 1
  29. end
  30. else
  31. if i ~= 16 then
  32. if lefts then
  33. redstone.setOutput("back", false)
  34. redstone.setOutput("front", true)
  35. lefts = false
  36. else
  37. redstone.setOutput("back", true)
  38. redstone.setOutput("front", false)
  39. lefts = true
  40. end
  41. monitor.setCursorPos(1,2)
  42. monitor.clearLine()
  43. monitor.write("Arrived! Departure in " + dep " sec.")
  44. i = i + 1
  45. sleep(1)
  46. else
  47. redstone.setOutput("back", false)
  48. redstone.setOutput("front", false)
  49. redstone.setOutput("top", true)
  50. sleep(1)
  51. redstone.setOutput("front", false)
  52. i = 0
  53. dep = 16
  54. end
  55. end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement