Advertisement
matthewkk91

Untitled

Jun 26th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 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.  
  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.  
  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. local function selection()
  27. input = read()
  28.     if input == ("1") then
  29.         term.clear()
  30.     elseif input ==("2")then
  31.         term.clear()
  32.     elseif input ==("3") then
  33.         term.clear()
  34.     elseif input ==("4") then
  35.         term.clear()
  36.     elseif input ==("5") then
  37.         term.clear()
  38.     else then
  39.         print("no")
  40.     end
  41. end
  42.  
  43. menuOptions = {
  44.     [1]= {text = "(1)Zombie"},
  45.     [2]= {text = "(2)Blaze"},
  46.     [3]= {text = "(3)Skelton"},
  47.     [4]= {text = "(4)Sheep"},
  48.     [5]= {text = "(5)Reset"},
  49. }
  50.  
  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.     selection()
  66. end
  67.  
  68.  
  69.  
  70. mainMenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement