Advertisement
CdoubleOK

Lumber Yard Control

Oct 20th, 2024 (edited)
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. local int = peripheral.find("redstoneIntegrator")
  2.  
  3. function stackTime(cycles, side)
  4. local i = 0
  5. while i ~= cycles do
  6.     rs.setOutput(side, true)
  7.     sleep(0.5)
  8.     rs.setOutput(side, false)
  9.     i = i + 1
  10.     sleep(1)
  11. end
  12. end
  13.  
  14. function stackTimeP(cycles, side)
  15. local i = 0
  16. while i ~= cycles do
  17.     int.setOutput(side, true)
  18.     sleep(0.5)
  19.     int.setOutput(side, false)
  20.     i = i + 1
  21.     sleep(1)
  22. end
  23. end
  24.  
  25. function showMenu(int)
  26.   term.clear()
  27.   term.setCursorPos(1,1)
  28.  
  29. local menuOptions = {
  30.   "Oak Wood",
  31.   "Jungle Wood",
  32.   "Dark Oak Wood",
  33.   "Birch Wood",
  34.   "Acacia Wood",
  35.   "Spruce Wood",
  36.   "Mangrove Wood",
  37.   "Cherry Wood",
  38. }
  39.  
  40. local outputSide = {
  41.   "Bottom",
  42.   "Left",
  43.   "Top",
  44.   "Right",
  45.   "Bottom",
  46.   "Left",
  47.   "Top",
  48.   "Right"
  49. }
  50.  
  51.   term.setCursorPos(4,1)
  52.   print("Lumber Yard Control")
  53.   term.setCursorPos(4,2)
  54.   print("-=-=-=-=-=-=-=-")
  55.   term.setCursorPos(1,4)
  56.   print("1. Oak Wood")
  57.   print("2. Jungle Wood")
  58.   print("3. Dark Oak Wood")
  59.   print("4. Birch Wood")
  60.   print("5. Acacia Wood")
  61.   print("6. Spruce Wood")
  62.   print("7. Mangrove Wood")
  63.   print("8. Cherry Wood")
  64.  
  65.   local choice = nil
  66.   repeat
  67.     term.write("Enter your choice (1-8): ")
  68.     choice = tonumber(read())
  69.   until choice and choice >= 1 and choice <= 8
  70.  
  71.   term.clear()
  72.   term.setCursorPos(1,1)
  73.   term.write("Enter number of stacks (max 27):"..menuOptions[choice]..": ")
  74.   local stack = tonumber(read())
  75.   local dirc = outputSide[choice]
  76.  
  77.   if choice >= 1 and choice <= 4 then
  78.     stackTime(stack, dirc)
  79.   elseif choice >= 5 and choice <= 8 then
  80.     stackTimeP(stack, dirc)
  81. end
  82.  
  83.   return
  84. end
  85.  
  86.  
  87. while rs.getInput("front") == false
  88. do
  89. showMenu(int)
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement