CTekkLP

Wither Redstone Clock

May 16th, 2021 (edited)
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1. --#################################################################################################################
  2. --                                         Computer Wither Redstone Clock
  3. --                                                     v. 1.0
  4. --                                                (c)2021 CTekkLP
  5. --#################################################################################################################
  6.  
  7.  
  8. --#################################################################################################################
  9. --                                                 Local Variables
  10. --#################################################################################################################
  11.  
  12. local side = "right"        --Redstone side of the Computer
  13. local timeSawn = 19         --Time between Spawns
  14.  
  15. --#################################################################################################################
  16. --                                                    Function´s
  17. --#################################################################################################################
  18.  
  19. print("How many Runs?")
  20. local runs = read()
  21. local num = tonumber(runs)
  22.  
  23. function waiting(time)
  24.     local myTimer = os.startTimer(time)
  25.     while true do
  26.         local event, timerID = os.pullEvent("timer")
  27.         if timerID == myTimer then break end
  28.     end
  29. end
  30.  
  31. function actRed()
  32.     redstone.setOutput(side, true)
  33.     waiting(0.7)
  34.     redstone.setOutput(side, false)
  35. end
  36.  
  37. --#################################################################################################################
  38. --                                                     Main
  39. --#################################################################################################################
  40.  
  41. if num ~= nil then
  42.     for i= 1, runs, 1 do
  43.         print("Start Run ", i)
  44.         actRed()
  45.         waiting(18)
  46.     end
  47. else
  48.     print("Error")
  49. end
Add Comment
Please, Sign In to add comment