Advertisement
PapaRenner

Untitled

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