Advertisement
matthewkk91

Untitled

Jun 26th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. --This is my code for Auto-Spawner I am building
  2.  
  3. --verison of spawner
  4.  
  5.  
  6. ----This is the function to center text
  7. slc = 0
  8.  
  9. local w, h = term.getSize()
  10.  
  11. --function to centertext
  12.  
  13. local function cenText(text,y)
  14. term.setCursorPos(w/2-#text/2,y)
  15. term.write(text)
  16. end
  17. local input = read()
  18. local function setup()
  19. term.clear()
  20. term.setCursorPos(1,1)
  21. end
  22. local function verison()
  23. term.setTextColor(colors.yellow)
  24. cenText("Auto-Spawner Verison 1.0",1)
  25. end
  26.  
  27.  
  28. menuOptions = {
  29. [1]= {text = "(1)Zombie"},
  30. [2]= {text = "(2)Blaze"},
  31. [3]= {text = "(3)Skelton"},
  32. [4]= {text = "(4)Sheep"},
  33. [5]= {text = "(5)Reset"},
  34. }
  35.  
  36.  
  37. local function mainMenu()
  38. setup()
  39. verison()
  40. term.setCursorPos(1,5)
  41. term.setTextColor(colors.white)
  42. for i,v in ipairs(menuOptions) do
  43. i = 1, #menuOptions
  44. print(v.text)
  45. end
  46. term.setCursorPos(1,11)
  47. term.setTextColor(colors.yellow)
  48. print("Please input the number that you want to spawn:")
  49. term.setTextColor(colors.white)
  50. end
  51.  
  52. local function mainMenu()
  53. setup()
  54. verison()
  55. term.setCursorPos(1,5)
  56. term.setTextColor(colors.white)
  57. for i,v in ipairs(menuOptions) do
  58. i = 1, #menuOptions
  59. print(v.text)
  60. end
  61. term.setCursorPos(1,11)
  62. term.setTextColor(colors.yellow)
  63. print("Please input the number that you want to spawn:")
  64. term.setTextColor(colors.white)
  65.  
  66.  
  67. end
  68.  
  69. local function slc1()
  70. if slc == 1 then
  71. redstone.setBundledOutput("back",colors.orange, true)
  72. sleep(.1)
  73. redstone.setBundledOutput("back",colors.orange, false)
  74. end
  75. setup()
  76. verison()
  77. cenText("Zombies are selected!",5)
  78. cenText("Reset",11)
  79. term.setTextColor(colors.white)
  80. term.setCursorPos(1,12)
  81. read()
  82. if input == ("yes") then
  83. slc = 0
  84. end
  85.  
  86. end
  87. local function selection()
  88.  
  89. if input == ("1") then
  90. slc = 1
  91. slc1()
  92. elseif input ==("2")then
  93.  
  94. elseif input ==("3") then
  95.  
  96. elseif input ==("4") then
  97.  
  98. elseif input ==("5") then
  99. sleep(.5)
  100. setup()
  101. verison()
  102. mainMenu()
  103. else
  104. sleep(.5)
  105. setup()
  106. verison()
  107. mainMenu()
  108. end
  109. end
  110. while slc = 0 do
  111. mainMenu()
  112. selection()
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement