Posted 16 February 2014 - 11:10 AM
Hey guys, I've written a program to monitor and control a basic "Big Reactors" reactor and I'm quite pleased with it, however, it flickers every two seconds when the while loop runs again. Is there a way to make it not flicker?
Here's the code I've written:
Here's the code I've written:
Spoiler
hec = peripheral.wrap("cofh_thermalexpansion_energycell_0")
br = peripheral.wrap("BigReactors-Reactor_0")
local maxStore = 0
local curStore = 0
local thirty = 0
local ninety = 0
local rTemp = 0
local rCurStore = 0
local rFuelAmount = 0
local rFuelMax = 0
local rWasteAmount = 0
local rEProduced = 0
local rCRodL = 0
maxStore = hec.getMaxEnergyStored("")
thirty = (maxStore/100)*30
ninety = (maxStore/100)*90
while true do
term.clear()
term.setCursorPos(1,1)
curStore = hec.getEnergyStored("")
rTemp = br.getTemperature()
rCurStore = br.getEnergyStored()
rFuelAmount = br.getFuelAmount()
rFuelMax = br.getFuelAmountMax()
rWasteAmount = br.getWasteAmount()
rEProduced = math.floor(br.getEnergyProducedLastTick())
print(" Energy Cell: "..curStore.." / "..maxStore.." RF")
print("")
print(" Temperature: "..rTemp.." C")
print(" Energy (Reactor): "..rCurStore.." RF")
print(" Fuel: "..rFuelAmount.." / "..rFuelMax.." mB")
print(" Waste: "..rWasteAmount.." mB")
print(" Energy Last Tick: "..rEProduced.." RF")
print("")
if curStore <= thirty then
br.setActive(true)
print(" Reactor is: ON")
elseif curStore >= ninety then
br.setActive(false)
print(" Reactor is: OFF")
end
sleep(2)
end