Advertisement
Guest User

test 3

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