MFeltmann

startup

Apr 18th, 2026
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --this is a script to see storage level for a draconic energy storage thingy
  2.  
  3. local mon = peripheral.find("monitor")
  4. local core = peripheral.find("draconic_rf_storage")
  5. local tier = 0
  6. local colorShield = colors.white
  7. local colorCore = colors.white
  8. local input, output = peripheral.find("flux_gate")
  9. local limitTransfer = true
  10. local currentControls = "main"
  11. local page = 1
  12. local putLimit = ""
  13. local version = "0.7"
  14.  
  15. if fs.exists("logs.cfg") then
  16. else
  17.     file = io.open("logs.cfg", "w")
  18.     file:write("")
  19.     file:close()
  20. end
  21.  
  22. mon.setTextScale(1)
  23.  
  24. local function fileWrite(path, text)
  25.     local file = io.open(path, "w")
  26.     file:write(text)
  27.     file:close()
  28. end
  29.  
  30. local function fileWriteFromTable(path, t)
  31.     local text = ""
  32.     for _, line in pairs(t) do
  33.         text = text..line.."\n"
  34.     end
  35.     fileWrite(path, text)
  36. end
  37.  
  38. local function fileGetTable(path)
  39.     if fs.exists(path) then
  40.         local file = io.open(path, "r")
  41.         local lines = {}
  42.         local i = 1
  43.         local line = file:read("*l")
  44.         while line ~= nil do
  45.             lines[i] = line
  46.             line = file:read("*l")
  47.             i = i +1
  48.         end
  49.         file:close()
  50.         return lines
  51.     end
  52.     return {}
  53. end
  54.  
  55. local function fileReplaceLine(path, n, text)
  56.     local lines = fileGetTable(path)
  57.     lines[n] = text
  58.     fileWriteFromTable(path, lines)
  59. end
  60.  
  61. local function fileAppend(path, text)
  62.     local file = io.open(path, "a")
  63.     file:write(text.."\n")
  64.     file:close()
  65. end
  66.  
  67. local function fileGetLength(path)
  68.     local file = io.open(path, "r")
  69.     local i = 0
  70.     while file:read("*l") ~= nil do
  71.         i = i +1
  72.     end
  73.     file:close()
  74.     return i
  75. end
  76.  
  77. local function fileGetLines(path, startN, endN)
  78.     local lines = fileGetTable(path)
  79.     local linesOut = {}
  80.     local x = 1
  81.     for i = startN, endN, 1 do
  82.         linesOut[x] = lines[i]
  83.         x = x + 1
  84.     end
  85.     return linesOut
  86. end
  87.  
  88. local function detectInOutput()
  89.     input, output = peripheral.find("flux_gate")
  90.     --print(input)
  91.     --print(output)
  92.     if core.getTransferPerTick() ~= 0 then
  93.         if core.getTransferPerTick() < 0 then
  94.             output.setSignalLowFlow(0)
  95.             sleep(2)
  96.             if core.getTransferPerTick() >= 0 then
  97.                 --keep it
  98.             else
  99.                 output, input = peripheral.find("flux_gate")
  100.             end
  101.             output.setSignalLowFlow(2147483647)
  102.             input.setSignalLowFlow(2147483647)
  103.         elseif core.getTransferPerTick() > 0 then
  104.             input.setSignalLowFlow(0)
  105.             sleep(2)
  106.             if core.getTransferPerTick() <= 0 then
  107.                 --keep it
  108.             else
  109.                 output, input = peripheral.find("flux_gate")
  110.             end
  111.             output.setSignalLowFlow(2147483647)
  112.             input.setSignalLowFlow(2147483647)
  113.         end
  114.     end
  115. end
  116.  
  117. if peripheral.find("flux_gate") == nil then
  118.     limitTransfer = false
  119. else
  120.     limitTransfer = true
  121.     detectInOutput()
  122. end
  123.  
  124. local function getLogs(path, xPos, yPos)
  125.     local Logs = fileGetLines(path, fileGetLength(path)-5, fileGetLength(path))
  126.     for i = 1, 6, 1 do
  127.         mon.setCursorPos(xPos+2,yPos+1+i)
  128.         mon.write(Logs[i])
  129.     end
  130. end
  131.  
  132. local function addLog(path, time, text)
  133.     fileAppend(path, "["..time.."]")
  134.     fileAppend(path, text)
  135. end
  136.  
  137. local function round(num, idp)
  138.     local mult = 10^(idp or 0)
  139.     return math.floor(num * mult + 0.5) / mult
  140. end
  141.  
  142. local function drawL1(xPos, yPos)
  143.     mon.setCursorPos(xPos, yPos)
  144.     mon.setBackgroundColor(colorCore)
  145.     mon.write(" ")
  146.     mon.setCursorPos(xPos, yPos+1)
  147.     mon.write(" ")
  148.     mon.setCursorPos(xPos, yPos+2)
  149.     mon.write(" ")
  150.     mon.setCursorPos(xPos, yPos+3)
  151.     mon.write(" ")
  152.     mon.setCursorPos(xPos, yPos+4)
  153.     mon.setBackgroundColor(colorShield)
  154.     mon.write(" ")
  155.     mon.setCursorPos(xPos, yPos+5)
  156.     mon.setBackgroundColor(colorCore)
  157.     mon.write(" ")
  158.     mon.setCursorPos(xPos, yPos+6)
  159.     mon.write(" ")
  160.     mon.setCursorPos(xPos, yPos+7)
  161.     mon.setBackgroundColor(colorShield)
  162.     mon.write(" ")
  163.     mon.setCursorPos(xPos, yPos+8)
  164.     mon.setBackgroundColor(colorCore)
  165.     mon.write(" ")
  166. end
  167.  
  168. local function drawL2(xPos, yPos)
  169.     mon.setCursorPos(xPos, yPos)
  170.     mon.setBackgroundColor(colorCore)
  171.     mon.write(" ")
  172.     mon.setCursorPos(xPos, yPos+1)
  173.     mon.write(" ")
  174.     mon.setCursorPos(xPos, yPos+2)
  175.     mon.write(" ")
  176.     mon.setCursorPos(xPos, yPos+3)
  177.     mon.write(" ")
  178.     mon.setCursorPos(xPos, yPos+4)
  179.     mon.write(" ")
  180.     mon.setCursorPos(xPos, yPos+5)
  181.     mon.setBackgroundColor(colorShield)
  182.     mon.write(" ")
  183.     mon.setCursorPos(xPos, yPos+6)
  184.     mon.setBackgroundColor(colorCore)
  185.     mon.write(" ")
  186.     mon.setCursorPos(xPos, yPos+7)
  187.     mon.write(" ")
  188.     mon.setCursorPos(xPos, yPos+8)
  189.     mon.write(" ")
  190. end
  191.  
  192. local function drawL3(xPos, yPos)
  193.     mon.setCursorPos(xPos, yPos)
  194.     mon.setBackgroundColor(colorCore)
  195.     mon.write(" ")
  196.     mon.setCursorPos(xPos, yPos+1)
  197.     mon.write(" ")
  198.     mon.setCursorPos(xPos, yPos+2)
  199.     mon.setBackgroundColor(colorShield)
  200.     mon.write(" ")
  201.     mon.setCursorPos(xPos, yPos+3)
  202.     mon.setBackgroundColor(colorCore)
  203.     mon.write(" ")
  204.     mon.setCursorPos(xPos, yPos+4)
  205.     mon.write(" ")
  206.     mon.setCursorPos(xPos, yPos+5)
  207.     mon.write(" ")
  208.     mon.setCursorPos(xPos, yPos+6)
  209.     mon.setBackgroundColor(colorShield)
  210.     mon.write(" ")
  211.     mon.setCursorPos(xPos, yPos+7)
  212.     mon.setBackgroundColor(colorCore)
  213.     mon.write(" ")
  214.     mon.setCursorPos(xPos, yPos+8)
  215.     mon.write(" ")
  216. end
  217.  
  218. local function drawL4(xPos, yPos)
  219.     mon.setCursorPos(xPos, yPos)
  220.     mon.setBackgroundColor(colorCore)
  221.     mon.write(" ")
  222.     mon.setCursorPos(xPos, yPos+1)
  223.     mon.write(" ")
  224.     mon.setCursorPos(xPos, yPos+2)
  225.     mon.write(" ")
  226.     mon.setCursorPos(xPos, yPos+3)
  227.     mon.setBackgroundColor(colorShield)
  228.     mon.write(" ")
  229.     mon.setCursorPos(xPos, yPos+4)
  230.     mon.setBackgroundColor(colorCore)
  231.     mon.write(" ")
  232.     mon.setCursorPos(xPos, yPos+5)
  233.     mon.write(" ")
  234.     mon.setCursorPos(xPos, yPos+6)
  235.     mon.write(" ")
  236.     mon.setCursorPos(xPos, yPos+7)
  237.     mon.setBackgroundColor(colorShield)
  238.     mon.write(" ")
  239.     mon.setCursorPos(xPos, yPos+8)
  240.     mon.setBackgroundColor(colorCore)
  241.     mon.write(" ")
  242. end
  243.  
  244. local function drawL5(xPos, yPos)
  245.     mon.setCursorPos(xPos, yPos)
  246.     mon.setBackgroundColor(colorShield)
  247.     mon.write(" ")
  248.     mon.setCursorPos(xPos, yPos+1)
  249.     mon.setBackgroundColor(colorCore)
  250.     mon.write(" ")
  251.     mon.setCursorPos(xPos, yPos+2)
  252.     mon.write(" ")
  253.     mon.setCursorPos(xPos, yPos+3)
  254.     mon.write(" ")
  255.     mon.setCursorPos(xPos, yPos+4)
  256.     mon.write(" ")
  257.     mon.setCursorPos(xPos, yPos+5)
  258.     mon.write(" ")
  259.     mon.setCursorPos(xPos, yPos+6)
  260.     mon.write(" ")
  261.     mon.setCursorPos(xPos, yPos+7)
  262.     mon.write(" ")
  263.     mon.setCursorPos(xPos, yPos+8)
  264.     mon.write(" ")
  265. end
  266.  
  267. local function drawL6(xPos, yPos)
  268.     mon.setCursorPos(xPos, yPos)
  269.     mon.setBackgroundColor(colorCore)
  270.     mon.write(" ")
  271.     mon.setCursorPos(xPos, yPos+1)
  272.     mon.setBackgroundColor(colorShield)
  273.     mon.write(" ")
  274.     mon.setCursorPos(xPos, yPos+2)
  275.     mon.setBackgroundColor(colorCore)
  276.     mon.write(" ")
  277.     mon.setCursorPos(xPos, yPos+3)
  278.     mon.write(" ")
  279.     mon.setCursorPos(xPos, yPos+4)
  280.     mon.write(" ")
  281.     mon.setCursorPos(xPos, yPos+5)
  282.     mon.setBackgroundColor(colorShield)
  283.     mon.write(" ")
  284.     mon.setCursorPos(xPos, yPos+6)
  285.     mon.setBackgroundColor(colorCore)
  286.     mon.write(" ")
  287.     mon.setCursorPos(xPos, yPos+7)
  288.     mon.write(" ")
  289.     mon.setCursorPos(xPos, yPos+8)
  290.     mon.write(" ")
  291. end
  292.  
  293. local function drawL7(xPos, yPos)
  294.     mon.setCursorPos(xPos, yPos)
  295.     mon.setBackgroundColor(colorCore)
  296.     mon.write(" ")
  297.     mon.setCursorPos(xPos, yPos+1)
  298.     mon.write(" ")
  299.     mon.setCursorPos(xPos, yPos+2)
  300.     mon.write(" ")
  301.     mon.setCursorPos(xPos, yPos+3)
  302.     mon.setBackgroundColor(colorShield)
  303.     mon.write(" ")
  304.     mon.setCursorPos(xPos, yPos+4)
  305.     mon.setBackgroundColor(colorCore)
  306.     mon.write(" ")
  307.     mon.setCursorPos(xPos, yPos+5)
  308.     mon.write(" ")
  309.     mon.setCursorPos(xPos, yPos+6)
  310.     mon.setBackgroundColor(colorShield)
  311.     mon.write(" ")
  312.     mon.setCursorPos(xPos, yPos+7)
  313.     mon.setBackgroundColor(colorCore)
  314.     mon.write(" ")
  315.     mon.setCursorPos(xPos, yPos+8)
  316.     mon.setBackgroundColor(colorShield)
  317.     mon.write(" ")
  318. end
  319.  
  320. local function drawL8(xPos, yPos)
  321.     mon.setCursorPos(xPos, yPos)
  322.     mon.setBackgroundColor(colorCore)
  323.     mon.write(" ")
  324.     mon.setCursorPos(xPos, yPos+1)
  325.     mon.write(" ")
  326.     mon.setCursorPos(xPos, yPos+2)
  327.     mon.write(" ")
  328.     mon.setCursorPos(xPos, yPos+3)
  329.     mon.write(" ")
  330.     mon.setCursorPos(xPos, yPos+4)
  331.     mon.setBackgroundColor(colorShield)
  332.     mon.write(" ")
  333.     mon.setCursorPos(xPos, yPos+5)
  334.     mon.setBackgroundColor(colorCore)
  335.     mon.write(" ")
  336.     mon.setCursorPos(xPos, yPos+6)
  337.     mon.write(" ")
  338.     mon.setCursorPos(xPos, yPos+7)
  339.     mon.write(" ")
  340.     mon.setCursorPos(xPos, yPos+8)
  341.     mon.write(" ")
  342. end
  343.  
  344. local function drawL9(xPos, yPos)
  345.     mon.setCursorPos(xPos, yPos)
  346.     mon.setBackgroundColor(colorCore)
  347.     mon.write(" ")
  348.     mon.setCursorPos(xPos, yPos+1)
  349.     mon.setBackgroundColor(colorShield)
  350.     mon.write(" ")
  351.     mon.setCursorPos(xPos, yPos+2)
  352.     mon.setBackgroundColor(colorCore)
  353.     mon.write(" ")
  354.     mon.setCursorPos(xPos, yPos+3)
  355.     mon.write(" ")
  356.     mon.setCursorPos(xPos, yPos+4)
  357.     mon.write(" ")
  358.     mon.setCursorPos(xPos, yPos+5)
  359.     mon.write(" ")
  360.     mon.setCursorPos(xPos, yPos+6)
  361.     mon.write(" ")
  362.     mon.setCursorPos(xPos, yPos+7)
  363.     mon.setBackgroundColor(colorShield)
  364.     mon.write(" ")
  365.     mon.setCursorPos(xPos, yPos+8)
  366.     mon.setBackgroundColor(colorCore)
  367.     mon.write(" ")
  368. end
  369.  
  370. local function drawL10(xPos, yPos)
  371.     mon.setCursorPos(xPos, yPos)
  372.     mon.setBackgroundColor(colorCore)
  373.     mon.write(" ")
  374.     mon.setCursorPos(xPos, yPos+1)
  375.     mon.write(" ")
  376.     mon.setCursorPos(xPos, yPos+2)
  377.     mon.setBackgroundColor(colorShield)
  378.     mon.write(" ")
  379.     mon.setCursorPos(xPos, yPos+3)
  380.     mon.setBackgroundColor(colorCore)
  381.     mon.write(" ")
  382.     mon.setCursorPos(xPos, yPos+4)
  383.     mon.write(" ")
  384.     mon.setCursorPos(xPos, yPos+5)
  385.     mon.setBackgroundColor(colorShield)
  386.     mon.write(" ")
  387.     mon.setCursorPos(xPos, yPos+6)
  388.     mon.setBackgroundColor(colorCore)
  389.     mon.write(" ")
  390.     mon.setCursorPos(xPos, yPos+7)
  391.     mon.write(" ")
  392.     mon.setCursorPos(xPos, yPos+8)
  393.     mon.setBackgroundColor(colorShield)
  394.     mon.write(" ")
  395. end
  396.  
  397. local function drawL11(xPos, yPos)
  398.     mon.setCursorPos(xPos, yPos)
  399.     mon.setBackgroundColor(colorCore)
  400.     mon.write(" ")
  401.     mon.setCursorPos(xPos, yPos+1)
  402.     mon.write(" ")
  403.     mon.setCursorPos(xPos, yPos+2)
  404.     mon.write(" ")
  405.     mon.setCursorPos(xPos, yPos+3)
  406.     mon.write(" ")
  407.     mon.setCursorPos(xPos, yPos+4)
  408.     mon.write(" ")
  409.     mon.setCursorPos(xPos, yPos+5)
  410.     mon.write(" ")
  411.     mon.setCursorPos(xPos, yPos+6)
  412.     mon.setBackgroundColor(colorShield)
  413.     mon.write(" ")
  414.     mon.setCursorPos(xPos, yPos+7)
  415.     mon.setBackgroundColor(colorCore)
  416.     mon.write(" ")
  417.     mon.setCursorPos(xPos, yPos+8)
  418.     mon.write(" ")
  419. end
  420.  
  421. local function drawL12(xPos, yPos)
  422.     mon.setCursorPos(xPos, yPos)
  423.     mon.setBackgroundColor(colorShield)
  424.     mon.write(" ")
  425.     mon.setCursorPos(xPos, yPos+1)
  426.     mon.setBackgroundColor(colorCore)
  427.     mon.write(" ")
  428.     mon.setCursorPos(xPos, yPos+2)
  429.     mon.write(" ")
  430.     mon.setCursorPos(xPos, yPos+3)
  431.     mon.write(" ")
  432.     mon.setCursorPos(xPos, yPos+4)
  433.     mon.write(" ")
  434.     mon.setCursorPos(xPos, yPos+5)
  435.     mon.write(" ")
  436.     mon.setCursorPos(xPos, yPos+6)
  437.     mon.write(" ")
  438.     mon.setCursorPos(xPos, yPos+7)
  439.     mon.write(" ")
  440.     mon.setCursorPos(xPos, yPos+8)
  441.     mon.write(" ")
  442. end
  443.  
  444. local function drawL13(xPos, yPos)
  445.     mon.setCursorPos(xPos, yPos)
  446.     mon.setBackgroundColor(colorCore)
  447.     mon.write(" ")
  448.     mon.setCursorPos(xPos, yPos+1)
  449.     mon.write(" ")
  450.     mon.setCursorPos(xPos, yPos+2)
  451.     mon.write(" ")
  452.     mon.setCursorPos(xPos, yPos+3)
  453.     mon.setBackgroundColor(colorShield)
  454.     mon.write(" ")
  455.     mon.setCursorPos(xPos, yPos+4)
  456.     mon.setBackgroundColor(colorCore)
  457.     mon.write(" ")
  458.     mon.setCursorPos(xPos, yPos+5)
  459.     mon.write(" ")
  460.     mon.setCursorPos(xPos, yPos+6)
  461.     mon.setBackgroundColor(colorShield)
  462.     mon.write(" ")
  463.     mon.setCursorPos(xPos, yPos+7)
  464.     mon.setBackgroundColor(colorCore)
  465.     mon.write(" ")
  466.     mon.setCursorPos(xPos, yPos+8)
  467.     mon.write(" ")
  468. end
  469.  
  470. local function drawBox(xMin, xMax, yMin, yMax, title)
  471.     mon.setBackgroundColor(colors.gray)
  472.     for xPos = xMin, xMax, 1 do
  473.         mon.setCursorPos(xPos, yMin)
  474.         mon.write(" ")
  475.     end
  476.     for yPos = yMin, yMax, 1 do
  477.         mon.setCursorPos(xMin, yPos)
  478.         mon.write(" ")
  479.         mon.setCursorPos(xMax, yPos)
  480.         mon.write(" ")
  481.     end
  482.     for xPos = xMin, xMax, 1 do
  483.         mon.setCursorPos(xPos, yMax)
  484.         mon.write(" ")
  485.     end
  486.     mon.setCursorPos(xMin+2, yMin)
  487.     mon.setBackgroundColor(colors.black)
  488.     mon.write(" ")
  489.     mon.write(title)
  490.     mon.write(" ")
  491. end
  492.  
  493. local function drawButton(xMin, xMax, yMin, yMax, text1, text2, bcolor)
  494.     mon.setBackgroundColor(bcolor)
  495.     for yPos = yMin, yMax, 1 do
  496.         for xPos = xMin, xMax, 1 do
  497.             mon.setCursorPos(xPos, yPos)
  498.             mon.write(" ")
  499.         end
  500.     end
  501.     mon.setCursorPos(math.floor((((xMax+xMin)/2)+0.5)-string.len(text1)/2),math.floor(((yMax+yMin)/2)))
  502.     mon.write(text1)
  503.     if text2 == nil then
  504.     else
  505.         mon.setCursorPos(math.floor((((xMax+xMin)/2)+0.5)-string.len(text2)/2),math.floor(((yMax+yMin)/2)+0.5))
  506.         mon.write(text2)
  507.     end
  508.     mon.setBackgroundColor(colors.black)
  509. end
  510.  
  511. local function drawClear(xMin, xMax, yMin, yMax)
  512. mon.setBackgroundColor(colors.black)
  513.     for yPos = yMin, yMax, 1 do
  514.         for xPos = xMin, xMax, 1 do
  515.             mon.setCursorPos(xPos, yPos)
  516.             mon.write(" ")
  517.         end
  518.     end
  519. end
  520.  
  521. local function drawControls(xPos, yPos)
  522.     if currentControls == "main" then
  523.         --drawClear(xPos+1,xPos+22,yPos+1,yPos+8)
  524.         if limitTransfer == false then
  525.             drawButton(xPos+2,xPos+9,yPos+2,yPos+3,"Edit","InputMax",colors.gray)
  526.             drawButton(xPos+13,xPos+21,yPos+2,yPos+3,"Edit","OutputMax",colors.gray)
  527.         else
  528.             drawButton(xPos+2,xPos+9,yPos+2,yPos+3,"Edit","InputMax",colors.lime)
  529.             drawButton(xPos+13,xPos+21,yPos+2,yPos+3,"Edit","OutputMax",colors.red)
  530.         end
  531.         drawButton(xPos+2,xPos+9,yPos+6,yPos+7,"Edit","Config",colorCore)
  532.         drawButton(xPos+13,xPos+21,yPos+6,yPos+7,"No Use","Yet",colors.gray)
  533.     elseif currentControls == "editInput" or currentControls == "editOutput" then
  534.         --drawClear(xPos+1,xPos+22,yPos+1,yPos+8)
  535.         mon.setCursorPos(xPos+2,yPos+2)
  536.         if currentControls == "editInput" then
  537.             mon.write("Edit Max Input Rate")
  538.         else
  539.             mon.write("Edit Max Output Rate")
  540.         end
  541.         mon.setCursorPos(xPos+2,yPos+3)
  542.         mon.setBackgroundColor(colors.gray)
  543.         mon.write("___________")
  544.         if string.len(putLimit) >= 11 then
  545.                 putLimit = string.sub(putLimit,string.len(putLimit)-10)
  546.         end
  547.         if putLimit ~= "" then
  548.             if tonumber(putLimit) <= 2147483647 then
  549.                 mon.setCursorPos(xPos+13-string.len(putLimit),yPos+3)
  550.                 mon.write(putLimit)
  551.                 putLimitNum = tonumber(putLimit)
  552.                 mon.setBackgroundColor(colors.black)
  553.                 fix = 0
  554.                 if putLimitNum < 1000 then
  555.                     if string.len(putLimit) <= 3 then
  556.                         mon.setCursorPos(xPos+22-string.len(putLimit)-2,yPos+3)
  557.                         mon.write(putLimit)
  558.                     else
  559.                         mon.setCursorPos(xPos+22-4-2,yPos+3)
  560.                         mon.write(string.sub(putLimit,string.len(putLimit)-2))
  561.                     end
  562.                 elseif putLimitNum < 1000000 then
  563.                         if (round((putLimitNum/1000),1)*10)/(round((putLimitNum/1000),0)) == 10 then
  564.                             fix = 2
  565.                         end
  566.                     mon.setCursorPos(xPos+22-string.len(tostring(round((putLimitNum/1000),1)))-3-fix,yPos+3)
  567.                     mon.write(round((putLimitNum/1000),1))
  568.                     mon.write("k")
  569.                 elseif putLimitNum < 1000000000 then
  570.                         --if putLimitNum == 1000000*i or putLimitNum == 10000000*i or putLimitNum == 100000000*i then
  571.                         if (round((putLimitNum/1000000),1)*10)/(round((putLimitNum/1000000),0)) == 10 then
  572.                             fix = 2
  573.                         end
  574.                     mon.setCursorPos(xPos+22-string.len(tostring(round((putLimitNum/1000000),1)))-3-fix,yPos+3)
  575.                     mon.write(round((putLimitNum/1000000),1))
  576.                     mon.write("M")
  577.                 elseif putLimitNum < 1000000000000 then
  578.                         if (round((putLimitNum/1000000000),1)*10)/(round((putLimitNum/1000000000),0)) == 10 then
  579.                             fix = 2
  580.                         end
  581.                     mon.setCursorPos(xPos+22-string.len(tostring(round((putLimitNum/1000000000),1)))-3-fix,yPos+3)
  582.                     mon.write(round((putLimitNum/1000000000),1))
  583.                     mon.write("G")
  584.                 end
  585.                 mon.write("RF")
  586.             else
  587.                 putLimit = "2147483647"
  588.                 mon.setCursorPos(xPos+13-string.len(putLimit),yPos+3)
  589.                 mon.write(putLimit)
  590.                 mon.setCursorPos(xPos+22-6,yPos+3)
  591.                 mon.setBackgroundColor(colors.black)
  592.                 mon.write("2.1GRF")
  593.                 mon.setCursorPos(xPos+22-6,yPos+4)
  594.                 mon.write("(max)")
  595.                
  596.             end
  597.            
  598.         end
  599.         mon.setCursorPos(xPos+2,yPos+4)
  600.         mon.setBackgroundColor(colors.lightGray)
  601.         mon.write(" 1 ")
  602.         mon.setBackgroundColor(colors.gray)
  603.         mon.write(" ")
  604.         mon.setCursorPos(xPos+6,yPos+4)
  605.         mon.setBackgroundColor(colors.lightGray)
  606.         mon.write(" 2 ")
  607.         mon.setBackgroundColor(colors.gray)
  608.         mon.write(" ")
  609.         mon.setCursorPos(xPos+10,yPos+4)
  610.         mon.setBackgroundColor(colors.lightGray)
  611.         mon.write(" 3 ")
  612.         mon.setCursorPos(xPos+2,yPos+5)
  613.         mon.setBackgroundColor(colors.lightGray)
  614.         mon.write(" 4 ")
  615.         mon.setBackgroundColor(colors.gray)
  616.         mon.write(" ")
  617.         mon.setCursorPos(xPos+6,yPos+5)
  618.         mon.setBackgroundColor(colors.lightGray)
  619.         mon.write(" 5 ")
  620.         mon.setBackgroundColor(colors.gray)
  621.         mon.write(" ")
  622.         mon.setCursorPos(xPos+10,yPos+5)
  623.         mon.setBackgroundColor(colors.lightGray)
  624.         mon.write(" 6 ")
  625.         mon.setCursorPos(xPos+2,yPos+6)
  626.         mon.setBackgroundColor(colors.lightGray)
  627.         mon.write(" 7 ")
  628.         mon.setBackgroundColor(colors.gray)
  629.         mon.write(" ")
  630.         mon.setCursorPos(xPos+6,yPos+6)
  631.         mon.setBackgroundColor(colors.lightGray)
  632.         mon.write(" 8 ")
  633.         mon.setBackgroundColor(colors.gray)
  634.         mon.write(" ")
  635.         mon.setCursorPos(xPos+10,yPos+6)
  636.         mon.setBackgroundColor(colors.lightGray)
  637.         mon.write(" 9 ")
  638.         mon.setCursorPos(xPos+2,yPos+7)
  639.         mon.setBackgroundColor(colors.red)
  640.         mon.write(" < ")
  641.         mon.setBackgroundColor(colors.gray)
  642.         mon.write(" ")
  643.         mon.setCursorPos(xPos+6,yPos+7)
  644.         mon.setBackgroundColor(colors.lightGray)
  645.         mon.write(" 0 ")
  646.         mon.setBackgroundColor(colors.gray)
  647.         mon.write(" ")
  648.         mon.setCursorPos(xPos+10,yPos+7)
  649.         mon.setBackgroundColor(colors.red)
  650.         mon.write(" X ")
  651.         mon.setCursorPos(xPos+16,yPos+5)
  652.         mon.setBackgroundColor(colors.lime)
  653.         mon.write(" Apply")
  654.         mon.setCursorPos(xPos+16,yPos+7)
  655.         mon.setBackgroundColor(colors.red)
  656.         mon.write("Cancel")
  657.         mon.setBackgroundColor(colors.black)
  658.     elseif currentControls == "editOutput" then
  659.     elseif currentControls == "editConfig" then
  660.         mon.setCursorPos(xPos+2,yPos+2)
  661.         mon.write("Edit Config")
  662.         if limitTransfer == true then
  663.             drawButton(xPos+2,xPos+10,yPos+3,yPos+4,"Detect","Flux_Gate",colorCore)
  664.         else
  665.             drawButton(xPos+2,xPos+10,yPos+3,yPos+4,"Detect","Flux_Gate",colors.gray)
  666.         end
  667.         mon.setCursorPos(xPos+16,yPos+7)
  668.         mon.setBackgroundColor(colors.red)
  669.         mon.write("Cancel")
  670.         mon.setCursorPos(xPos+2,yPos+7)
  671.         mon.setBackgroundColor(colors.gray)
  672.         mon.write("Prev")
  673.         mon.setCursorPos(xPos+7,yPos+7)
  674.         mon.write("Next")
  675.         mon.setBackgroundColor(colors.black)
  676.     end
  677. end
  678.  
  679. local function drawDetails(xPos, yPos)
  680.     energyStored = core.getEnergyStored()
  681.     energyMax = core.getMaxEnergyStored()
  682.     energyTransfer = core.getTransferPerTick()
  683.     if limitTransfer == true then
  684.         inputRate = input.getFlow()
  685.         outputRate = output.getFlow()
  686.     end
  687.     mon.setCursorPos(xPos, yPos)
  688.     if energyMax < 50000000 then
  689.         tier = 1
  690.     elseif energyMax < 300000000 then
  691.         tier = 2
  692.     elseif energyMax < 2000000000 then
  693.         tier = 3
  694.     elseif energyMax < 10000000000 then
  695.         tier = 4
  696.     elseif energyMax < 50000000000 then
  697.         tier = 5
  698.     elseif energyMax < 400000000000 then
  699.         tier = 6
  700.     elseif energyMax < 3000000000000 then
  701.         tier = 7
  702.     else
  703.         tier = 8
  704.     end
  705.     mon.write("Tier: ")
  706.     mon.write(tier)
  707.     mon.setCursorPos(xPos+7, yPos)
  708.     mon.write("  ")
  709.     mon.setCursorPos(xPos, yPos+1)
  710.     mon.write("Stored: ")
  711.     if energyStored < 1000 then
  712.         mon.write(energyStored)
  713.     elseif energyStored < 1000000 then
  714.         mon.write(round((energyStored/1000),1))
  715.         mon.write("k")
  716.     elseif energyStored < 1000000000 then
  717.         mon.write(round((energyStored/1000000),1))
  718.         mon.write("M")
  719.     elseif energyStored < 1000000000000 then
  720.         mon.write(round((energyStored/1000000000),1))
  721.         mon.write("G")
  722.     elseif energyStored < 1000000000000000 then
  723.         mon.write(round((energyStored/1000000000000),1))
  724.         mon.write("T")
  725.     elseif energyStored < 1000000000000000000 then
  726.         mon.write(round((energyStored/1000000000000000),1))
  727.         mon.write("P")
  728.     elseif energyStored < 1000000000000000000000 then
  729.         mon.write(round((energyStored/1000000000000000000),1))
  730.         mon.write("E")
  731.     end
  732.     mon.write("RF")
  733.     mon.write("/")
  734.     if energyMax < 1000 then
  735.         mon.write(energyMax)
  736.     elseif energyMax < 1000000 then
  737.         mon.write(round((energyMax/1000),1))
  738.         mon.write("k")
  739.     elseif energyMax < 1000000000 then
  740.         mon.write(round((energyMax/1000000),1))
  741.         mon.write("M")
  742.     elseif energyMax < 1000000000000 then
  743.         mon.write(round((energyMax/1000000000),1))
  744.         mon.write("G")
  745.     elseif energyMax < 1000000000000000 then
  746.         mon.write(round((energyMax/1000000000000),1))
  747.         mon.write("T")
  748.     elseif energyMax < 1000000000000000000 then
  749.         mon.write(round((energyMax/1000000000000000 ),1))
  750.         mon.write("P")
  751.     elseif energyMax < 1000000000000000000000 then
  752.         mon.write(round((energyMax/1000000000000000000),1))
  753.         mon.write("E")
  754.     end
  755.     mon.write("RF")
  756.     mon.setCursorPos(xPos, yPos+2)
  757.     mon.setBackgroundColor(colors.lightGray)
  758.     for l = 1, 20, 1 do
  759.         mon.write(" ")
  760.     end
  761.     mon.setCursorPos(xPos, yPos+2)
  762.     mon.setBackgroundColor(colors.lime)
  763.     for l = 0, round((((energyStored/energyMax)*10)*2)-1,0), 1 do
  764.         mon.write(" ")
  765.     end
  766.     mon.setCursorPos(xPos, yPos+3)
  767.     mon.setBackgroundColor(colors.lightGray)
  768.     for l = 1, 20, 1 do
  769.         mon.write(" ")
  770.     end
  771.     mon.setCursorPos(xPos, yPos+3)
  772.     mon.setBackgroundColor(colors.lime)
  773.     for l = 0, round((((energyStored/energyMax)*10)*2)-1,0), 1 do
  774.         mon.write(" ")
  775.     end
  776.     mon.setBackgroundColor(colors.black)
  777.     mon.setCursorPos(xPos, yPos+4)
  778.     mon.write("                      ")
  779.     if string.len(tostring(round((energyStored/energyMax)*100))) == 1 then
  780.         if round((energyStored/energyMax)*100) <= 10 then
  781.             mon.setCursorPos(xPos, yPos+4)
  782.             mon.write(round((energyStored/energyMax)*100))
  783.             mon.setCursorPos(xPos+1, yPos+4)
  784.             mon.write("% ")
  785.         else
  786.             mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-10)/5), yPos+4)
  787.             mon.write(round((energyStored/energyMax)*100))
  788.             mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-10)/5)+1, yPos+4)
  789.             mon.write("% ")
  790.         end
  791.     elseif string.len(tostring(round((energyStored/energyMax)*100))) == 2 then
  792.         if round((energyStored/energyMax)*100) <= 15 then
  793.             mon.setCursorPos(xPos, yPos+4)
  794.             mon.write(round((energyStored/energyMax)*100))
  795.             mon.setCursorPos(xPos+2, yPos+4)
  796.             mon.write("% ")
  797.         else
  798.             mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-15)/5), yPos+4)
  799.             mon.write(round((energyStored/energyMax)*100))
  800.             mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-15)/5)+2, yPos+4)
  801.             mon.write("% ")
  802.         end
  803.     elseif string.len(tostring(round((energyStored/energyMax)*100))) == 3 then
  804.         if round((energyStored/energyMax)*100) <= 20 then
  805.             mon.setCursorPos(xPos, yPos+4)
  806.             mon.write(round((energyStored/energyMax)*100))
  807.             mon.setCursorPos(xPos+3, yPos+4)
  808.             mon.write("% ")
  809.         else
  810.             mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-20)/5), yPos+4)
  811.             mon.write(round((energyStored/energyMax)*100))
  812.             mon.setCursorPos(xPos+round((((energyStored/energyMax)*100)-20)/5)+3, yPos+4)
  813.             mon.write("% ")
  814.         end
  815.     end
  816.     mon.setCursorPos(xPos, yPos+5)
  817.     mon.write("InputMax:")
  818.     mon.setCursorPos(xPos, yPos+6)
  819.     mon.write("         ")
  820.     mon.setCursorPos(xPos, yPos+6)
  821.     mon.setTextColor(colors.lime)
  822.     if limitTransfer == true then
  823.         if inputRate == 0 then
  824.             mon.setTextColor(colors.red)
  825.         end
  826.         if inputRate < 1000 then
  827.             mon.write(inputRate)
  828.         elseif inputRate < 1000000 then
  829.             mon.write(round((inputRate/1000),1))
  830.             mon.write("k")
  831.         elseif inputRate < 1000000000 then
  832.             mon.write(round((inputRate/1000000),1))
  833.             mon.write("M")
  834.         elseif inputRate < 1000000000000 then
  835.             mon.write(round((inputRate/1000000000),1))
  836.             mon.write("G")
  837.         elseif inputRate < 1000000000000000 then
  838.             mon.write(round((inputRate/1000000000000),1))
  839.             mon.write("T")
  840.         elseif inputRate < 1000000000000000000 then
  841.             mon.write(round((inputRate/1000000000000000 ),1))
  842.             mon.write("P")
  843.         elseif inputRate < 1000000000000000000000 then
  844.             mon.write(round((inputRate/1000000000000000000),1))
  845.             mon.write("E")
  846.         end
  847.         mon.write("RF")
  848.     else
  849.         mon.write("INFINITE")
  850.     end
  851.     mon.setTextColor(colors.white)
  852.     mon.setCursorPos(xPos+12, yPos+5)
  853.     mon.write("OutputMax:")
  854.     mon.setCursorPos(xPos+12, yPos+6)
  855.     mon.write("         ")
  856.     mon.setTextColor(colors.red)
  857.     mon.setCursorPos(xPos+12, yPos+6)
  858.     if limitTransfer == true then
  859.         if outputRate < 1000 then
  860.             mon.write(outputRate)
  861.         elseif outputRate < 1000000 then
  862.             mon.write(round((outputRate/1000),1))
  863.             mon.write("k")
  864.         elseif outputRate < 1000000000 then
  865.             mon.write(round((outputRate/1000000),1))
  866.             mon.write("M")
  867.         elseif outputRate < 1000000000000 then
  868.             mon.write(round((outputRate/1000000000),1))
  869.             mon.write("G")
  870.         elseif outputRate < 1000000000000000 then
  871.             mon.write(round((outputRate/1000000000000),1))
  872.             mon.write("T")
  873.         elseif outputRate < 1000000000000000000 then
  874.             mon.write(round((outputRate/1000000000000000),1))
  875.             mon.write("P")
  876.         elseif outputRate < 1000000000000000000000 then
  877.             mon.write(round((outputRate/1000000000000000000),1))
  878.             mon.write("E")
  879.         end
  880.         mon.write("RF")
  881.     else
  882.         mon.write("INFINITE")
  883.     end
  884.     mon.setTextColor(colors.white)
  885.     mon.setCursorPos(xPos, yPos+7)
  886.     mon.write("Transfer:")
  887.     mon.setCursorPos(xPos, yPos+8)
  888.     if energyTransfer < 0 then
  889.         mon.setTextColor(colors.red)
  890.         if energyTransfer*(-1) < 1000 then
  891.             mon.write(energyTransfer)
  892.         elseif energyTransfer*(-1) < 1000000 then
  893.             mon.write(round((energyTransfer/1000),1))
  894.             mon.write("k")
  895.         elseif energyTransfer*(-1) < 1000000000 then
  896.             mon.write(round((energyTransfer/1000000),1))
  897.             mon.write("M")
  898.         elseif energyTransfer*(-1) < 1000000000000 then
  899.             mon.write(round((energyTransfer/1000000000),1))
  900.             mon.write("G")
  901.         elseif energyTransfer*(-1) < 1000000000000000 then
  902.             mon.write(round((energyTransfer/1000000000000),1))
  903.             mon.write("T")
  904.         elseif energyTransfer*(-1) < 1000000000000000000 then
  905.             mon.write(round((energyTransfer/1000000000000000),1))
  906.             mon.write("P")
  907.         elseif energyTransfer*(-1) < 1000000000000000000000 then
  908.             mon.write(round((energyTransfer/1000000000000000000),1))
  909.             mon.write("E")
  910.         end
  911.     elseif energyTransfer == 0 then
  912.         mon.setTextColor(colors.red)
  913.         mon.write("0")
  914.     else
  915.         mon.setTextColor(colors.lime)
  916.         if energyTransfer < 1000 then
  917.             mon.write(energyTransfer)
  918.         elseif energyTransfer < 1000000 then
  919.             mon.write(round((energyTransfer/1000),1))
  920.             mon.write("k")
  921.         elseif energyTransfer < 1000000000 then
  922.             mon.write(round((energyTransfer/1000000),1))
  923.             mon.write("M")
  924.         elseif energyTransfer < 1000000000000 then
  925.             mon.write(round((energyTransfer/1000000000),1))
  926.             mon.write("G")
  927.         elseif energyTransfer < 1000000000000000 then
  928.             mon.write(round((energyTransfer/1000000000000),1))
  929.             mon.write("T")
  930.         elseif energyTransfer < 1000000000000000000 then
  931.             mon.write(round((energyTransfer/1000000000000000),1))
  932.             mon.write("P")
  933.         elseif energyTransfer < 1000000000000000000000 then
  934.             mon.write(round((energyTransfer/1000000000000000000),1))
  935.             mon.write("E")
  936.         end
  937.     end
  938.     mon.write("RF")
  939.     mon.setTextColor(colors.white)
  940.     mon.setCursorPos(xPos+12, yPos+7)
  941.     mon.write("Limited:")
  942.     mon.setCursorPos(xPos+12, yPos+8)
  943.     if limitTransfer == true then
  944.         mon.setTextColor(colors.lime)
  945.         mon.write("On")
  946.     else
  947.         mon.setTextColor(colors.red)
  948.         mon.write("Off")
  949.     end
  950.     mon.setTextColor(colors.white)
  951. end
  952.  
  953. local function drawAll()   
  954.     while true do
  955.         mon.clear()
  956.         versionText = "Version "..version.." by Game4Freak"
  957.         verPos = 51 - string.len(versionText)
  958.         mon.setCursorPos(verPos,26)
  959.         mon.setTextColor(colors.gray)
  960.         mon.write(versionText)
  961.         mon.setTextColor(colors.white)
  962.         drawBox(2,20,2,14,"ENERGY CORE")
  963.         drawBox(22,49,2,14,"DETAILS")
  964.         drawBox(2,24,16,25,"LOGS")
  965.         drawBox(26,49,16,25,"CONTROLS")
  966.         yPos = 4
  967.         xMin = 5
  968.         for xPos = xMin, xMin+12, 1 do
  969.             drawDetails(24,4)
  970.             drawControls(26,16)
  971.             getLogs("logs.cfg",2,16)
  972.             if tier <= 7 then
  973.                 colorShield = colors.lightBlue
  974.                 colorCore = colors.cyan
  975.             else
  976.                 colorShield = colors.yellow
  977.                 colorCore = colors.orange
  978.             end
  979.             xPos1 = xPos
  980.             if xPos1 >= xMin+13 then
  981.                 xPos1a = xPos1 - 13
  982.                 drawL1(xPos1a, yPos)
  983.             else
  984.                 drawL1(xPos1, yPos)
  985.             end
  986.             xPos2 = xPos + 1
  987.             if xPos2 >= xMin+13 then
  988.                 xPos2a = xPos2 - 13
  989.                 drawL2(xPos2a, yPos)
  990.             else
  991.                 drawL2(xPos2, yPos)
  992.             end
  993.             xPos3 = xPos + 2
  994.             if xPos3 >= xMin+13 then
  995.                 xPos3a = xPos3 - 13
  996.                 drawL3(xPos3a, yPos)
  997.             else
  998.                 drawL3(xPos3, yPos)
  999.             end
  1000.             xPos4 = xPos + 3
  1001.             if xPos4 >= xMin+13 then
  1002.                 xPos4a = xPos4 - 13
  1003.                 drawL4(xPos4a, yPos)
  1004.             else
  1005.                 drawL4(xPos4, yPos)
  1006.             end
  1007.             xPos5 = xPos + 4
  1008.             if xPos5 >= xMin+13 then
  1009.                 xPos5a = xPos5 - 13
  1010.                 drawL5(xPos5a, yPos)
  1011.             else
  1012.                 drawL5(xPos5, yPos)
  1013.             end
  1014.             xPos6 = xPos + 5
  1015.             if xPos6 >= xMin+13 then
  1016.                 xPos6a = xPos6 - 13
  1017.                 drawL6(xPos6a, yPos)
  1018.             else
  1019.                 drawL6(xPos6, yPos)
  1020.             end
  1021.             xPos7 = xPos + 6
  1022.             if xPos7 >= xMin+13 then
  1023.                 xPos7a = xPos7 - 13
  1024.                 drawL7(xPos7a, yPos)
  1025.             else
  1026.                 drawL7(xPos7, yPos)
  1027.             end
  1028.             xPos8 = xPos + 7
  1029.             if xPos8 >= xMin+13 then
  1030.                 xPos8a = xPos8 - 13
  1031.                 drawL8(xPos8a, yPos)
  1032.             else
  1033.                 drawL8(xPos8, yPos)
  1034.             end
  1035.             xPos9 = xPos + 8
  1036.             if xPos9 >= xMin+13 then
  1037.                 xPos9a = xPos9 - 13
  1038.                 drawL9(xPos9a, yPos)
  1039.             else
  1040.                 drawL9(xPos9, yPos)
  1041.             end
  1042.             xPos10 = xPos + 9
  1043.             if xPos10 >= xMin+13 then
  1044.                 xPos10a = xPos10 - 13
  1045.                 drawL10(xPos10a, yPos)
  1046.             else
  1047.                 drawL10(xPos10, yPos)
  1048.             end
  1049.             xPos11 = xPos + 10
  1050.             if xPos11 >= xMin+13 then
  1051.                 xPos11a = xPos11 - 13
  1052.                 drawL11(xPos11a, yPos)
  1053.             else
  1054.                 drawL11(xPos11, yPos)
  1055.             end
  1056.             xPos12 = xPos + 11
  1057.             if xPos12 >= xMin+13 then
  1058.                 xPos12a = xPos12 - 13
  1059.                 drawL12(xPos12a, yPos)
  1060.             else
  1061.                 drawL12(xPos12, yPos)
  1062.             end
  1063.             xPos13 = xPos + 12
  1064.             if xPos13 >= xMin+13 then
  1065.                 xPos13a = xPos13 - 13
  1066.                 drawL13(xPos13a, yPos)
  1067.             else
  1068.                 drawL13(xPos13, yPos)
  1069.             end
  1070.             mon.setBackgroundColor(colors.black)
  1071.             mon.setCursorPos(xMin, yPos)
  1072.             mon.write("   ")
  1073.             mon.setCursorPos(xMin+10, yPos)
  1074.             mon.write("   ")
  1075.             mon.setCursorPos(xMin, yPos+1)
  1076.             mon.write(" ")
  1077.             mon.setCursorPos(xMin+12, yPos+1)
  1078.             mon.write(" ")
  1079.             mon.setCursorPos(xMin, yPos+7)
  1080.             mon.write(" ")
  1081.             mon.setCursorPos(xMin+12, yPos+7)
  1082.             mon.write(" ")
  1083.             mon.setCursorPos(xMin, yPos+8)
  1084.             mon.write("   ")
  1085.             mon.setCursorPos(xMin+10, yPos+8)
  1086.             mon.write("   ")
  1087.             mon.setCursorPos(51 - 8,1)
  1088.             sleep(1)
  1089.         end
  1090.     end
  1091. end
  1092.  
  1093. local function clickListener()
  1094.     event, side, xCPos, yCPos = os.pullEvent("monitor_touch")
  1095.     if xCPos == 1 and yCPos == 1 then
  1096.         mon.setCursorPos(1,1)
  1097.         mon.write("Click!")
  1098.         sleep(1)
  1099.         mon.write("      ")
  1100.     end
  1101.     if currentControls == "main" then
  1102.         if xCPos >= 28 and xCPos <= 35 and yCPos >= 18 and yCPos <= 19 and limitTransfer == true then
  1103.             drawClear(27,48,17,24)
  1104.             currentControls = "editInput"
  1105.         elseif xCPos >= 39 and xCPos <= 47 and yCPos >= 18 and yCPos <= 19 and limitTransfer == true then
  1106.             drawClear(27,48,17,24)
  1107.             currentControls = "editOutput"
  1108.         elseif xCPos >= 28 and xCPos <= 35 and yCPos >= 22 and yCPos <= 23 then
  1109.             drawClear(27,48,17,24)
  1110.             currentControls = "editConfig"
  1111.         end
  1112.     elseif currentControls == "editInput" or currentControls == "editOutput" then
  1113.         if xCPos >= 28 and xCPos <= 30 and yCPos == 20 then
  1114.             mon.setCursorPos(28,20)
  1115.             mon.setBackgroundColor(colors.gray)
  1116.             mon.write(" 1 ")
  1117.             putLimit = putLimit .. "1"
  1118.             sleep(0.2)
  1119.             mon.setCursorPos(28,20)
  1120.             mon.setBackgroundColor(colors.lightGray)
  1121.             mon.write(" 1 ")
  1122.             mon.setBackgroundColor(1,1)
  1123.             mon.setBackgroundColor(colors.black)
  1124.             mon.write(" ")
  1125.         elseif xCPos >= 32 and xCPos <= 34 and yCPos == 20 then
  1126.             mon.setCursorPos(32,20)
  1127.             mon.setBackgroundColor(colors.gray)
  1128.             mon.write(" 2 ")
  1129.             putLimit = putLimit .. "2"
  1130.             sleep(0.2)
  1131.             mon.setCursorPos(32,20)
  1132.             mon.setBackgroundColor(colors.lightGray)
  1133.             mon.write(" 2 ")
  1134.             mon.setBackgroundColor(1,1)
  1135.             mon.setBackgroundColor(colors.black)
  1136.             mon.write(" ")
  1137.             mon.write(" ")
  1138.         elseif xCPos >= 36 and xCPos <= 38 and yCPos == 20 then
  1139.             mon.setCursorPos(36,20)
  1140.             mon.setBackgroundColor(colors.gray)
  1141.             mon.write(" 3 ")
  1142.             putLimit = putLimit.."3"
  1143.             sleep(0.2)
  1144.             mon.setCursorPos(36,20)
  1145.             mon.setBackgroundColor(colors.lightGray)
  1146.             mon.write(" 3 ")
  1147.             mon.setBackgroundColor(1,1)
  1148.             mon.setBackgroundColor(colors.black)
  1149.             mon.write(" ")
  1150.         elseif xCPos >= 28 and xCPos <= 30 and yCPos == 21 then
  1151.             mon.setCursorPos(28,21)
  1152.             mon.setBackgroundColor(colors.gray)
  1153.             mon.write(" 4 ")
  1154.             putLimit = putLimit.."4"
  1155.             sleep(0.2)
  1156.             mon.setCursorPos(28,21)
  1157.             mon.setBackgroundColor(colors.lightGray)
  1158.             mon.write(" 4 ")
  1159.             mon.setBackgroundColor(1,1)
  1160.             mon.setBackgroundColor(colors.black)
  1161.             mon.write(" ")
  1162.         elseif xCPos >= 32 and xCPos <= 34 and yCPos == 21 then
  1163.             mon.setCursorPos(32,21)
  1164.             mon.setBackgroundColor(colors.gray)
  1165.             mon.write(" 5 ")
  1166.             putLimit = putLimit.."5"
  1167.             sleep(0.2)
  1168.             mon.setCursorPos(32,21)
  1169.             mon.setBackgroundColor(colors.lightGray)
  1170.             mon.write(" 5 ")
  1171.             mon.setBackgroundColor(1,1)
  1172.             mon.setBackgroundColor(colors.black)
  1173.             mon.write(" ")
  1174.         elseif xCPos >= 36 and xCPos <= 38 and yCPos == 21 then
  1175.             mon.setCursorPos(36,21)
  1176.             mon.setBackgroundColor(colors.gray)
  1177.             mon.write(" 6 ")
  1178.             putLimit = putLimit.."6"
  1179.             sleep(0.2)
  1180.             mon.setCursorPos(36,21)
  1181.             mon.setBackgroundColor(colors.lightGray)
  1182.             mon.write(" 6 ")
  1183.             mon.setBackgroundColor(1,1)
  1184.             mon.setBackgroundColor(colors.black)
  1185.             mon.write(" ")
  1186.         elseif xCPos >= 28 and xCPos <= 30 and yCPos == 22 then
  1187.             mon.setCursorPos(28,22)
  1188.             mon.setBackgroundColor(colors.gray)
  1189.             mon.write(" 7 ")
  1190.             putLimit = putLimit.."7"
  1191.             sleep(0.2)
  1192.             mon.setCursorPos(28,22)
  1193.             mon.setBackgroundColor(colors.lightGray)
  1194.             mon.write(" 7 ")
  1195.             mon.setBackgroundColor(1,1)
  1196.             mon.setBackgroundColor(colors.black)
  1197.             mon.write(" ")
  1198.         elseif xCPos >= 32 and xCPos <= 34 and yCPos == 22 then
  1199.             mon.setCursorPos(32,22)
  1200.             mon.setBackgroundColor(colors.gray)
  1201.             mon.write(" 8 ")
  1202.             putLimit = putLimit.."8"
  1203.             sleep(0.2)
  1204.             mon.setCursorPos(32,22)
  1205.             mon.setBackgroundColor(colors.lightGray)
  1206.             mon.write(" 8 ")
  1207.             mon.setBackgroundColor(1,1)
  1208.             mon.setBackgroundColor(colors.black)
  1209.             mon.write(" ")
  1210.         elseif xCPos >= 36 and xCPos <= 38 and yCPos == 22 then
  1211.             mon.setCursorPos(36,22)
  1212.             mon.setBackgroundColor(colors.gray)
  1213.             mon.write(" 9 ")
  1214.             putLimit = putLimit.."9"
  1215.             sleep(0.2)
  1216.             mon.setCursorPos(36,22)
  1217.             mon.setBackgroundColor(colors.lightGray)
  1218.             mon.write(" 9 ")
  1219.             mon.setBackgroundColor(1,1)
  1220.             mon.setBackgroundColor(colors.black)
  1221.             mon.write(" ")
  1222.         elseif xCPos >= 28 and xCPos <= 30 and yCPos == 23 then
  1223.             mon.setCursorPos(28,23)
  1224.             mon.setBackgroundColor(colors.gray)
  1225.             mon.write(" < ")
  1226.             putLimit = string.sub(putLimit,0,string.len(putLimit)-1)
  1227.             sleep(0.2)
  1228.             mon.setCursorPos(28,23)
  1229.             mon.setBackgroundColor(colors.red)
  1230.             mon.write(" < ")
  1231.             mon.setBackgroundColor(1,1)
  1232.             mon.setBackgroundColor(colors.black)
  1233.             mon.write(" ")
  1234.         elseif xCPos >= 32 and xCPos <= 34 and yCPos == 23 then
  1235.             mon.setCursorPos(32,23)
  1236.             mon.setBackgroundColor(colors.gray)
  1237.             mon.write(" 0 ")
  1238.             putLimit = putLimit.."0"
  1239.             sleep(0.2)
  1240.             mon.setCursorPos(32,23)
  1241.             mon.setBackgroundColor(colors.lightGray)
  1242.             mon.write(" 0 ")
  1243.             mon.setBackgroundColor(1,1)
  1244.             mon.setBackgroundColor(colors.black)
  1245.             mon.write(" ")
  1246.         elseif xCPos >= 36 and xCPos <= 38 and yCPos == 23 then
  1247.             mon.setCursorPos(36,23)
  1248.             mon.setBackgroundColor(colors.gray)
  1249.             mon.write(" X ")
  1250.             putLimit = ""
  1251.             sleep(0.2)
  1252.             mon.setCursorPos(36,23)
  1253.             mon.setBackgroundColor(colors.red)
  1254.             mon.write(" X ")
  1255.             mon.setBackgroundColor(1,1)
  1256.             mon.setBackgroundColor(colors.black)
  1257.             mon.write(" ")
  1258.         elseif xCPos >= 42 and xCPos <= 47 and yCPos == 23 then
  1259.             putLimit = ""
  1260.             drawClear(27,48,17,24)
  1261.             currentControls = "main"
  1262.         elseif xCPos >= 42 and xCPos <= 47 and yCPos == 21 then
  1263.             if currentControls == "editInput" then
  1264.                 if putLimit == "" then
  1265.                     putLimitNum = 0
  1266.                 else
  1267.                     putLimitNum = tonumber(putLimit)
  1268.                 end
  1269.                 input.setSignalLowFlow(putLimitNum)
  1270.                 addLog("logs.cfg",getTime(),"Changed InputMax")
  1271.             else
  1272.                 if putLimit == "" then
  1273.                     putLimitNum = 0
  1274.                 else
  1275.                     putLimitNum = tonumber(putLimit)
  1276.                 end
  1277.                 output.setSignalLowFlow(putLimitNum)
  1278.                 addLog("logs.cfg",getTime(),"Changed OutputMax")
  1279.             end
  1280.             putLimit = ""
  1281.             drawClear(27,48,17,24)
  1282.             currentControls = "main"
  1283.         end
  1284.     elseif currentControls == "editConfig" then
  1285.         if xCPos >= 28 and xCPos <= 28+8 and yCPos >= 18 and yCPos <= 19 and limitTransfer == true then
  1286.             drawButton(26+2,26+10,16+3,16+4,"Detect","Flux_Gate",colors.gray)
  1287.             detectInOutput()
  1288.             addLog("logs.cfg",getTime(),"Detected Flux_Gates")
  1289.         elseif xCPos >= 26+16 and xCPos <= 26+16+6 and yCPos >= 16+7 and yCPos <= 16+7 then
  1290.             currentControls = "main"
  1291.         end
  1292.     end
  1293. end
  1294.  
  1295. while true do
  1296.     parallel.waitForAny(drawAll,clickListener)
  1297. end
  1298.  
Tags: draconic
Advertisement
Add Comment
Please, Sign In to add comment