Advertisement
matthewkk91

Untitled

Jun 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 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. local function setup()
  18.     term.clear()
  19.     term.setCursorPos(1,1)
  20. end
  21. local function verison()
  22. term.setTextColor(colors.yellow)
  23. cenText("Auto-Spawner Verison 1.0",1)
  24. end
  25.  
  26.  
  27. menuOptions = {
  28.     [1]= {text = "(1)Zombie"},
  29.     [2]= {text = "(2)Blaze"},
  30.     [3]= {text = "(3)Skelton"},
  31.     [4]= {text = "(4)Sheep"},
  32.     [5]= {text = "(5)Reset"},
  33. }
  34.  
  35.  
  36. local function mainMenu()
  37.     setup()
  38.     verison()
  39.     term.setCursorPos(1,5)
  40.     term.setTextColor(colors.white)
  41.         for i,v in ipairs(menuOptions) do
  42.             i = 1, #menuOptions
  43.             print(v.text)
  44.         end
  45.     term.setCursorPos(1,11)
  46.     term.setTextColor(colors.yellow)
  47.     print("Please input the number that you want to spawn:")
  48.     term.setTextColor(colors.white)
  49. end
  50.  
  51. local function mainMenu()
  52.     slc = 0
  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.         slc = 0
  101.     else
  102.         sleep(.5)
  103.         slc = 0
  104.     end
  105. end
  106. while slc == 0 do
  107.     mainMenu()
  108.     selection()
  109. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement