icaruscoil

BR Turbine Control Update

May 30th, 2015
463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.06 KB | None | 0 0
  1. -----An update to the old turbine control script using the new autodetect feature.
  2. -----To replace existing script at:  http://pastebin.com/5B8h94V4
  3.  
  4. -----BigReactor Control
  5. -----by jaranvil aka jared314
  6.  
  7. -----feel free to use and/or mondify this code
  8. -----------------------------------------------
  9.  
  10. version = 1
  11. term.clear()
  12. -------------------FORMATTING-------------------------------
  13. function clear()
  14.     mon.setBackgroundColor(colors.black)
  15.     mon.clear()
  16.     mon.setCursorPos(1,1)
  17. end
  18.  
  19. function draw_text_term(x, y, text, text_color, bg_color)
  20.     term.setTextColor(text_color)
  21.     term.setBackgroundColor(bg_color)
  22.     term.setCursorPos(x,y)
  23.     write(text)
  24. end
  25.  
  26. function draw_text(x, y, text, text_color, bg_color)
  27.     mon.setBackgroundColor(bg_color)
  28.     mon.setTextColor(text_color)
  29.     mon.setCursorPos(x,y)
  30.     mon.write(text)
  31. end
  32.  
  33. function draw_line(x, y, length, color)
  34.         mon.setBackgroundColor(color)
  35.         mon.setCursorPos(x,y)
  36.         mon.write(string.rep(" ", length))
  37. end
  38.  
  39. function draw_line_term(x, y, length, color)
  40.         term.setBackgroundColor(color)
  41.         term.setCursorPos(x,y)
  42.         term.write(string.rep(" ", length))
  43. end
  44.  
  45. function progress_bar(x, y, length, minVal, maxVal, bar_color, bg_color)
  46.     draw_line(x, y, length, bg_color) --backgoround bar
  47.     local barSize = math.floor((minVal/maxVal) * length)
  48.     draw_line(x, y, barSize, bar_color) --progress so far
  49. end
  50.  
  51. function progress_bar_term(x, y, length, minVal, maxVal, bar_color, bg_color)
  52.     draw_line_term(x, y, length, bg_color) --backgoround bar
  53.     local barSize = math.floor((minVal/maxVal) * length)
  54.     draw_line_term(x, y, barSize, bar_color)    --progress so far
  55. end
  56.  
  57. function button(x, y, length, text, txt_color, bg_color)
  58.     draw_line(x, y, length, bg_color)
  59.     draw_text((x+2), y, text, txt_color, bg_color)
  60. end
  61.  
  62. function menu_bar()
  63.     draw_line(1, 1, monX, colors.blue)
  64.     draw_text(2, 1, "Power    Tools    Settings", colors.white, colors.blue)
  65.     draw_line(1, 19, monX, colors.blue)
  66.     draw_text(2, 19, "     Turbine Control", colors.white, colors.blue)
  67. end
  68.  
  69. function power_menu()
  70.     draw_line(1, 2, 9, colors.gray)
  71.     draw_line(1, 3, 9, colors.gray)
  72.     if active then
  73.         draw_text(2, 2, "ON", colors.lightGray, colors.gray)
  74.         draw_text(2, 3, "OFF", colors.white, colors.gray)
  75.     else
  76.         draw_text(2, 2, "ON", colors.white, colors.gray)
  77.         draw_text(2, 3, "OFF", colors.lightGray, colors.gray)
  78.     end
  79. end
  80.  
  81. function tools_menu()
  82.     draw_line(10, 2, 14, colors.gray)
  83.     draw_line(10, 3, 14, colors.gray)
  84.     draw_text(11, 2, "Flow Rate", colors.white, colors.gray)
  85.     draw_text(11, 3, "Coils", colors.white, colors.gray)
  86.    
  87.    
  88. end
  89.  
  90. function settings_menu()
  91.     draw_line(12, 2, 18, colors.gray)
  92.     draw_line(12, 3, 18, colors.gray)
  93.     draw_text(13, 2, "Check for Updates", colors.white, colors.gray)
  94.     draw_text(13, 3, "Reset peripherals", colors.white, colors.gray)
  95. end
  96.  
  97. function popup_screen(y, title, height)
  98.     clear()
  99.     menu_bar()
  100.  
  101.     draw_line(4, y, 22, colors.blue)
  102.     draw_line(25, y, 1, colors.red)
  103.  
  104.     for counter = y+1, height+y do
  105.         draw_line(4, counter, 22, colors.white)
  106.     end
  107.  
  108.     draw_text(25, y, "X", colors.white, colors.red)
  109.     draw_text(5, y, title, colors.white, colors.blue)
  110. end
  111.  
  112. function save_config()
  113.     sw = fs.open("turbine_config.txt", "w")    
  114.         sw.writeLine(version)
  115.         sw.writeLine(side)
  116.         sw.writeLine(name)
  117.         sw.writeLine(auto_string)
  118.         sw.writeLine(on)
  119.         sw.writeLine(off)
  120.     sw.close()
  121. end
  122.  
  123. function load_config()
  124.     sr = fs.open("turbine_config.txt", "r")
  125.         version = tonumber(sr.readLine())
  126.         side = sr.readLine()
  127.         name = sr.readLine()
  128.         auto_string = sr.readLine()
  129.         on = tonumber(sr.readLine())
  130.         off = tonumber(sr.readLine())
  131.     sr.close()
  132. end
  133.  
  134. --------------------------------------------------
  135.  
  136.  
  137.  
  138. function homepage()
  139.     while true do
  140.         clear()
  141.         menu_bar()
  142.         terminal_screen()
  143.  
  144.         active = turbine.getActive()
  145.         energy_stored = turbine.getEnergyStored()
  146.        
  147.  
  148.         --------POWER STAT--------------
  149.         draw_text(2, 3, "Power: ", colors.yellow, colors.black)
  150.        
  151.         if active then
  152.             draw_text(10, 3, "ONLINE", colors.lime, colors.black)
  153.         else
  154.             draw_text(10, 3, "OFFLINE", colors.red, colors.black)
  155.         end
  156.  
  157.  
  158.         -----------Router speed---------------------
  159.         draw_text(2, 5, "Router Speed: ", colors.yellow, colors.black)
  160.         local maxVal = 2000
  161.         local minVal = math.floor(turbine.getRotorSpeed())
  162.         draw_text(19, 5, minVal.." rpm", colors.white, colors.black)
  163.  
  164.         if minVal < 700 then
  165.         progress_bar(2, 6, monX-2, minVal, maxVal, colors.lightBlue, colors.gray)
  166.         else if minVal < 900 then  
  167.         progress_bar(2, 6, monX-2, minVal, maxVal, colors.lime, colors.gray)
  168.         else if minVal < 1700 then
  169.         progress_bar(2, 6, monX-2, minVal, maxVal, colors.lightBlue, colors.gray)
  170.         else if minVal < 1900 then
  171.         progress_bar(2, 6, monX-2, minVal, maxVal, colors.lime, colors.gray)
  172.         else if minVal < 2000 then
  173.         progress_bar(2, 6, monX-2, minVal, maxVal, colors.yellow, colors.gray)
  174.         else if minVal >= 2000 then
  175.         progress_bar(2, 6, monX-2, minVal, maxVal, colors.red, colors.gray)
  176.         end
  177.         end
  178.         end
  179.         end
  180.         end
  181.         end
  182.  
  183.         -----------Steam Level---------------------
  184.         draw_text(2, 8, "Steam Amount: ", colors.yellow, colors.black)
  185.         local maxVal = 4000
  186.         local minVal = math.floor(turbine.getInputAmount())
  187.         draw_text(19, 8, minVal.." mB", colors.white, colors.black)
  188.         progress_bar(2, 9, monX-2, minVal, maxVal, colors.lightGray, colors.gray)
  189.        
  190.  
  191.         -----------Water Level---------------------
  192.         draw_text(2, 11, "Water Amount: ", colors.yellow, colors.black)
  193.         local maxVal = 4000
  194.         local minVal = math.floor(turbine.getOutputAmount())
  195.         draw_text(19, 11, minVal.." mB", colors.white, colors.black)
  196.         progress_bar(2, 12, monX-2, minVal, maxVal, colors.blue, colors.gray)
  197.    
  198.  
  199.         -------------OUTPUT-------------------
  200.         draw_text(2, 14, "RF/tick: ", colors.yellow, colors.black)
  201.         rft = math.floor(turbine.getEnergyProducedLastTick())
  202.         draw_text(19, 14, rft.." RF/T", colors.white, colors.black)
  203.  
  204.         -----------RF STORAGE---------------
  205.         draw_text(2, 15, "RF Stored:", colors.yellow, colors.black)
  206.         local maxVal = 1000000
  207.         local minVal = energy_stored
  208.         local percent = math.floor((energy_stored/maxVal)*100)
  209.         draw_text(19, 15, percent.."%", colors.white, colors.black)
  210.  
  211.         ------------FLOW RATE----------------
  212.         draw_text(2, 16, "Flow Rate: ", colors.yellow, colors.black)
  213.         flow_rate = turbine.getFluidFlowRateMax()
  214.         draw_text(19, 16, flow_rate.." mB/t", colors.white, colors.black)
  215.  
  216.         ------------COILS---------------------------
  217.         engaged = turbine.getInductorEngaged()
  218.         draw_text(2, 17, "Coils: ", colors.yellow, colors.black)
  219.  
  220.         if engaged then
  221.             draw_text(19, 17, "Engaged", colors.white, colors.black)
  222.         else
  223.             draw_text(19, 17, "Disengaged", colors.white, colors.black)
  224.         end
  225.  
  226.  
  227.        
  228.         sleep(0.5)
  229.     end
  230. end
  231.  
  232. --------------MENU SCREENS--------------
  233.  
  234.  
  235.  
  236. -------------------Tools----------------------
  237.  
  238. function flow_rate_menu()
  239.     popup_screen(3, "Flow Rate", 12)
  240.     flow_rate = turbine.getFluidFlowRateMax()
  241.     current_flow = turbine.getFluidFlowRate()
  242.  
  243.     draw_text(5, 5, "Steam consumption", colors.lime, colors.white)
  244.     draw_text(5, 6, "last tick:", colors.lime, colors.white)
  245.     draw_text(13, 8, current_flow.." mB", colors.black, colors.white)
  246.  
  247.     draw_text(5, 10, "Flow Rate Setting:", colors.lime, colors.white)
  248.     draw_text(8, 12, " < ", colors.white, colors.black)
  249.     draw_text(13, 12, flow_rate.." mB", colors.black, colors.white)
  250.     draw_text(21, 12, " > ", colors.white, colors.black)
  251.  
  252.     draw_text(13, 14, " Okay ", colors.white, colors.black)
  253.  
  254.     local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  255.  
  256.     --decrease
  257.     if yPos == 12 and xPos >= 8 and xPos <= 11 then
  258.         turbine.setFluidFlowRateMax(flow_rate-10)
  259.         flow_rate_menu()
  260.     --increase
  261.     else if yPos == 12 and xPos >= 21 and xPos <= 24 then
  262.         turbine.setFluidFlowRateMax(flow_rate+10)
  263.         flow_rate_menu()
  264.     end
  265.     end
  266.  
  267.     --Okay button
  268.     if yPos == 14 and xPos >= 13 and xPos <= 19 then
  269.         call_homepage()
  270.     end
  271.  
  272.     --Exit button
  273.     if yPos == 3 and xPos == 25 then
  274.         call_homepage()
  275.     end
  276.     flow_rate_menu()
  277. end
  278.  
  279.  
  280. function coil_menu()
  281.     engaged = turbine.getInductorEngaged()
  282.  
  283.     popup_screen(3, "Induction Coils", 8)
  284.     draw_text(5, 5, "Coil Status:", colors.black, colors.white)
  285.  
  286.     if engaged then
  287.         draw_text(5, 6, "Engaged", colors.lime, colors.white)
  288.         draw_text(10, 8, " Disengage ", colors.white, colors.black)
  289.     else
  290.         draw_text(5, 6, "Disengaged", colors.red, colors.white)
  291.         draw_text(10, 8, " Engage ", colors.white, colors.black)
  292.     end
  293.  
  294.     draw_text(12, 10, " Okay ", colors.white, colors.black)
  295.  
  296.  
  297.     local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  298.  
  299.     if yPos == 8 and xPos >= 10 and xPos <= 21 then
  300.         if engaged then
  301.             turbine.setInductorEngaged(false)
  302.             coil_menu()
  303.         else
  304.             turbine.setInductorEngaged(true)
  305.             coil_menu()
  306.         end
  307.     end
  308.  
  309.     --okay button
  310.     if yPos == 10 and xPos >= 12 and xPos <= 18 then
  311.         call_homepage()
  312.     end
  313.  
  314.  
  315.     coil_menu()
  316. end
  317.  
  318. -----------------------Settings--------------------------------
  319.  
  320.  
  321.  
  322. function install_update(program, pastebin)
  323.         clear()
  324.         draw_line(4, 5, 22, colors.blue)
  325.  
  326.         for counter = 6, 10 do
  327.             draw_line(4, counter, 22, colors.white)
  328.         end
  329.  
  330.         draw_text(5, 5, "Updating...", colors.white, colors.blue)
  331.         draw_text(5, 7, "Open computer", colors.black, colors.white)
  332.         draw_text(5, 8, "terminal.", colors.black, colors.white)
  333.  
  334.         if fs.exists("install") then fs.delete("install") end
  335.         shell.run("pastebin get p4zeq7Ma install")
  336.         shell.run("install")
  337.  
  338. end
  339.  
  340. function update()
  341.     popup_screen(5, "Updates", 4)
  342.     draw_text(5, 7, "Connecting to", colors.black, colors.white)
  343.     draw_text(5, 8, "pastebin...", colors.black, colors.white)
  344.  
  345.     sleep(0.5)
  346.    
  347.     shell.run("pastebin get QP3qrzNu current_version.txt")
  348.     sr = fs.open("current_version.txt", "r")
  349.     current_version = tonumber(sr.readLine())
  350.     sr.close()
  351.     fs.delete("current_version.txt")
  352.     terminal_screen()
  353.  
  354.     if current_version > version then
  355.  
  356.         popup_screen(5, "Updates", 7)
  357.         draw_text(5, 7, "Update Available!", colors.black, colors.white)
  358.         draw_text(11, 9, " Intall ", colors.white, colors.black)
  359.         draw_text(11, 11, " Ignore ", colors.white, colors.black)
  360.  
  361.         local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  362.  
  363.         --Instatll button
  364.         if yPos == 9 and xPos >= 11 and xPos <= 17 then
  365.             install_update()
  366.         end
  367.  
  368.         --Exit button
  369.         if yPos == 5 and xPos == 25 then
  370.             call_homepage()
  371.         end
  372.         call_homepage()
  373.  
  374.     else
  375.         popup_screen(5, "Updates", 5)
  376.         draw_text(5, 7, "You are up to date!", colors.black, colors.white)
  377.         draw_text(11, 9, " Okay ", colors.white, colors.black)
  378.  
  379.         local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  380.  
  381.         --Okay button
  382.         if yPos == 9 and xPos >= 11 and xPos <= 17 then
  383.             call_homepage()
  384.         end
  385.  
  386.         --Exit button
  387.         if yPos == 5 and xPos == 25 then
  388.             call_homepage()
  389.         end
  390.         call_homepage()
  391.     end
  392.  
  393.    
  394.  
  395. end
  396.  
  397. function reset_peripherals()
  398.     clear()
  399.     draw_line(4, 5, 22, colors.blue)
  400.  
  401.     for counter = 6, 10 do
  402.         draw_line(4, counter, 22, colors.white)
  403.     end
  404.  
  405.     draw_text(5, 5, "Reset Peripherals", colors.white, colors.blue)
  406.     draw_text(5, 7, "Open computer", colors.black, colors.white)
  407.     draw_text(5, 8, "terminal.", colors.black, colors.white)
  408.     setup_wizard()
  409.  
  410. end
  411.  
  412. --stop running status screen if monitors was touched
  413. function stop()
  414.     while true do
  415.         local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  416.             x = xPos
  417.             y = yPos
  418.             stop_function = "monitor_touch"
  419.         return
  420.     end
  421. end
  422.  
  423. function mon_touch()
  424.     --when the monitor is touch on the homepage
  425.     if y == 1 then
  426.             if x < monX/3 then
  427.                 power_menu()
  428.                 local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  429.                 if xPos < 9 then
  430.                     if yPos == 2 then
  431.                         turbine.setActive(true)
  432.                         call_homepage()
  433.                     else if yPos == 3 then
  434.                         turbine.setActive(false)
  435.                         call_homepage()
  436.                     else
  437.                         call_homepage()
  438.                     end
  439.                     end
  440.                 else
  441.                     call_homepage()
  442.                 end
  443.                
  444.             else if x < 20 then
  445.                 tools_menu()
  446.                 local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  447.                 if xPos < 25 and xPos > 10 then
  448.                     if yPos == 2 then
  449.                         flow_rate_menu()
  450.                     else if yPos == 3 then
  451.                         coil_menu()
  452.                     else if yPos == 4 then
  453.                        
  454.                     else if yPos == 5 then
  455.                    
  456.                     else
  457.                         call_homepage()
  458.                     end
  459.                     end
  460.                     end
  461.                     end
  462.                 else
  463.                     call_homepage()
  464.                 end
  465.             else if x < monX then
  466.                 settings_menu()
  467.                 local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  468.                 if xPos > 13 then
  469.                     if yPos == 2 then
  470.                         update()
  471.                     else if yPos == 3 then
  472.                         reset_peripherals()
  473.                     else
  474.                         call_homepage()
  475.                     end
  476.                     end
  477.                 else
  478.                     call_homepage()
  479.                 end
  480.             end
  481.             end
  482.             end
  483.         else
  484.             call_homepage()
  485.         end
  486. end
  487.  
  488. function terminal_screen()
  489.     term.clear()
  490.     draw_line_term(1, 1, 55, colors.blue)
  491.     draw_text_term(13, 1, "BigReactor Controls", colors.white, colors.blue)
  492.     draw_line_term(1, 19, 55, colors.blue)
  493.     draw_text_term(13, 19, "by jaranvil aka jared314", colors.white, colors.blue)
  494.  
  495.     draw_text_term(1, 3, "Current program:", colors.white, colors.black)
  496.     draw_text_term(1, 4, "Turbine Control v"..version, colors.blue, colors.black)
  497.    
  498.     draw_text_term(1, 6, "Installer:", colors.white, colors.black)
  499.     draw_text_term(1, 7, "pastebin.com/p4zeq7Ma", colors.blue, colors.black)
  500.  
  501.     draw_text_term(1, 9, "Please give me your feedback, suggestions,", colors.white, colors.black)
  502.     draw_text_term(1, 10, "and errors!", colors.white, colors.black)
  503.  
  504.     draw_text_term(1, 11, "reddit.com/r/br_controls", colors.blue, colors.black)
  505. end
  506.  
  507. --run both homepage() and stop() until one returns
  508. function call_homepage()
  509.     clear()
  510.     parallel.waitForAny(homepage, stop)
  511.  
  512.     if stop_function == "terminal_screen" then
  513.         stop_function = "nothing"
  514.         setup_wizard()
  515.     else if stop_function == "monitor_touch" then
  516.         stop_function = "nothing"
  517.         mon_touch()
  518.     end
  519.     end
  520. end
  521.  
  522. --try to wrap peripherals
  523. --catch any errors
  524.     function test_turbine_connection()
  525.         turbine = peripheral.wrap(name)  --wrap turbine
  526.         c = turbine.getConnected()
  527.         if unexpected_condition then error() end  
  528.     end
  529.  
  530.     function test_monitor_connection()
  531.         mon = peripheral.wrap(side) --wrap mon
  532.         monX, monY = mon.getSize() --get mon size ()
  533.         if unexpected_condition then error() end  
  534.     end
  535.  
  536.  --test if the entered monitor and turbine can be wrapped
  537.  function test_configs()
  538.  
  539.     term.clear()
  540.     draw_line_term(1, 1, 55, colors.blue)
  541.     draw_text_term(10, 1, "BigReactor Controls v"..version, colors.white, colors.blue)
  542.     draw_line_term(1, 19, 55, colors.blue)
  543.     draw_text_term(10, 19, "by jaranvil aka jared314", colors.white, colors.blue)
  544.     draw_text_term(1, 3, "Searching for a peripherals...", colors.white, colors.black)
  545.     sleep(1)
  546.  
  547.     turbine = turbineSearch()
  548.     mon = monitorSearch()
  549.  
  550.  
  551.     draw_text_term(2, 5, "Connecting to turbine...", colors.white, colors.black)
  552.     sleep(0.5)
  553.   if turbine == null then
  554.       draw_text_term(1, 8, "Error:", colors.red, colors.black)
  555.       draw_text_term(1, 9, "Could not connect to turbine", colors.red, colors.black)
  556.       draw_text_term(1, 10, "Turbine must be connected with networking cable", colors.white, colors.black)
  557.       draw_text_term(1, 11, "and modems or the computer is directly beside", colors.white, colors.black)
  558.        draw_text_term(1, 12,"the turbine's computer port.", colors.white, colors.black)
  559.       draw_text_term(1, 14, "Press Enter to continue...", colors.gray, colors.black)
  560.       wait = read()
  561.       setup_wizard()
  562.   else
  563.       draw_text_term(27, 5, "success", colors.lime, colors.black)
  564.       sleep(0.5)
  565.   end
  566.  
  567.   draw_text_term(2, 6, "Connecting to monitor...", colors.white, colors.black)
  568.   sleep(0.5)
  569.   if mon == null then
  570.       draw_text_term(1, 7, "Error:", colors.red, colors.black)
  571.       draw_text_term(1, 8, "Could not connect to a monitor. Place a 3x3 advanced monitor", colors.red, colors.black)
  572.       draw_text_term(1, 11, "Press Enter to continue...", colors.gray, colors.black)
  573.       wait = read()
  574.       setup_wizard()
  575.   else
  576.       monX, monY = mon.getSize()
  577.       draw_text_term(27, 6, "success", colors.lime, colors.black)
  578.       sleep(0.5)
  579.   end
  580.     draw_text_term(2, 7, "saving configuration...", colors.white, colors.black)  
  581.  
  582.     save_config()
  583.  
  584.     sleep(0.1)
  585.     draw_text_term(1, 9, "Setup Complete!", colors.lime, colors.black)
  586.     sleep(1)
  587.  
  588.     auto = auto_string == "true"
  589.     call_homepage()
  590.  
  591. end
  592. ----------------SETUP-------------------------------
  593.  
  594. function setup_wizard()
  595.  
  596.   term.clear()
  597.  
  598.  
  599.      draw_text_term(1, 1, "BigReactor Controls v"..version, colors.lime, colors.black)
  600.      draw_text_term(1, 2, "Peripheral setup", colors.white, colors.black)
  601.      draw_text_term(1, 4, "Step 1:", colors.lime, colors.black)
  602.      draw_text_term(1, 5, "-Place 3x3 advanced monitors next to computer.", colors.white, colors.black)
  603.      draw_text_term(1, 7, "Step 2:", colors.lime, colors.black)
  604.      draw_text_term(1, 8, "-Place a wired modem on this computer and on the ", colors.white, colors.black)
  605.      draw_text_term(1, 9, " computer port of the turbine.", colors.white, colors.black)
  606.      draw_text_term(1, 10, "-connect modems with network cable.", colors.white, colors.black)
  607.      draw_text_term(1, 11, "-right click modems to activate.", colors.white, colors.black)
  608.      draw_text_term(1, 13, "Press Enter when ready...", colors.gray, colors.black)
  609.    
  610.      wait = read()
  611.       test_configs()
  612.  
  613.    
  614. end
  615.  
  616. -- peripheral searching thanks to /u/kla_sch
  617. -- http://pastebin.com/gTEBHv3D
  618. function turbineSearch()
  619.    local names = peripheral.getNames()
  620.    local i, name
  621.    for i, name in pairs(names) do
  622.       if peripheral.getType(name) == "BigReactors-Turbine" then
  623.          return peripheral.wrap(name)
  624.       else
  625.          --return null
  626.       end
  627.    end
  628. end
  629.  
  630. function monitorSearch()
  631.    local names = peripheral.getNames()
  632.    local i, name
  633.    for i, name in pairs(names) do
  634.       if peripheral.getType(name) == "monitor" then
  635.         test = name
  636.          return peripheral.wrap(name)
  637.       else
  638.          --return null
  639.       end
  640.    end
  641. end
  642.  
  643. function start()
  644.     --if configs exists, load values and test
  645.     if fs.exists("turbine_config.txt") then
  646.             load_config()
  647.  
  648.             test_configs()
  649.     else
  650.         setup_wizard()
  651.     end
  652. end
  653.  
  654. start()
Add Comment
Please, Sign In to add comment