Advertisement
SythsGod

Redstone Timer

Jun 7th, 2013
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.78 KB | None | 0 0
  1. -- Easy redstone timer for minecraft used with a computer.
  2.  
  3. -- String Input
  4. term.clear() term.setCursorPos(1,1)
  5. textutils.slowPrint("Input at what side you want to emit the redstone signal:")
  6. a = read()
  7.  
  8. -- functions
  9. function left()
  10.   while true do
  11.     redstone.setOutput("left", true)
  12.     sleep(1)
  13.     redstone.setOutput("left", false)
  14.     sleep(1)
  15.   end
  16. end
  17.  
  18. function right()
  19.   while true do
  20.     redstone.setOutput("right", true)
  21.     sleep(1)
  22.     redstone.setOutput("right", false)
  23.     sleep(1)
  24.   end
  25. end
  26.  
  27. function top()
  28.   while true do
  29.     redstone.setOutput("top", true)
  30.     sleep(1)
  31.     redstone.setOutput("top", false)
  32.     sleep(1)
  33.   end
  34. end
  35.  
  36. function bottom()
  37.   while true do
  38.     redstone.setOutput("bottom", true)
  39.     sleep(1)
  40.     redstone.setOutput("bottom", false)
  41.     sleep(1)
  42.   end
  43. end
  44.  
  45. function back()
  46.   while true do
  47.     redstone.setOutput("back", true)
  48.     sleep(1)
  49.     redstone.setOutput("back", false)
  50.     sleep(1)
  51.   end
  52. end
  53.  
  54. -- main program
  55. if a == "left" then
  56.   term.clear()
  57.   term.setCursorPos(1,1)
  58.   textutils.slowPrint("Emiting redstone signal at left side!")
  59.   left()
  60. else if a == "right" then
  61.   term.clear()
  62.   term.setCursorPos(1,1)
  63.   textutils.slowPrint("Emiting redstone signal at right side!")
  64.   right()
  65. else if a == "top" then
  66.   term.clear()
  67.   term.setCursorPos(1,1)
  68.   textutils.slowPrint("Emiting redstone signal at top side!")
  69.   top()
  70. else if a == "bottom" then
  71.   term.clear()
  72.   term.setCursorPos(1,1)
  73.   textutils.slowPrint("Emiting redstone signal at bottom side!")
  74.   bottom()
  75. else if a == "back" then
  76.   term.clear()
  77.   term.setCursorPos(1,1)
  78.   textutils.slowPrint("Emiting redstone signal at the back of the computer!")
  79.   back()
  80. else
  81.   textutils.slowPrint("That isn't a valid side!")
  82. end
  83. end
  84. end
  85. end
  86. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement