magge019

Mobcontroller

Jul 22nd, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. local choice
  2. local sList = {colors.blue, colors.green, colors.red, colors.white}
  3.  
  4. function centerText(text)
  5. local x,buf1 = term.getSize()
  6. local buf2,y = term.getCursorPos()
  7. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y)
  8. print(text)
  9. end
  10.  
  11. function choose()
  12. term.clear()
  13. term.setCursorPos(1,1)
  14. term.setTextColor(colors.lightBlue)
  15. centerText("Cambridge Corp. Spawner Controller")
  16. print("")
  17. centerText("Chose your spawner")
  18. print("1: Zombie Pigman")
  19. print("2: Creeper")
  20. print("3: Skeleton")
  21. print("4: Slime")
  22. print("5: Chicken")
  23. print("6: Cow")
  24. print("7: Sheep")
  25. choice = read()
  26. choice = tonumber(choice)
  27. end
  28.  
  29. function run()
  30. term.clear()
  31. term.setCursorPos(1,1)
  32. redstone.setBundledOutput("back", sList[choice])
  33. centerText("Starting spawner...")
  34. print("Press any key to stop the spawner!")
  35. read()
  36. redstone.setBundledOutput("back",0)
  37. end
  38.  
  39. while true do
  40. choose()
  41. if (choice <= table.getn(sList)) and choice > 0 then
  42. run()
  43. end
  44. end
Advertisement
Add Comment
Please, Sign In to add comment