Advertisement
Dyllaann

Untitled

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