Advertisement
matthewkk91

Untitled

Jun 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 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.  
  8. local w, h = term.getSize()
  9.  
  10. --function to centertext
  11.  
  12. local function cenText(text,y)
  13.     term.setCursorPos(w/2-#text/2,y)
  14.     term.write(text)
  15. end
  16. local input = read()
  17.  
  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.     read()
  51. end
  52.  
  53. local function slc1()
  54.     if slc == 1 then
  55.         redstone.setBundledOutput("back",colors.orange, true)
  56.         sleep(.1)
  57.         redstone.setBundledOutput("back",colors.orange, false)
  58.     end
  59.     setup()
  60.     verison()
  61.     cenText("Zombies are selected!",5)
  62.     cenText("Reset",11)
  63.     term.setTextColor(colors.white)
  64.     term.setCursorPos(1,12)
  65.     read()
  66.     if input == ("yes") then
  67.         slc = 0
  68.     end
  69.    
  70. end
  71. local function selection()
  72.  
  73.     if input == ("1") then
  74.         slc = 1
  75.         slc1()
  76.     elseif input ==("2")then
  77.    
  78.     elseif input ==("3") then
  79.        
  80.     elseif input ==("4") then
  81.        
  82.     elseif input ==("5") then
  83.         sleep(.5)
  84.         slc = 0
  85.     else
  86.         sleep(.5)
  87.         slc = 0
  88.     end
  89. end
  90. while slc == 0 do
  91.     mainMenu()
  92.     selection()
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement