Spiker985

FTB - Auto Spawner - Updated

May 5th, 2017
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.08 KB | None | 0 0
  1. --[[Edit]]--
  2. local mon = peripheral.find("monitor")  --Name of monitor as peripheral
  3. local spawner = peripheral.find("auto_spawner") --Name of spawner as peripheral
  4. local chest = peripheral.find("diamond") --Name of chest as peripheral
  5. local header = "Currently Spawning: "   --Appears at the top of the screen
  6. local chestDirection = "south"  --From spawner: north, south, east, west, up, down
  7. local spawnerDirection = "north"        --From chest: north, south, east, west, up, down
  8. local witherSkeletonEggName = "WitherS" --Whatever you name your wither skeleton safari net, this automatically activates exact mode when inserted into the spawner
  9. local showWarning = true    --Shows the warning while loading
  10. local lightsOnDefault = true    --if true, turns the lights on when restarted
  11. local grinderOnDefault = true   --if true, turns the grinders on when restarted
  12. local spawnOnDefault = false    --if true, begins spawning immediately after a restart
  13. local beginAgain = true     --if true when showing the mob list, will revert to page 1 rather than resuming from the last page open --[[DOESNT affect a restart]]--
  14. local config = "config" --Name of the configuration file, used when saving/loading options
  15. local configAutoload = true
  16.  
  17. local useRednetAPI = true
  18.  
  19. if useRednetAPI then
  20.     rednetSide = "left"
  21.     lightsColor = colors.red     --Redstone control for lights: colors api names
  22.     grinderColor = colors.green  --Redstone control for grinder: colors api names
  23.     spawnerColor = colors.brown  --Redstone control for spawner: colors api names
  24. else
  25.     lightsSide = "right"    --Redstone control for lights: front, left, back, right, up, down
  26.     grinderSide = "top" --Redstone control for grinders: front, left, back, right, up, down
  27.     spawnerSide = "back"    --Redstone control for spawner: front, left, back, right, up, down
  28. end
  29.  
  30. --[[Debug]]--
  31. local showFound = false --Print to the computer what has been found in the chest inventory
  32. local showSetup = true
  33.  
  34.  
  35. --[[Do no edit unless you know what you are doing]]--
  36. local mobPos = {}
  37. local totalCount = 0
  38. local npp = 12
  39. local pages = 0
  40. local pageNum = 1
  41.  
  42. function APILoader(apiName, apiPastebin)
  43.   os.unloadAPI(apiName)
  44.   if fs.exists(apiName) then
  45.     os.loadAPI(apiName)
  46.   else
  47.     shell.run("pastebin","get",apiPastebin,apiName)
  48.     os.loadAPI(apiName)
  49.   end
  50. end
  51.  
  52. function clear()
  53.   mon.clear()
  54.   mon.setCursorPos(1, 1)
  55.   button.clearTable()
  56. end
  57.  
  58. function heading(page)
  59.   if page == "main" then
  60.     if spawner.getStackInSlot(1) == nil then
  61.       button.heading(header)
  62.     else
  63.       button.heading(header..spawner.getStackInSlot(1).display_name)
  64.     end
  65.   end
  66.   if page == "options" then
  67.     button.heading("Options: Green - True, Red - False")
  68.   end
  69. end
  70.  
  71. function setupMainMenu()
  72.   heading("main")
  73.   if useRednetAPI then
  74.     --button.setTable("Exact", toggleExact, "", "", spawner.getSpawnExact(), 3, 13, 7, 9)
  75.     button.setTable("Mob List", list, "yes", "", false, 15, 25, 3, 5)
  76.     button.setTable("Remove", removeEgg, "", "", false, 27, 37, 3, 5)
  77.    
  78.     button.setTable("Exact", toggleExact, "", "", spawner.getSpawnExact(), 3, 13, 7, 9)
  79.     button.setTable("Grinders", redstone, "grinder", "", not colors.test(rs.getBundledOutput(rednetSide), grinderColor), 15, 25, 7, 9)
  80.     button.setTable("Lights", redstone, "lights", "", colors.test(rs.getBundledOutput(rednetSide), lightsColor), 27, 37, 7, 9)
  81.    
  82.     --button.setTable("Exact", toggleExact, "", "", spawner.getSpawnExact(), 3, 13, 11, 13)
  83.     button.setTable("Tank", tankInfo, "", "", false, 15, 25, 11, 13)
  84.     --button.setTable("Lights", redstone, "lights", "", colors.test(rs.getBundledOutput(rednetSide), lightsColor), 27, 37, 11, 13)
  85.    
  86.     button.setTable("Spawn", redstone, "spawn", "", not colors.test(rs.getBundledOutput(rednetSide), spawnerColor), 3, 13, 15, 17)
  87.     button.setTable("Options", setupOptionsMenu, "yes", "", false, 15, 25, 15, 17)
  88.     button.setTable("Reboot", os.reboot, "", "", false, 27, 37, 15, 17)
  89.   else
  90.     --button.setTable("Exact", toggleExact, "", "", spawner.getSpawnExact(), 3, 13, 7, 9)
  91.     button.setTable("Mob List", list, "yes", "", false, 15, 25, 3, 5)
  92.     button.setTable("Remove", removeEgg, "", "", false, 27, 37, 3, 5)
  93.    
  94.     button.setTable("Exact", toggleExact, "", "", spawner.getSpawnExact(), 3, 13, 7, 9)
  95.     button.setTable("Grinders", redstone, "grinder", "", not rs.getOutput(grinderSide), 15, 25, 7, 9)
  96.     button.setTable("Lights", redstone, "lights", "", rs.getOutput(lightsSide), 27, 37, 7, 9)
  97.    
  98.     --button.setTable("Exact", toggleExact, "", "", spawner.getSpawnExact(), 3, 13, 11, 13)
  99.     button.setTable("Tank", tank, "", "", false, 15, 25, 11, 13)
  100.     --button.setTable("Lights", redstone, "lights", "", colors.test(rs.getBundledOutput(rednetSide), lightsColor), 27, 37, 11, 13)
  101.    
  102.     button.setTable("Spawn", redstone, "spawn", "", not rs.getOutput(spawnerSide), 3, 13, 15, 17)
  103.     button.setTable("Options", setupOptionsMenu, "yes", "", false, 15, 25, 15, 17)
  104.     button.setTable("Reboot", os.reboot, "", "", false, 27, 37, 15, 17)
  105.   end
  106.   button.screen()
  107. end
  108.  
  109. function setupOptionsMenu(answer)
  110.   if answer == "yes" then button.flash("Options") end
  111.   clear()
  112.   heading("options")
  113.   button.setTable("Warning", options, "warning", "", showWarning, 3, 13, 3, 5)
  114.   button.setTable("Lights", options, "lights", "", lightsOnDefault, 15, 25, 3, 5)
  115.   button.setTable("Grinders", options, "grinder", "", grinderOnDefault, 27, 37, 3, 5)
  116.   button.setTable("Spawning", options, "spawner", "", spawnOnDefault, 3, 13, 7, 9)
  117.   button.setTable("Begin Again", options, "again", "", beginAgain, 15, 25, 7, 9)
  118.   button.setTable("Del Config", options, "delconfig", "", false, 15, 25, 11, 13)
  119.   button.setTable("Save", gamestate, "save", "options", false, 3, 13, 15, 17)
  120.   button.setTable("Load", gamestate, "load", "options", false, 27, 37, 15, 17)
  121.   button.setTable("Return", back, "", "", false, 15, 25, 15, 17)
  122.   button.screen()
  123. end
  124.  
  125. function tankInfo()
  126.   button.flash("Tank")
  127.   clear()
  128.   tank = spawner.getTankInfo()
  129.   button.heading(tank[1].contents.amount.."mBs of "..tank[1].contents.rawName.." out of "..tank[1].capacity.."mBs.")
  130.   button.screen()
  131.   sleep(2)
  132.   clear()
  133.   setupMainMenu()
  134. end
  135.  
  136. function gamestate(state, menu)
  137.   clear()
  138.   if state == "save" then
  139.     file = fs.open(config, "w")
  140.     button.label(5, 5, "Saving: ")
  141.     sleep(0.4)
  142.     file.writeLine(showWarning)
  143.     button.label(5, 7, "Show Warning: Done")
  144.     sleep(0.4)
  145.     file.writeLine(lightsOnDefault)
  146.     button.label(5, 9, "Lights On by Default: Done")
  147.     sleep(0.4)
  148.     file.writeLine(grinderOnDefault)
  149.     button.label(5, 11, "Grinder On by Default: Done")
  150.     sleep(0.4)
  151.     file.writeLine(spawnOnDefault)
  152.     button.label(5, 13, "Start Spawning by Default: Done")
  153.     sleep(0.4)
  154.     file.writeLine(beginAgain)
  155.     button.label(5, 15, "Begin Again: Done")
  156.     sleep(0.4)
  157.     button.label(5, 17, "Done! Saved as "..config)
  158.     file.close()
  159.     sleep(1)
  160.   end
  161.   if state == "load" and fs.exists(config) then
  162.     file = fs.open(config, "r")
  163.     button.label(5, 5, "Loading: ")
  164.     sleep(0.4)
  165.     if file.readLine() == "true" then showWarning = true else showWarning = false end
  166.     if showSetup then print("Show warning: "..tostring(showWarning)) end
  167.     button.label(5, 7, "Show Warning: Done")
  168.     sleep(0.4)
  169.     if useRednetAPI then
  170.       --Lights
  171.       if file.readLine() == "true" then
  172.         lightsOnDefault = true
  173.         rs.setBundledOutput(rednetSide, colors.combine(rs.getBundledOutput(rednetSide), lightsColor))
  174.       else
  175.         lightsOnDefault = false
  176.         rs.setBundledOutput(rednetSide, colors.subtract(rs.getBundledOutput(rednetSide), lightsColor))
  177.       end
  178.       if showSetup then print("Lights Default: "..tostring(lightsOnDefault)) end
  179.       button.label(5, 9, "Lights On by Default: Done")
  180.       sleep(0.4)
  181.      
  182.       --Grinder
  183.       if file.readLine() == "true" then
  184.         grinderOnDefault = true
  185.         rs.setBundledOutput(rednetSide, colors.subtract(rs.getBundledOutput(rednetSide), grinderColor))
  186.       else
  187.         grinderOnDefault = false
  188.         rs.setBundledOutput(rednetSide, colors.combine(rs.getBundledOutput(rednetSide), grinderColor))
  189.       end
  190.       if showSetup then print("Grinder Default: "..tostring(grinderOnDefault)) end
  191.       button.label(5, 11, "Grinder On by Default: Done")
  192.       sleep(0.4)
  193.      
  194.       --Spawner
  195.       if file.readLine() == "true" then
  196.         spawnOnDefault = true
  197.         rs.setBundledOutput(rednetSide, colors.subtract(rs.getBundledOutput(rednetSide), spawnerColor))
  198.       else
  199.         spawnOnDefault = false
  200.         rs.setBundledOutput(rednetSide, colors.combine(rs.getBundledOutput(rednetSide), spawnerColor))
  201.       end
  202.       if showSetup then print("Spawning Default: "..tostring(spawnOnDefault)) end
  203.       button.label(5, 13, "Start Spawning by Default: Done")
  204.       sleep(0.4)
  205.     else
  206.       --Lights
  207.       if file.readLine() == "true" then lightsOnDefault = true else lightsOnDefault = false end
  208.       rs.setOutput(lightsSide, lightsOnDefault)
  209.       if showSetup then print("Lights Default: "..tostring(lightsOnDefault)) end
  210.       button.label(5, 9, "Lights On by Default: Done")
  211.       sleep(0.4)
  212.      
  213.       --Grinder
  214.       if file.readLine() == "true" then grinderOnDefault = true else grinderOnDefault = false end
  215.       rs.setOutput(grinderSide, not grinderOnDefault)
  216.       if showSetup then print("Grinder Default: "..tostring(grinderOnDefault)) end
  217.       button.label(5, 11, "Grinder On by Default: Done")
  218.       sleep(0.4)
  219.      
  220.       --Spawner
  221.       if file.readLine() == "true" then spawnOnDefault = true else spawnOnDefault = false end
  222.       rs.setOutput(spawnerSide, not spawnOnDefault)
  223.       if showSetup then print("Spawning Default: "..tostring(spawnOnDefault)) end
  224.       button.label(5, 13, "Start Spawning by Default: Done")
  225.       sleep(0.4)
  226.     end
  227.    
  228.     if file.readLine() == "true" then beginAgain = true else beginAgain = false end
  229.     if showSetup then print("Begin again: "..tostring(beginAgain)) end
  230.     button.label(5, 15, "Begin Again: Done")
  231.     sleep(0.4)
  232.     button.label(5, 17, "Done! "..config.." loaded!")
  233.     file.close()
  234.     sleep(1)
  235.   end
  236.   if menu == "options" then setupOptionsMenu() end
  237.   if menu == "main" then setupMainMenu() end
  238.   if menu == "check" then button.heading("Checking mobs...") end
  239. end
  240.  
  241. function options(option)
  242.   if option == "warning" then
  243.     showWarning = not showWarning
  244.   end
  245.   if option == "lights" then
  246.     lightsOnDefault = not lightsOnDefault
  247.   end
  248.   if option == "grinder" then
  249.     grinderOnDefault = not grinderOnDefault
  250.   end
  251.   if option == "spawner" then
  252.     spawnOnDefault = not spawnOnDefault
  253.   end
  254.   if option == "again" then
  255.     beginAgain = not beginAgain
  256.   end
  257.   if option == "delconfig" then
  258.     button.flash("Del Config")
  259.     if fs.exists(config) then fs.delete(config) end
  260.   end
  261.   sleep(0.2)
  262.   setupOptionsMenu()
  263. end
  264.  
  265. function redstone(object)
  266. if useRednetAPI then
  267.     if object == "lights" then
  268.       if colors.test(rs.getBundledOutput(rednetSide), lightsColor) then
  269.         rs.setBundledOutput(rednetSide, colors.subtract(rs.getBundledOutput(rednetSide), lightsColor))
  270.       else
  271.         rs.setBundledOutput(rednetSide, colors.combine(rs.getBundledOutput(rednetSide), lightsColor))
  272.       end
  273.     end
  274.     if object == "grinder" then
  275.       if colors.test(rs.getBundledOutput(rednetSide), grinderColor) then
  276.         rs.setBundledOutput(rednetSide, colors.subtract(rs.getBundledOutput(rednetSide), grinderColor))
  277.       else
  278.         rs.setBundledOutput(rednetSide, colors.combine(rs.getBundledOutput(rednetSide), grinderColor))
  279.       end
  280.     end
  281.     if object == "spawn" then
  282.       if colors.test(rs.getBundledOutput(rednetSide), spawnerColor) then
  283.         rs.setBundledOutput(rednetSide, colors.subtract(rs.getBundledOutput(rednetSide), spawnerColor))
  284.       else
  285.         rs.setBundledOutput(rednetSide, colors.combine(rs.getBundledOutput(rednetSide), spawnerColor))
  286.       end
  287.     end
  288. else
  289.     if object == "lights" then
  290.       rs.setOutput(lightsSide, not rs.getOutput(lightsSide))
  291.     end
  292.     if object == "grinder" then
  293.       rs.setOutput(grinderSide, not rs.getOutput(grinderSide))
  294.     end
  295.     if object == "spawn" then
  296.       rs.setOutput(spawnerSide, not rs.getOutput(spawnerSide))
  297.     end
  298. end
  299.   sleep(0.2)
  300.   --clear()
  301.   setupMainMenu()
  302. end
  303.  
  304. function clearNreset()
  305.   clear()
  306.   setupMainMenu()
  307. end
  308.  
  309. function toggleExact()
  310.   spawner.setSpawnExact(not spawner.getSpawnExact())
  311.   clear()
  312.   setupMainMenu()
  313. end
  314.  
  315. function removeEgg()
  316.   button.flash("Remove")
  317.   if spawner.getStackInSlot(1).display_name == witherSkeletonEggName then
  318.     spawner.setSpawnExact(false)
  319.   end
  320.   chest.pullItemIntoSlot(spawnerDirection, 1)
  321.   clear()
  322.   button.heading("Re-checking mobs...")
  323.   checkMobs()
  324.   clear()
  325.   setupMainMenu()
  326. end
  327.  
  328. function insert(slot)
  329.   if chest.getStackInSlot(slot).display_name == witherSkeletonEggName then
  330.     spawner.setSpawnExact(true)
  331.   else
  332.     spawner.setSpawnExact(false)
  333.   end
  334.   chest.pullItemIntoSlot(spawnerDirection, 1)
  335.   spawner.pullItemIntoSlot(chestDirection, slot)
  336.   clear()
  337.   setupMainMenu()
  338. end
  339.  
  340. function back(answer)
  341.   button.flash("Return")
  342.   clear()
  343.   setupMainMenu()
  344.   if beginAgain == true and answer == "yes" then pageNum = 1 end
  345. end
  346.  
  347. function page(dir)
  348.   if dir == "prev" then
  349.     button.flash("<")
  350.     if pageNum - 1 >= 1 then
  351.       pageNum = pageNum - 1
  352.     end
  353.   end
  354.   if dir == "next" then
  355.     button.flash(">")
  356.     if pageNum + 1 <= pages then
  357.       pageNum = pageNum + 1
  358.     end
  359.   end
  360.   clear()
  361.   list()
  362. end
  363.  
  364. function loading()
  365.   clear()
  366.   button.heading("Loading...")
  367.   button.screen()
  368. end
  369.  
  370. function list(answer)
  371.   if answer == "yes" then button.flash("Mob List") end
  372.   loading()
  373.   checkMobs()
  374.   clear()
  375.   heading("main")
  376.   if pageNum == 1 then
  377.     k = 0
  378.     j = 0
  379.     for i = 1, 12 do
  380.       if k == 16 and j == 0 then
  381.         j = 12
  382.     k = 0
  383.       end
  384.       if k == 16 and j == 12 then
  385.     j = 24
  386.     k = 0
  387.       end
  388.       if k == 16 and j == 24 then
  389.         break
  390.       end
  391.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  392.       k = k + 4
  393.     end
  394.   end
  395.   if pageNum == 2 then
  396.     k = 0
  397.     j = 0
  398.     for i = 13, 24 do
  399.       next(mobPos, 11)
  400.       if k == 16 and j == 0 then
  401.         j = 12
  402.         k = 0
  403.       end
  404.       if k == 16 and j == 12 then
  405.         j = 24
  406.         k = 0
  407.       end
  408.       if k == 16 and j == 24 then
  409.         break
  410.       end
  411.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  412.       k = k + 4
  413.     end
  414.   end
  415.   if pageNum == 3 then
  416.     k = 0
  417.     j = 0
  418.     for i = 25, 16 do
  419.       next(mobPos, 11)
  420.       if k == 16 and j == 0 then
  421.         j = 12
  422.         k = 0
  423.       end
  424.       if k == 16 and j == 12 then
  425.         j = 24
  426.         k = 0
  427.       end
  428.       if k == 16 and j == 24 then
  429.         break
  430.       end
  431.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  432.       k = k + 4
  433.     end
  434.   end
  435.   if pageNum == 4 then
  436.     k = 0
  437.     j = 0
  438.     for i = 37, 48 do
  439.       next(mobPos, 11)
  440.       if k == 16 and j == 0 then
  441.         j = 12
  442.         k = 0
  443.       end
  444.       if k == 16 and j == 12 then
  445.         j = 24
  446.         k = 0
  447.       end
  448.       if k == 16 and j == 24 then
  449.         break
  450.       end
  451.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  452.       k = k + 4
  453.     end
  454.   end
  455.   if pageNum == 5 then
  456.     k = 0
  457.     j = 0
  458.     for i = 49, 60 do
  459.       next(mobPos, 11)
  460.       if k == 16 and j == 0 then
  461.         j = 12
  462.         k = 0
  463.       end
  464.       if k == 16 and j == 12 then
  465.         j = 24
  466.         k = 0
  467.       end
  468.       if k == 16 and j == 24 then
  469.         break
  470.       end
  471.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  472.       k = k + 4
  473.     end
  474.   end
  475.   if pageNum == 6 then
  476.     k = 0
  477.     j = 0
  478.     for i = 61, 72 do
  479.       next(mobPos, 11)
  480.       if k == 16 and j == 0 then
  481.         j = 12
  482.         k = 0
  483.       end
  484.       if k == 16 and j == 12 then
  485.         j = 24
  486.         k = 0
  487.       end
  488.       if k == 16 and j == 24 then
  489.         break
  490.       end
  491.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  492.       k = k + 4
  493.     end
  494.   end
  495.   if pageNum == 7 then
  496.     k = 0
  497.     j = 0
  498.     for i = 73, 84 do
  499.       next(mobPos, 11)
  500.       if k == 16 and j == 0 then
  501.         j = 12
  502.         k = 0
  503.       end
  504.       if k == 16 and j == 12 then
  505.         j = 24
  506.         k = 0
  507.       end
  508.       if k == 16 and j == 24 then
  509.         break
  510.       end
  511.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  512.       k = k + 4
  513.     end
  514.   end
  515.   if pageNum == 8 then
  516.     k = 0
  517.     j = 0
  518.     for i = 85, 96 do
  519.       next(mobPos, 11)
  520.       if k == 16 and j == 0 then
  521.         j = 12
  522.         k = 0
  523.       end
  524.       if k == 16 and j == 12 then
  525.         j = 24
  526.         k = 0
  527.       end
  528.       if k == 16 and j == 24 then
  529.         break
  530.       end
  531.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  532.       k = k + 4
  533.     end
  534.   end
  535.   if pageNum == 9 then
  536.     k = 0
  537.     j = 0
  538.     for i = 97, 100 do
  539.       next(mobPos, 11)
  540.       if k == 16 and j == 0 then
  541.         j = 12
  542.         k = 0
  543.       end
  544.       if k == 16 and j == 12 then
  545.         j = 24
  546.         k = 0
  547.       end
  548.       if k == 16 and j == 24 then
  549.         break
  550.       end
  551.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  552.       k = k + 4
  553.     end
  554.   end
  555.   if pageNum == 10 then
  556.     k = 0
  557.     j = 0
  558.     for i = 101, 112 do
  559.       next(mobPos, 11)
  560.       if k == 16 and j == 0 then
  561.         j = 12
  562.         k = 0
  563.       end
  564.       if k == 16 and j == 12 then
  565.         j = 24
  566.         k = 0
  567.       end
  568.       if k == 16 and j == 24 then
  569.         break
  570.       end
  571.       button.setTable(mobPos[i].mob, insert, i, "", false, 3+j, 13+j, 3+k, 5+k)
  572.       k = k + 4
  573.     end
  574.   end
  575.   button.remTable("Empty")
  576.   button.setTable("<", page, "prev", "", false, 15, 19, 19, 20)
  577.   button.setTable(">", page, "next", "", false, 21, 25, 19, 20)
  578.   button.setTable("Return", back, "yes", "", false, 3, 13, 19, 20)
  579.   button.label(28, 19, "Page "..pageNum.." of "..pages)
  580.   button.screen()
  581. end
  582.  
  583. function warn()
  584.   button.label(5, 5, "The more slots an inventory has,")
  585.   button.label(5, 7, "the longer it will take to load!")
  586.   button.label(5, 10, "Every safari net needs to be")
  587.   button.label(5, 12, "renamed in an Anvil to show up!")
  588. end
  589.  
  590. function checkMobs()
  591.   u = 0
  592.   for i = 1, chest.getInventorySize() do
  593.     mobPos[i] = {}
  594.     u = u + 1
  595.     if chest.getStackInSlot(i) == nil then
  596.       mobPos[i]["mob"] = "Empty"
  597.       u = u - 1
  598.     else
  599.       mobPos[i]["mob"] = chest.getStackInSlot(i).display_name
  600.     end
  601.     if showFound == true then
  602.       for name, data in pairs(mobPos) do
  603.         print("Found: "..data.mob)
  604.       end
  605.     end
  606.   end
  607.   totalRows = u
  608.   pages = math.ceil(totalRows/npp)
  609. end
  610.  
  611. function checkPress()
  612.   event, side, x, y = os.pullEvent("monitor_touch")
  613.   button.checkxy(x,y)
  614. end
  615.  
  616. APILoader("button","S8x0K3ui")
  617. clear()
  618. if showWarning == true then warn() end
  619. if useRednetAPI == true then
  620.   if lightsOnDefault == true then rs.setBundledOutput(rednetSide, colors.combine(rs.getBundledOutput(rednetSide), lightsColor)) else rs.setBundledOutput(rednetSide, colors.subtract(rs.getBundledOutput(rednetSide), lightsColor)) end
  621.   if grinderOnDefault == true then rs.setBundledOutput(rednetSide, colors.subtract(rs.getBundledOutput(rednetSide), grinderColor)) else rs.setBundledOutput(rednetSide, colors.combine(rs.getBundledOutput(rednetSide), grinderColor)) end
  622.   if spawnOnDefault == true then rs.setBundledOutput(rednetSide, colors.subtract(rs.getBundledOutput(rednetSide), spawnerColor)) else rs.setBundledOutput(rednetSide, colors.combine(rs.getBundledOutput(rednetSide), spawnerColor)) end
  623. else
  624.   if lightsOnDefault == true then rs.setOutput(lightsSide, true) else rs.setOutput(lightsSide, false) end
  625.   if grinderOnDefault == true then rs.setOutput(grinderSide, false) else rs.setOutput(grinderSide, true) end
  626.   if spawnOnDefault == true then rs.setOutput(spawnerSide, false) else rs.setOutput(spawnerSide, true) end
  627. end
  628. if configAutoload == true and fs.exists(config) == true then gamestate("load", "check") else button.label(5, 16, "To enable autoload you must have a") button.label(5, 18, "config saved! *Enable in file*") end
  629. checkMobs()
  630. clear()
  631. setupMainMenu()
  632.  
  633.  
  634. while true do
  635.   checkPress()
  636. end
Advertisement
Add Comment
Please, Sign In to add comment