Advertisement
Guest User

DE 1.20 Reactor Script

a guest
Oct 16th, 2024
210
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.92 KB | None | 1 0
  1. --modpack configs
  2. reactorOutputMultiplier = 1.0
  3. reactorFuelUsageMultiplier = 1.0
  4.  
  5. -- please report any bugs to @jona23 on discord
  6.  
  7. ------------------------------------------------------------------------------------------------
  8. -- SETUP
  9. -- 1. Build a Draconic Reactor
  10. -- 2. Place a flux gate behind it's energy injector facing into it (this is the input gate).
  11. -- 3. Place one or more flux gates beind a stabilizer facing away from it (this is the output gate).
  12. -- 4. Connect the output gate(s) to the input of your energy storage (make sure it can handle 25m+rf/t).
  13. -- 5. Connect the input gate to the output of your energy storage, AVOID DISCONNECTING AT ALL COSTS!
  14. -- 6. Put a monitor somewhere, 3 tall and minimum 5 wide!
  15. -- 7. Place down a computer and using Wired Modems and Networking Cables, connect your flux
  16. -- gates, monitor, computer, and a reactor stabilizer to the network!
  17. -- 8. Now type "pastebin get KKpxW74v startup.lua" into your computer, then type in "startup"
  18. -- 9. Configure the script to your likings and press "initialize script"
  19. -- 10. Done! Fuel up your reactor and hit "start" on the monitor.
  20.  
  21. ------------------------------------------------------------------------------------------------
  22. -- DO NOT:
  23. -- - Break flux gates, this will mess up the peripheral names!
  24. -- - Use between minecraft version updates, this will also mess up peripheral names!
  25. -- - Delete config.txt while the reactor is running, this will cause many problems.
  26. -- - Move the computer if a flux gate is next to it.
  27. -- - Install the script whilst the reactor is running, it knows which flux gate is the input/output by powering them and checking if the shield goes up or no.
  28.  
  29. -- If your script is crashing, manually hit shutdown on the reactor and let it cool down,
  30. -- then and ONLY THEN type "delete config.txt" into the computer.
  31. -- Doing this will reset all your precious values you set!
  32.  
  33. -- INFO
  34. -- This program calculates the reactor's input/output based only the amount
  35. -- of fuel it has, and on it's conversion level! No heat, no shield just conversion (aka passive)
  36. -- Therefore it dosent care about flux gates being disconnected nor server lag
  37. -- you can even shutdown and start the program while the reactor is running!
  38.  
  39. -- TEST IN CREATIVE BEFORE USING IN SURVIVAL! I CAN'T ENSURE YOU'RE DOING EVERYTHING CORRECTLY!
  40.  
  41. -- CONFIGS
  42. -- 1.12 mode: Makes the script work in 1.12.2 (and possibly 1.7.10) by changing the flux gate's names
  43. -- Fancy Startup: Makes the reactor start up slowly and smoothly, cinematic!
  44. -- Safety Systems: Disables limit on the sliders, if you like your base and it's sorroundings i dont recommend disabling
  45. -- Keepalive Signal: Outputs a blinking redstone signal on the computer's back, allowing redstone to detect if the script crashes (this gets disabled if the reactor goes overload!)
  46. -- Compact Mode: Disables the reactor visualization rendering, allowing for a smaller screen
  47.  
  48. ------------------------------------------------------------------------------------------------
  49. -- !!!!!!! Do not change anything below !!!!!!!
  50.  
  51. --warnings
  52. function energyCoreFullWarning()
  53. gWrite("! ATTENTION !", corePosX-5, corePosY-1, colors.black, coreColor)
  54. gWrite("ENERGY CORE FULL!", corePosX-7, corePosY, colors.black, coreColor)
  55. end
  56. function fuelConversionWarning()
  57. gWrite("! ATTENTION !", corePosX-5, corePosY-1, colors.black, coreColor)
  58. gWrite("FUEL CONVERSION", corePosX-7, corePosY, colors.black, coreColor)
  59. gWrite("ABOVE SET LIMITS!", corePosX-7, corePosY+1, colors.black, coreColor)
  60. gWrite("SHUTTING DOWN...", corePosX-7, corePosY+2, colors.black, coreColor)
  61. end
  62. function powerOutputWarning()
  63. gWrite("!! WARNING !!", corePosX-5, corePosY-1, colors.black, coreColor)
  64. gWrite("INSUFFICIENT", corePosX-7, corePosY, colors.black, coreColor)
  65. gWrite("OUTPUT FOR SELF-", corePosX-7, corePosY+1, colors.black, coreColor)
  66. gWrite("SUSTAINABILITY", corePosX-7, corePosY+2, colors.black, coreColor)
  67. end
  68. function reactorBoomWarning()
  69. gWrite("!! DANGER !!", corePosX-5, corePosY-1, colors.black, coreColor)
  70. gWrite("CORE DESTABILIZED", corePosX-7, corePosY, colors.black, coreColor)
  71. gWrite("!! EXPLOSION !!", corePosX-6, corePosY+1, colors.black, coreColor)
  72. gWrite("!! IMMINENT !!", corePosX-6, corePosY+2, colors.black, coreColor)
  73. end
  74. function noInputGatePower()
  75. gWrite("INPUT GATE IS", corePosX-6, corePosY, colors.black, coreColor)
  76. gWrite("NOT CONNECTED TO", corePosX-7, corePosY+1, colors.black, coreColor)
  77. gWrite("POWER!", corePosX-2, corePosY+2, colors.black, coreColor)
  78. end
  79.  
  80. --save/load config functions
  81. function saveConfig()
  82. config = fs.open("config.txt", "w")
  83. config.writeLine(tempTarget)
  84. config.writeLine(fieldTarget)
  85. config.writeLine(saturationTarget)
  86. config.writeLine(fuelUseRateTarget)
  87. config.writeLine(conversionTarget)
  88. config.writeLine(powerOutputTarget)
  89. config.writeLine(fancyStartup)
  90. config.writeLine(safetySystems)
  91. config.writeLine(onePointTwelveMode)
  92. config.writeLine(controlSelected)
  93. config.writeLine(scriptInitialized)
  94. config.writeLine(controlsLocked)
  95. config.writeLine(targetPowerOutput)
  96. config.writeLine(targetPowerInput)
  97. config.writeLine(keepaliveSignal)
  98. config.writeLine(compactMode)
  99. if inputGate then
  100. config.writeLine(inputGate.name)
  101. end
  102. config.close()
  103. end
  104.  
  105. function loadConfig()
  106. config = fs.open("config.txt", "r")
  107. tempTarget = tonumber(config.readLine())
  108. fieldTarget = tonumber(config.readLine())
  109. saturationTarget = tonumber(config.readLine())
  110. fuelUseRateTarget = tonumber(config.readLine())
  111. conversionTarget = tonumber(config.readLine())
  112. powerOutputTarget = tonumber(config.readLine())
  113. fancyStartup = tonumber(config.readLine())
  114. safetySystems = tonumber(config.readLine())
  115. onePointTwelveMode = tonumber(config.readLine())
  116. controlSelected = tonumber(config.readLine())
  117. scriptInitialized = tonumber(config.readLine())
  118. controlsLocked = tonumber(config.readLine())
  119. targetPowerOutput = tonumber(config.readLine())
  120. targetPowerInput = tonumber(config.readLine())
  121. keepaliveSignal = tonumber(config.readLine())
  122. compactMode = tonumber(config.readLine())
  123. local inputGateName = "flow_gate_0"
  124. local outputGateName = "flow_gate_2"
  125. if inputGateName then
  126. inputGate = nameWrap(inputGateName)
  127. inputGate.setOverrideEnabled(true)
  128. end
  129. if outputGateName then
  130. outputGate = nameWrap(outputGateName)
  131. outputGate.setOverrideEnabled(true)
  132. end
  133. config.close()
  134. end
  135.  
  136. --periphSearch function by https:--github.com/acidjazz/drgfx/blob/master/drgfx.lua
  137. function periphSearch(type)
  138. local names = peripheral.getNames()
  139. local i, name
  140. for i, name in pairs(names) do
  141. if peripheral.getType(name) == type then
  142. return peripheral.wrap(name)
  143. end
  144. end
  145. return null
  146. end
  147.  
  148. function nameWrap(name)
  149. local table = peripheral.wrap(name)
  150. if not table then
  151. print('"' .. name .. '"')
  152. error("This flux gate was once connected to the computer, but now it cant be found! Check for disconneced modems or broken cables, if that dosent work type \"delete config.txt\"")
  153. end
  154. table.name = name
  155. return table
  156. end
  157.  
  158. function secondsToTimeString(seconds)
  159. local days = math.floor(seconds / (24 * 3600))
  160. local hours = math.floor((seconds % (24 * 3600)) / 3600)
  161. local minutes = math.floor((seconds % 3600) / 60)
  162. local remainingSeconds = math.floor(seconds % 60)
  163.  
  164. local formattedTime = string.format("%sd %sh %sm %ss", days, hours, minutes, remainingSeconds)
  165.  
  166. return formattedTime
  167. end
  168.  
  169. function secondsToTimeStringExtended(seconds)
  170. local years = math.floor(seconds / (365 * 24 * 3600))
  171. local days = math.floor((seconds % (365 * 24 * 3600)) / (24 * 3600))
  172. local hours = math.floor((seconds % (24 * 3600)) / 3600)
  173. local minutes = math.floor((seconds % 3600) / 60)
  174. local remainingSeconds = math.floor(seconds % 60)
  175.  
  176. local formattedTime = string.format("%sy %sd %sh %sm %ss", years, days, hours, minutes, remainingSeconds)
  177.  
  178. return formattedTime
  179. end
  180.  
  181. function toggle(boolean)
  182. if boolean == 1 then
  183. return 0
  184. else
  185. return 1
  186. end
  187. end
  188.  
  189. function gWrite(text, x, y, cl, clBg)
  190. gfx.setCursorPos(x, y)
  191. gfx.setTextColor(cl)
  192. gfx.setBackgroundColor(clBg)
  193. gfx.write(text)
  194. end
  195.  
  196. function gWriteR(text, x, y, cl, clBg)
  197. gWrite(text, gfx.xRes - string.len(tostring(text)) - x, y, cl, clBg)
  198. end
  199.  
  200. function gBlit(x,y,text,cl,clBg)
  201. gfx.setCursorPos(x, y)
  202. gfx.blit(text, cl, clBg)
  203. end
  204.  
  205. function gBlitR(x,y,text,cl,clBg)
  206. gfx.setCursorPos(gfx.xRes - string.len(tostring(text)) - x + 1, y)
  207. gfx.blit(text, cl, clBg)
  208. end
  209.  
  210. function gWriteTransparent(text, x, y, cl)
  211. gfx.setCursorPos(x, y)
  212. _, _, lineColors = gfx.getLine(y)
  213.  
  214. length = string.len(text)
  215. lineColor = string.sub(lineColors, x, x + length - 1)
  216.  
  217. gfx.blit(text, string.rep(colors.toBlit(cl), length), lineColor)
  218. end
  219.  
  220. function gClear()
  221. gfx.setBackgroundColor(colors.black)
  222. gfx.clear()
  223. end
  224.  
  225. function gDrawLine(x, y, length, cl)
  226. if length < 0 then
  227. return
  228. end
  229. gfx.setCursorPos(x, y)
  230. if cl ~= nil then
  231. gfx.setBackgroundColor(cl)
  232. end
  233. gfx.write(string.rep(" ", length))
  234. end
  235.  
  236. function gDrawProgressBar(x, y, length, proportion, cl, clBg)
  237. if proportion < 0.0 or proportion > 1.0 then
  238. gDrawLine(x, y, length, cl)
  239. else
  240. gDrawLine(x, y, length, clBg)
  241. gDrawLine(x, y, math.floor(proportion*length), cl)
  242. end
  243. end
  244.  
  245. function calculateTargetIO(targetShield, targetTemp, fuelConversion, maxFuelConversion)
  246. coreFuelMultiplier = maxFuelConversion / 10368
  247. maxEnergySaturation = coreFuelMultiplier * 1000000000
  248. targetTemp50 = math.min((targetTemp / 10000) * 50, 99)
  249. convLVL = ((fuelConversion - fuelUseRate/300000) / (maxFuelConversion + fuelUseRate/300000) * 1.3) - 0.3
  250. targetTempResist = ((targetTemp50^4) / (100 - targetTemp50))
  251. targetTempExpo = -(targetTempResist*convLVL) - 1000*convLVL + targetTempResist
  252. term1 = 1334.1-(3*targetTempExpo)
  253. term2 = (1200690-(2700*targetTempExpo))^2
  254. term3 = ((-1350*targetTempExpo)+(((-4*term1^3+term2)^(1/2))/2)+600345)^(1/3)
  255. targetNegCSat = -(term1/(3*term3))-(term3/3)
  256. targetCoreSat = 1 - (targetNegCSat/99)
  257. targetSat = targetCoreSat * maxEnergySaturation
  258.  
  259. baseMaxRFt = ((maxEnergySaturation / 1000) * 1.5 * 10)
  260. maxRFt = (baseMaxRFt * (1 + (convLVL * 2)))
  261. targetPowerOutput = ((1 - targetCoreSat) * maxRFt)
  262.  
  263. if targetTemp > 8000 then
  264. tempDrainFactor = 1 + ((targetTemp-8000)^2 * 0.0000025)
  265. elseif targetTemp > 2000 then
  266. tempDrainFactor = 1
  267. elseif targetTemp > 1000 then
  268. tempDrainFactor = (targetTemp-1000)/1000
  269. else
  270. tempDrainFactor = 0
  271. end
  272.  
  273. fuelUseRate = (tempDrainFactor*(1-targetCoreSat)*(0.005)*1000000)*reactorFuelUsageMultiplier
  274.  
  275. maxFieldStrength = maxEnergySaturation/10
  276. fieldDrain = math.min(tempDrainFactor * math.max(0.01, (1 - targetCoreSat)) * (baseMaxRFt / 10.923556), 2147483647)
  277. fieldNegPercent = 1 - targetShield/100
  278. targetPowerInput = fieldDrain / fieldNegPercent
  279.  
  280. return targetPowerInput, targetPowerOutput
  281. end
  282.  
  283. --Always runs every time when the script starts
  284. if fs.exists("config.txt") then
  285. print("Loading config...")
  286. loadConfig()
  287. else
  288. print("Creating config...")
  289. tempTarget = 8000
  290. fieldTarget = 20
  291. fancyStartup = 0
  292. safetySystems = 1
  293. keepaliveSignal = 0
  294. onePointTwelveMode = 0
  295. saturationTarget = 11.33
  296. fuelUseRateTarget = 4433
  297. conversionTarget = 85
  298. powerOutputTarget = 3797871
  299. controlSelected = 0
  300. scriptInitialized = 0
  301. controlsLocked = 0
  302. targetPowerOutput = 0
  303. targetPowerInput = 0
  304. compactMode = 0
  305. saveConfig()
  306. print("Done!")
  307. end
  308.  
  309. if onePointTwelveMode == 1 then
  310. TotalReactorOutputMultiplier = reactorOutputMultiplier/10
  311. fluxGateName = "flux_gate"
  312. else
  313. TotalReactorOutputMultiplier = reactorOutputMultiplier
  314. fluxGateName = "flow_gate"
  315. end
  316.  
  317. reactor = periphSearch("draconic_reactor")
  318. if reactor == nil then
  319. error("No connected reactor was found!")
  320. end
  321.  
  322. if reactor.getReactorInfo().fieldStrength ~= 0 and scriptInitialized == 0 then
  323. error("Hi, Im Mr. Error and i just saved your reactor from a rapid unscheduled disassembly because you didnt think of fully shutting it down before initializing this script!")
  324. end
  325.  
  326. mon = periphSearch("monitor")
  327. if mon == nil then
  328. error("No connected monitor was found!")
  329. end
  330.  
  331. energy_core = periphSearch("draconic_rf_storage")
  332. if energy_core == nil then
  333. print("No connected energy core found, skipping.")
  334. end
  335.  
  336. gfx = window.create(mon, 1, 1, mon.getSize())
  337. gfx.xRes, gfx.yRes = gfx.getSize()
  338.  
  339. fpscooldown = 0
  340. prevTime = 0
  341. scriptFPS = 0
  342. messageCooldown = 0
  343. currentTableValue = 0
  344. powerInput = 0
  345. explosionTextState = 0
  346. fuelUseRate = 0
  347. targetSat = 0
  348. indexSwitch = 0
  349. globalAnimationTimer = 0
  350. prevEnergyStored = 0
  351. shieldCoords = {{1,-5},{2,-5},{3,-5},{4,-5},{5,-5},{6,-4},{7,-4},{8,-3},{9,-2},{10,-1},{10,0},{10,1},{10,2},{9,3},{8,4},{7,5},{6,5},{5,6},{4,6},{3,6},{2,6},{1,6},{0,6},{-1,6},{-2,6},{-3,6},{-4,5},{-5,5},{-6,4},{-7,3},{-8,2},{-8,1},{-8,0},{-8,-1},{-7,-2},{-6,-3},{-5,-4},{-4,-4},{-3,-5},{-2,-5},{-1,-5},{0,-5}}
  352.  
  353. print("Script Loaded!")
  354.  
  355. --Runs every tick no matter what
  356. function update()
  357. while true do
  358. gClear()
  359. globalAnimationTimer = globalAnimationTimer + 1
  360.  
  361. --check the script's fps every 10 ticks
  362. fpscooldown = fpscooldown + 1
  363. if fpscooldown >= 10 then
  364. currentTime = os.epoch("utc")
  365. scriptFPS = 10000/(currentTime - prevTime)
  366. prevTime = currentTime
  367. fpscooldown = 0
  368. end
  369.  
  370. --read energy core
  371. if energy_core then
  372. energyStored = energy_core.getEnergyStored()
  373. end
  374. if energyStored then
  375. energyThroughput = energyStored - prevEnergyStored
  376. prevEnergyStored = energyStored
  377. end
  378. --check if the script is initialized, otherwise display the config screen
  379. if scriptInitialized == 1 then
  380. info = reactor.getReactorInfo()
  381. if info then
  382. main()
  383. else
  384. gfx.setBackgroundColor(colors.blue)
  385. gfx.clear()
  386. gWrite("Reactor Disconnected", gfx.xRes/2 - 10, gfx.yRes/2, colors.white, colors.blue)
  387. end
  388. else
  389. configScreenSelected = true
  390. configScreen()
  391. gWrite("INITIALIZE SCRIPT", 8, 17, colors.white, colors.purple)
  392. end
  393.  
  394. if scriptStatusDisplay ~= 0 then
  395. gWrite(" ", 1, gfx.yRes, colors.white, colors.green)
  396. scriptStatusDisplay = 0
  397. else
  398. gWrite(" ", 1, gfx.yRes, colors.white, colors.red)
  399. scriptStatusDisplay = 1
  400. end
  401.  
  402. local barColor = colors.lightGray
  403. if controlsLocked == 1 then
  404. barColor = colors.gray
  405. end
  406. gDrawLine(2, gfx.yRes, gfx.xRes, barColor)
  407. gWrite("FPS: " .. math.floor(scriptFPS*10)/10, 2, gfx.yRes, colors.white, barColor)
  408. if energyStored then
  409. gWrite("E.S: " .. energyStored, 13, gfx.yRes, colors.white, barColor)
  410. end
  411.  
  412. --update the display
  413. gfx.setVisible(true)
  414. gfx.setVisible(false)
  415. sleep()
  416. end
  417. end
  418.  
  419. --the function that runs when the script is initialized
  420. function main()
  421. if keepaliveSignal == 1 and info.status ~= "beyond_hope" then
  422. if globalAnimationTimer % 10 >= 5 then
  423. redstone.setOutput("back", true)
  424. else
  425. redstone.setOutput("back", false)
  426. end
  427. end
  428.  
  429. if not prevShield then
  430. prevShield = info.fieldStrength
  431. end
  432. fieldPercentage = info.fieldStrength / info.maxFieldStrength * 100
  433. fuelConversion = info.fuelConversion / info.maxFuelConversion * 100
  434. saturationPercentage = info.energySaturation / info.maxEnergySaturation * 100
  435.  
  436. if info.status == "cold" then
  437. targetPowerInput = 0
  438. targetPowerOutput = 0
  439. else
  440. targetPowerInput, targetPowerOutput = calculateTargetIO(fieldTarget,tempTarget,info.fuelConversion,info.maxFuelConversion)
  441. end
  442.  
  443. --startup logic
  444. if info.status == "warming_up" and not inputGate then
  445. targetPowerInput = 5
  446. targetPowerOutput = 0
  447. indexSwitch = indexSwitch + 1
  448. local gateNumber = math.floor(math.fmod(indexSwitch, 20)/10) + 1
  449.  
  450. if fieldPercentage > 50 then
  451. reactor.stopReactor()
  452. error("Cannot index flux gates if shield is above 50%! Please wait for your reactor to fully shut down before initializing the script!")
  453. end
  454. print("Setting Override")
  455. inputGate.setFlowOverride(targetPowerInput)
  456. outputGate.setFlowOverride(0)
  457. end
  458.  
  459. if info.status == "warming_up" and inputGate then
  460. targetPowerOutput = 0
  461. if fieldPercentage >= 10 or fancyStartup == 0 then
  462. if saturationPercentage >= 50 and fancyStartup ~= 0 then
  463. targetPowerInput = 500000*TotalReactorOutputMultiplier*coreFuelMultiplier
  464. else
  465. targetPowerInput = 100000000*TotalReactorOutputMultiplier*coreFuelMultiplier
  466. end
  467. else
  468. targetPowerInput = 10000*TotalReactorOutputMultiplier*coreFuelMultiplier
  469. end
  470. if info.temperature >= 2000 then
  471. reactor.activateReactor()
  472. end
  473. end
  474.  
  475. --conversion rate shutdown
  476. if info.status == "running" and fuelConversion >= conversionTarget then
  477. reactor.stopReactor()
  478. print("Fuel conversion levels above set target. Stopping reactor!")
  479. end
  480.  
  481. --do not update input unless its enough to sustain shield
  482. if info.temperature-10 <= tempTarget or targetPowerInput > powerInput or info.status ~= "running" then
  483. powerInput = targetPowerInput
  484. end
  485.  
  486. if inputGate then
  487. inputGate.setFlowOverride(powerInput)
  488.  
  489. outputGate.setFlowOverride(targetPowerOutput / 1)
  490. end
  491.  
  492. if configScreenSelected == true then
  493. configScreen()
  494. else
  495. controlScreen()
  496. end
  497.  
  498. prevShield = info.fieldStrength
  499. end
  500.  
  501. --the screen where you control the reactor
  502. function controlScreen()
  503. corePosX = gfx.xRes/2
  504. corePosY = gfx.yRes/2-2
  505. coreColor = colors.gray
  506.  
  507. if energyStored then
  508. if energyThroughput < 0 and info.status == "running" then
  509. local explosionETA = math.max(0,(energyStored / -energyThroughput)/20)
  510. gWrite("Explosion In: " .. secondsToTimeStringExtended(explosionETA), corePosX-13, 18, colors.yellow, colors.red)
  511. end
  512. end
  513.  
  514. gWrite("CONFIG", 8, 17, colors.white, colors.purple)
  515.  
  516. remainingFuel = (info.maxFuelConversion - info.fuelConversion) * 1000
  517. fuelTargetRemove = (info.maxFuelConversion * 1000 * ((100 - conversionTarget)/100))
  518. reactableFuel = remainingFuel - fuelTargetRemove
  519. fuelETA = (reactableFuel / fuelUseRate) * 1000 / 20
  520. if fuelETA < 0 then
  521. fuelETA = 0
  522. end
  523.  
  524. if info.status == "stopping" or info.status == "cold" or info.status == "cooling" then
  525. if info.maxFuelConversion ~= 0 then
  526. gWrite("START", 2, 17, colors.white, colors.green)
  527. end
  528. elseif info.status ~= "beyond_hope" then
  529. gWrite("STOP", 2, 17, colors.white, colors.red)
  530. else
  531. gWrite("RUN!", 2, 17, colors.yellow, colors.red)
  532. end
  533.  
  534.  
  535. if info.status == "running" or info.status == "stopping" then
  536. if info.temperature > 10000 then
  537. coreColor = colors.white
  538. elseif info.temperature > 9000 then
  539. coreColor = colors.yellow
  540. elseif info.temperature > 5700 then
  541. coreColor = colors.orange
  542. else
  543. coreColor = colors.red
  544. end
  545. elseif info.status == "cold" then
  546. coreColor = colors.gray
  547. elseif info.status == "warming_up" then
  548. coreColor = colors.lightGray
  549. end
  550.  
  551. shieldColorTMP = colors.gray
  552. shieldColorTMP2 = colors.gray
  553.  
  554. if fieldPercentage > 50 then
  555. shieldColorTMP2 = colors.lightBlue
  556. elseif fieldPercentage > 25 then
  557. shieldColorTMP2 = colors.cyan
  558. else
  559. shieldColorTMP2 = colors.blue
  560. end
  561. if info.status == "beyond_hope" then
  562. shieldColorTMP = colors.magenta
  563. shieldColorTMP2 = colors.magenta
  564. coreColor = colors.pink
  565. if math.random(0,100) > 90 then
  566. coreColor = colors.white
  567. end
  568. end
  569.  
  570. if compactMode == 0 then
  571. for k, v in pairs(shieldCoords) do
  572. if fieldPercentage > k/#shieldCoords*10 then
  573. shieldColor = shieldColorTMP2
  574. else
  575. shieldColor = shieldColorTMP
  576. end
  577. if info.status == "running" and (k == math.fmod(globalAnimationTimer,#shieldCoords)+1 or k == math.fmod(math.floor(globalAnimationTimer/2),#shieldCoords)+1 or k == math.fmod(math.floor(globalAnimationTimer/3),#shieldCoords)+1) then
  578. shieldColor = colors.cyan
  579. end
  580. gWrite(" ", corePosX+v[1], corePosY+v[2], colors.black, shieldColor)
  581. end
  582.  
  583. gDrawLine(corePosX-3, corePosY-4, 9, coreColor)
  584. gDrawLine(corePosX-5, corePosY-3, 13, coreColor)
  585. gDrawLine(corePosX-6, corePosY-2, 15, coreColor)
  586. gDrawLine(corePosX-7, corePosY-1, 17, coreColor)
  587. gDrawLine(corePosX-7, corePosY, 17, coreColor)
  588. gDrawLine(corePosX-7, corePosY+1, 17, coreColor)
  589. gDrawLine(corePosX-7, corePosY+2, 17, coreColor)
  590. gDrawLine(corePosX-6, corePosY+3, 15, coreColor)
  591. gDrawLine(corePosX-5, corePosY+4, 13, coreColor)
  592. gDrawLine(corePosX-3, corePosY+5, 9, coreColor)
  593. end
  594.  
  595. warnings = {}
  596. messageCooldown = messageCooldown + 1
  597. if energyStored and energyStored > energy_core.getMaxEnergyStored()-energyThroughput and energy_core.getMaxEnergyStored() ~= 2^64/2 then
  598. table.insert(warnings, energyCoreFullWarning)
  599. end
  600. if fuelConversion >= conversionTarget then
  601. table.insert(warnings, fuelConversionWarning)
  602. end
  603. if targetPowerOutput < targetPowerInput and inputGate then
  604. table.insert(warnings, powerOutputWarning)
  605. end
  606. if info.status == "beyond_hope" then
  607. table.insert(warnings, reactorBoomWarning)
  608. end
  609. if info.status == "warming_up" and indexSwitch > 40 and not inputGate then
  610. table.insert(warnings, noInputGatePower)
  611. end
  612.  
  613. if messageCooldown > 20 then
  614. currentTableValue = currentTableValue + 1
  615. messageCooldown = 0
  616. end
  617. if currentTableValue > #warnings then
  618. currentTableValue = 1
  619. end
  620. if warnings[currentTableValue] then
  621. warnings[currentTableValue]()
  622. end
  623.  
  624. if info.maxFuelConversion < 144 then
  625. gWrite("Not Enough Fuel!", corePosX-8, 1, colors.orange, colors.black)
  626. elseif info.status == "cold" then
  627. gWrite("Reactor Offline", corePosX-6, 1, colors.lightGray, colors.black)
  628. elseif info.status == "warming_up" then
  629. if inputGate then
  630. gWrite("Charging Reactor...", corePosX-8, 1, colors.blue, colors.black)
  631. else
  632. gWrite("Indexing Flux Gates...", corePosX-9, 1, colors.pink, colors.black)
  633. end
  634. elseif info.status == "running" then
  635. gWrite("Reactor Online", corePosX-6, 1, colors.lime, colors.black)
  636. elseif info.status == "stopping" then
  637. gWrite("Shutting Down...", corePosX-6, 1, colors.yellow, colors.black)
  638. elseif info.status == "cooling" then
  639. gWrite("Cooling Down...", corePosX-6, 1, colors.cyan, colors.black)
  640. elseif info.status == "beyond_hope" then
  641. explosionTextState = explosionTextState + 1
  642. if explosionTextState > 5 then
  643. if explosionTextState > 10 then
  644. explosionTextState = 0
  645. end
  646. gDrawLine(0,0,gfx.xRes,colors.red)
  647. gWrite("!!!EXPLOSION IMMINENT!!!", corePosX-12, 1, colors.orange, colors.red)
  648. else
  649. gDrawLine(0,0,gfx.xRes,colors.orange)
  650. gWrite("!!!EXPLOSION IMMINENT!!!", corePosX-12, 1, colors.red, colors.orange)
  651. end
  652. end
  653.  
  654. --display core temp controls
  655. gWrite("Core Temp: " .. math.floor(info.temperature*(100-(compactMode*99)))/(100-(compactMode*99)) .. "\176C", 2, 2, colors.white, colors.black)
  656. gWrite("Target: " .. math.floor(tempTarget*1000.0)/1000.0 .. "\176C", 2, 3, colors.white, colors.black)
  657. gBlit(2, 4, "< << <<< >>> >> >","00000000000000000","bfbbfbbbfbbbfbbfb")
  658.  
  659. if math.floor(info.temperature) > math.floor(tempTarget) then
  660. tempLineColor = colors.red
  661. elseif math.floor(info.temperature) < math.floor(tempTarget) then
  662. tempLineColor = colors.yellow
  663. else
  664. tempLineColor = colors.green
  665. end
  666. gDrawProgressBar(1, 5, 19, info.temperature/16000.0, tempLineColor, colors.gray)
  667.  
  668. --display field controls
  669. gWrite("Field: " .. math.floor(fieldPercentage*100000000)/100000000 .. "%", 2, 7, colors.white, colors.black)
  670. gWrite("Target: " .. fieldTarget .. "%", 2, 8, colors.white, colors.black)
  671. gBlit(2, 9, "< << <<< >>> >> >","00000000000000000","bfbbfbbbfbbbfbbfb")
  672.  
  673. if math.floor(info.fieldStrength/info.maxFieldStrength*1000.0)/10.0 > fieldTarget+0.1 then
  674. fieldLineColor = colors.yellow
  675. elseif math.floor((info.fieldStrength+1000)/info.maxFieldStrength*1000.0)/10.0 < fieldTarget-0.1 then
  676. fieldLineColor = colors.red
  677. else
  678. fieldLineColor = colors.green
  679. end
  680.  
  681. if fieldStrength == 0 then
  682. fieldAdder = 0.1
  683. else
  684. fieldAdder = 0
  685. end
  686. gDrawProgressBar(1, 10, 19, (math.floor((info.fieldStrength+1000)/info.maxFieldStrength*10*10)/100) + fieldAdder, fieldLineColor, colors.gray)
  687.  
  688. --display saturation controls
  689. gWrite("Saturation: " .. math.floor(saturationPercentage*(100-(compactMode*99)))/(100-(compactMode*99)) .. "%", 2, 12, colors.white, colors.black)
  690. gWrite("Target: " .. math.min(100,math.floor(targetSat/info.maxEnergySaturation*10000)/100) .. "%", 2, 13, colors.white, colors.black)
  691. --gBlit(2, 14, "< << <<< >>> >> >","00000000000000000","bfbbfbbbfbbbfbbfb")
  692.  
  693. if math.floor(info.energySaturation/10000000*100.0)/100.0 < math.floor(targetSat/10000000*10.0*10)/100.0 then
  694. saturationLineColor = colors.red
  695. elseif math.floor(info.energySaturation/10000000*100.0)/100.0 > math.floor(targetSat/10000000*10.0*10)/100.0 then
  696. saturationLineColor = colors.yellow
  697. else
  698. saturationLineColor = colors.green
  699. end
  700. gDrawProgressBar(1, 15, 19, math.floor(info.energySaturation/info.maxEnergySaturation*1100.0*10)/10000.0, saturationLineColor, colors.gray)
  701.  
  702. --display conversion rate controls
  703. gWriteR(math.floor(fuelUseRate*1)/1.0 .. "nb/t" .. " :Conv Rate", 0, 2, colors.white, colors.black)
  704. gWriteR(math.floor(10*1)/1.0 .. "nb/t " .. " :Target", 0, 3, colors.white, colors.black)
  705.  
  706. if math.floor(fuelUseRate*1)/1.0 < math.floor(10*1)/1.0 then
  707. fuelUseRateLineColor = colors.yellow
  708. elseif math.floor(fuelUseRate*1)/1.0 > math.floor(10*1)/1.0 then
  709. fuelUseRateLineColor = colors.red
  710. else
  711. fuelUseRateLineColor = colors.green
  712. end
  713. gDrawProgressBar(gfx.xRes-18, 5, 19, fuelUseRate/20000, fuelUseRateLineColor, colors.gray)
  714.  
  715. --display conversion level controls
  716. gWriteR(math.floor(fuelConversion*10)/10.0 .. "%" .. " :Conv Level", 0, 7, colors.white, colors.black)
  717. gWriteR(conversionTarget .. "%" .. " :Stop at", 0, 8, colors.white, colors.black)
  718. gBlitR(1, 9, "< << <<< >>> >> >","00000000000000000","bfbbfbbbfbbbfbbfb")
  719.  
  720. if fuelConversion > conversionTarget then
  721. convLevelLineColor = colors.red
  722. elseif fuelConversion > conversionTarget/1.1 then
  723. convLevelLineColor = colors.orange
  724. elseif fuelConversion > conversionTarget/1.25 then
  725. convLevelLineColor = colors.yellow
  726. else
  727. convLevelLineColor = colors.green
  728. end
  729.  
  730. local fuelBarFillage = fuelConversion / conversionTarget
  731. gDrawProgressBar(gfx.xRes-18, 10, 19, fuelBarFillage, convLevelLineColor, colors.gray)
  732. if fuelUseRate > 1 then
  733. gWriteTransparent(secondsToTimeString(fuelETA), gfx.xRes-18, 10, colors.white)
  734. else
  735. gWriteTransparent(("-:-d -:-h -:-m -:-s"), gfx.xRes-18, 10, colors.white)
  736. end
  737.  
  738. --display generation rate controls
  739. gWriteR(math.floor(targetPowerOutput-targetPowerInput)/1.0 .. "RF/t" .. " :Total", 0, 12, colors.white, colors.black)
  740. gWriteR(math.floor(targetPowerOutput*1)/1.0 .. "RF/t" .. " :Target", 0, 13, colors.white, colors.black)
  741.  
  742. if (targetPowerOutput-targetPowerInput)+1000*TotalReactorOutputMultiplier < math.floor(targetPowerOutput*1)/1.0 then
  743. outputLineColor = colors.red
  744. elseif (targetPowerOutput-targetPowerInput)-1000*TotalReactorOutputMultiplier > math.floor(targetPowerOutput*1)/1.0 then
  745. outputLineColor = colors.yellow
  746. else
  747. outputLineColor = colors.green
  748. end
  749.  
  750. gDrawProgressBar(gfx.xRes-18, 15, 19, (info.generationRate-targetPowerInput*1)/25000000/TotalReactorOutputMultiplier, outputLineColor, colors.gray)
  751.  
  752. gWrite("IN: " .. math.floor(powerInput) .. "RF/t", corePosX-6+compactMode*3, corePosY+8+compactMode, colors.green, colors.black)
  753. gWrite("OUT: " .. math.floor(targetPowerOutput) .. "RF/t", corePosX-7+compactMode*3, corePosY+9+compactMode, colors.red, colors.black)
  754. end
  755.  
  756. --The function that detects if the monitor has been touched and then runs
  757. function monitorTouch()
  758. while true do
  759. event, side, xPos, yPos = os.pullEvent("monitor_touch")
  760. if configScreenSelected == true then
  761. --runs if config screen is selected and the monitor has been touched
  762. if yPos == 2 and xPos >= 15 and xPos <= 16 then
  763. onePointTwelveMode = toggle(onePointTwelveMode)
  764. elseif yPos == 3 and xPos >= 17 and xPos <= 18 then
  765. fancyStartup = toggle(fancyStartup)
  766. elseif yPos == 4 and xPos >= 18 and xPos <= 19 then
  767. safetySystems = toggle(safetySystems)
  768. elseif yPos == 5 and xPos >= 20 and xPos <= 21 then
  769. keepaliveSignal = toggle(keepaliveSignal)
  770. elseif yPos == 6 and xPos >= 16 and xPos <= 17 then
  771. compactMode = toggle(compactMode)
  772. end
  773.  
  774. if scriptInitialized == 1 then
  775. if yPos == 17 and xPos >= 8 and xPos <= 13 then
  776. configScreenSelected = false
  777. end
  778. else
  779. if yPos == 17 and xPos >= 8 and xPos <= 24 then
  780. scriptInitialized = 1
  781. configScreenSelected = false
  782. gClear()
  783. gWrite('Your script has been initialized and configured.', 1,1,colors.white,colors.black)
  784. gWrite('Please restart it by typing "startup" into the computer', 1,2,colors.white,colors.black)
  785. gfx.setVisible(true)
  786. gfx.setVisible(false)
  787. print('Your script has been initialized and configured, please restart it by typing "startup"')
  788. saveConfig()
  789. error()
  790. end
  791. end
  792. else
  793. --runs if config screen is NOT selected and the monitor has been touched
  794. if yPos == 17 and xPos == 1 then
  795. controlsLocked = toggle(controlsLocked)
  796. end
  797. if controlsLocked ~= 1 then
  798. if yPos == 4 and xPos == 2 then
  799. tempTarget = tempTarget - 1.0
  800. controlSelected = 0
  801. elseif yPos == 4 and xPos >= 4 and xPos <= 5 then
  802. tempTarget = tempTarget - 10.0
  803. controlSelected = 0
  804. elseif yPos == 4 and xPos >= 7 and xPos <= 9 then
  805. tempTarget = tempTarget - 100.0
  806. controlSelected = 0
  807. elseif yPos == 4 and xPos >= 11 and xPos <= 13 then
  808. tempTarget = tempTarget + 100.0
  809. controlSelected = 0
  810. elseif yPos == 4 and xPos >= 15 and xPos <= 16 then
  811. tempTarget = tempTarget + 10.0
  812. controlSelected = 0
  813. elseif yPos == 4 and xPos == 18 then
  814. tempTarget = tempTarget + 1.0
  815. controlSelected = 0
  816. end
  817. if controlSelected == 0 then
  818. tempTarget = math.floor(tempTarget*1.0)/1.0
  819.  
  820. if tempTarget < 2000 then
  821. tempTarget = 2000
  822. end
  823. end
  824.  
  825. if fieldTarget <= 10 then
  826. fieldTargetSetDivider = 10
  827. else
  828. fieldTargetSetDivider = 1
  829. end
  830. if fieldTarget <= 9.999 then
  831. fieldTargetSetDivider2 = 10
  832. else
  833. fieldTargetSetDivider2 = 1
  834. end
  835.  
  836. if yPos == 9 and xPos == 2 then
  837. fieldTarget = fieldTarget - 0.099/fieldTargetSetDivider
  838. elseif yPos == 9 and xPos >= 4 and xPos <= 5 then
  839. fieldTarget = fieldTarget - 0.999/fieldTargetSetDivider
  840. elseif yPos == 9 and xPos >= 7 and xPos <= 9 then
  841. fieldTarget = fieldTarget - 9.999/fieldTargetSetDivider
  842. elseif yPos == 9 and xPos >= 11 and xPos <= 13 then
  843. fieldTarget = fieldTarget + 10.001/fieldTargetSetDivider2
  844. elseif yPos == 9 and xPos >= 15 and xPos <= 16 then
  845. fieldTarget = fieldTarget + 1.001/fieldTargetSetDivider2
  846. elseif yPos == 9 and xPos == 18 then
  847. fieldTarget = fieldTarget + 0.101/fieldTargetSetDivider2
  848. end
  849.  
  850. if fieldTarget <= 10 and fieldTargetSetDivider == 1 then
  851. fieldTarget = 10
  852. end
  853.  
  854. if fieldTarget <= 10 then
  855. fieldTarget = math.floor(fieldTarget*10.0*10.0)/100.0
  856. else
  857. fieldTarget = math.floor(fieldTarget*10.0)/10.0
  858. end
  859.  
  860. if fieldTarget < 0.00001 then
  861. fieldTarget = 0.00001
  862. elseif fieldTarget > 100 then
  863. fieldTarget = 100
  864. end
  865.  
  866. --if yPos == 14 and xPos == 2 then
  867. -- saturationTarget = saturationTarget - 100000
  868. -- controlSelected = 2
  869. --elseif yPos == 14 and xPos >= 4 and xPos <= 5 then
  870. -- saturationTarget = saturationTarget - 1000000.0
  871. -- controlSelected = 2
  872. --elseif yPos == 14 and xPos >= 7 and xPos <= 9 then
  873. -- saturationTarget = saturationTarget - 10000000.0
  874. -- controlSelected = 2
  875. --elseif yPos == 14 and xPos >= 11 and xPos <= 13 then
  876. -- saturationTarget = saturationTarget + 10000000.0
  877. -- controlSelected = 2
  878. --elseif yPos == 14 and xPos >= 15 and xPos <= 16 then
  879. -- saturationTarget = saturationTarget + 1000000.0
  880. -- controlSelected = 2
  881. --elseif yPos == 14 and xPos == 18 then
  882. -- saturationTarget = saturationTarget + 100000
  883. -- controlSelected = 2
  884. --end
  885.  
  886. --if controlSelected == 2 then
  887. -- if saturationTarget > 1000000000 then
  888. -- saturationTarget = 1000000000
  889. -- end
  890.  
  891. -- if saturationTarget < 0 then
  892. -- saturationTarget = 0
  893. -- end
  894. --end
  895.  
  896. --if fuelUseRateTarget >= 10000 then
  897. -- fuelUseRateTargetMultiplier = 10
  898. --else
  899. -- fuelUseRateTargetMultiplier = 1
  900. --end
  901.  
  902. --if yPos == 4 and xPos == gfx.xRes-17 then
  903. -- fuelUseRateTarget = fuelUseRateTarget - 1*fuelUseRateTargetMultiplier
  904. -- controlSelected = 3
  905. -- prevLowestSatSubtractor = 20000
  906. --elseif yPos == 4 and xPos >= gfx.xRes-15 and xPos <= gfx.xRes-14 then
  907. -- fuelUseRateTarget = fuelUseRateTarget - 10.0*fuelUseRateTargetMultiplier
  908. -- controlSelected = 3
  909. -- prevLowestSatSubtractor = 200000
  910. --elseif yPos == 4 and xPos >= gfx.xRes-12 and xPos <= gfx.xRes-10 then
  911. -- fuelUseRateTarget = fuelUseRateTarget - 100.0*fuelUseRateTargetMultiplier
  912. -- controlSelected = 3
  913. -- prevLowestSatSubtractor = 2000000
  914. --elseif yPos == 4 and xPos >= gfx.xRes-8 and xPos <= gfx.xRes-6 then
  915. -- fuelUseRateTarget = fuelUseRateTarget + 100.0*fuelUseRateTargetMultiplier
  916. -- controlSelected = 3
  917. -- prevLowestSatSubtractor = 20000
  918. --elseif yPos == 4 and xPos >= gfx.xRes-4 and xPos <= gfx.xRes-3 then
  919. -- fuelUseRateTarget = fuelUseRateTarget + 10.0*fuelUseRateTargetMultiplier
  920. -- controlSelected = 3
  921. -- prevLowestSatSubtractor = 20000
  922. --elseif yPos == 4 and xPos == gfx.xRes-1 then
  923. -- fuelUseRateTarget = fuelUseRateTarget + 1*fuelUseRateTargetMultiplier
  924. -- controlSelected = 3
  925. -- prevLowestSatSubtractor = 20000
  926. --end
  927.  
  928. --if controlSelected == 3 then
  929. -- if fuelUseRateTarget < 500 then
  930. -- fuelUseRateTarget = 500.5
  931. -- end
  932. --end
  933.  
  934. if yPos == 9 and xPos == gfx.xRes-17 then
  935. conversionTarget = conversionTarget - 0.1
  936. elseif yPos == 9 and xPos >= gfx.xRes-15 and xPos <= gfx.xRes-14 then
  937. conversionTarget = conversionTarget - 1.0
  938. elseif yPos == 9 and xPos >= gfx.xRes-12 and xPos <= gfx.xRes-10 then
  939. conversionTarget = conversionTarget - 10.0
  940. elseif yPos == 9 and xPos >= gfx.xRes-8 and xPos <= gfx.xRes-6 then
  941. conversionTarget = conversionTarget + 10.0
  942. elseif yPos == 9 and xPos >= gfx.xRes-4 and xPos <= gfx.xRes-3 then
  943. conversionTarget = conversionTarget + 1.0
  944. elseif yPos == 9 and xPos == gfx.xRes-1 then
  945. conversionTarget = conversionTarget + 0.1
  946. end
  947.  
  948. if conversionTarget > 100 then
  949. conversionTarget = 100
  950. end
  951.  
  952. if conversionTarget < 0 then
  953. conversionTarget = 0
  954. end
  955.  
  956. --if yPos == 14 and xPos == gfx.xRes-17 then
  957. -- targetPowerOutput = targetPowerOutput - 1000.0
  958. -- controlSelected = 5
  959. --elseif yPos == 14 and xPos >= gfx.xRes-15 and xPos <= gfx.xRes-14 then
  960. -- targetPowerOutput = targetPowerOutput - 10000.0
  961. -- controlSelected = 5
  962. --elseif yPos == 14 and xPos >= gfx.xRes-12 and xPos <= gfx.xRes-10 then
  963. -- targetPowerOutput = targetPowerOutput - 100000.0
  964. -- controlSelected = 5
  965. --elseif yPos == 14 and xPos >= gfx.xRes-8 and xPos <= gfx.xRes-6 then
  966. -- targetPowerOutput = targetPowerOutput + 100000.0
  967. -- controlSelected = 5
  968. --elseif yPos == 14 and xPos >= gfx.xRes-4 and xPos <= gfx.xRes-3 then
  969. -- targetPowerOutput = targetPowerOutput + 10000.0
  970. -- controlSelected = 5
  971. --elseif yPos == 14 and xPos == gfx.xRes-1 then
  972. -- targetPowerOutput = targetPowerOutput + 1000.0
  973. -- controlSelected = 5
  974. --end
  975.  
  976. --if targetPowerOutput < 0*TotalReactorOutputMultiplier then
  977. -- targetPowerOutput = 0*TotalReactorOutputMultiplier
  978. --end
  979.  
  980. if safetySystems == 1 then
  981. if tempTarget > 10000 then
  982. tempTarget = 10000
  983. end
  984. if conversionTarget > 90 then
  985. conversionTarget = 90
  986. end
  987. --if fuelUseRateTarget > 51000.5 then
  988. -- fuelUseRateTarget = 51000.5
  989. --end
  990. --if saturationTarget < 85000000 then
  991. -- saturationTarget = 85000000
  992. --end
  993. if fieldTarget <= 5 and safetySystems == 1 then
  994. fieldTarget = 5
  995. end
  996. end
  997.  
  998. if yPos == 17 and xPos >= 2 and xPos <= 5 then
  999. if info.status == "cold" or info.status == "cooling" or info.status == "stopping" then
  1000. indexSwitch = 0
  1001. reactor.chargeReactor()
  1002. reactor.activateReactor()
  1003. else
  1004. reactor.stopReactor()
  1005. end
  1006. end
  1007.  
  1008. if yPos == 17 and xPos >= 8 and xPos <= 13 then
  1009. configScreenSelected = true
  1010. end
  1011.  
  1012. end
  1013. end
  1014. saveConfig()
  1015. end
  1016. end
  1017.  
  1018. function configScreen()
  1019. gWrite("1.12.2 Mode:", 2, 2, colors.white, colors.black)
  1020. gWrite("Fancy Startup:", 2, 3, colors.white, colors.black)
  1021. gWrite("Safety Systems:", 2, 4, colors.white, colors.black)
  1022. gWrite("Keepalive Signal:", 2, 5, colors.white, colors.black)
  1023. gWrite("Compact Mode:", 2, 6, colors.white, colors.black)
  1024.  
  1025. if onePointTwelveMode == 1 then
  1026. gWrite("ON", 15, 2, colors.white, colors.green)
  1027. else
  1028. gWrite("OF", 15, 2, colors.white, colors.red)
  1029. end
  1030.  
  1031. if fancyStartup == 1 then
  1032. gWrite("ON", 17, 3, colors.white, colors.green)
  1033. else
  1034. gWrite("OF", 17, 3, colors.white, colors.red)
  1035. end
  1036.  
  1037. if safetySystems == 1 then
  1038. gWrite("ON", 18, 4, colors.white, colors.green)
  1039. else
  1040. gWrite("OF", 18, 4, colors.white, colors.red)
  1041. end
  1042.  
  1043. if keepaliveSignal == 1 then
  1044. gWrite("ON", 20, 5, colors.white, colors.green)
  1045. else
  1046. gWrite("OF", 20, 5, colors.white, colors.red)
  1047. end
  1048.  
  1049. if compactMode == 1 then
  1050. gWrite("ON", 16, 6, colors.white, colors.green)
  1051. else
  1052. gWrite("OF", 16, 6, colors.white, colors.red)
  1053. end
  1054.  
  1055. gWrite("CONFIG", 8, 17, colors.white, colors.purple)
  1056. end
  1057.  
  1058. -- run the update function and the monitor function in parallel so the entire program dosent only tick when someone clicks the monitor
  1059. parallel.waitForAny(update, monitorTouch)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement