Advertisement
matthewkk91

Untitled

Jun 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 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.     end
  31.  
  32.  
  33.  
  34.  
  35. end
  36.  
  37. menuOptions = {
  38.     [1]= {text = "(1)Zombie"},
  39.     [2]= {text = "(2)Blaze"},
  40.     [3]= {text = "(3)Skelton"},
  41.     [4]= {text = "(4)Sheep"},
  42.     [5]= {text = "(5)Reset"},
  43. }
  44.  
  45.  
  46. local function mainMenu()
  47.     setup()
  48.     verison()
  49.     term.setCursorPos(1,5)
  50.     term.setTextColor(colors.white)
  51.         for i,v in ipairs(menuOptions) do
  52.             i = 1, #menuOptions
  53.             print(v.text)
  54.         end
  55.     term.setCursorPos(1,11)
  56.     term.setTextColor(colors.yellow)
  57.     print("Please input the number that you want to spawn:")
  58.     term.setTextColor(colors.white)
  59.     read()
  60.     selection()
  61. end
  62.  
  63.  
  64.  
  65. mainMenu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement