This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
zacchi4k's profile picture

[CC+BigReactors] getEnergyProducedLastTick not outputting any value

Started by zacchi4k, 09 September 2016 - 03:04 PM
zacchi4k #1
Posted 09 September 2016 - 05:04 PM
I have a reactor from BigReactors connected via computer port to a computer in order to have an automatic control system.
I also have a monitor connected (via network cable) to the computer in order to get some real-time info of the reactor status.
However, the getEnergyProducedLastTick argument seems to not work correctly, as it doesn't output any number.
This is what i mean:


Here's the part of the code responsible for that part:

monitor.write("Energy produced: ")
monitor.write(reactor.getEnergyProducedLastTick)
monitor.write(" RF/t")

And here's the code responsible for the whole screen:
Spoiler

monitor.setCursorPos(1,1)
monitor.clear()
if reactor.getActive() == true then
monitor.write("Reactor is ON")
else
monitor.write("Reactor is OFF")
end
monitor.setCursorPos(1,2)
fuel_perc = (reactor.getFuelAmount() / 320)
monitor.write("Fuel amount: ")
monitor.write(fuel_perc)
monitor.write("%")
monitor.setCursorPos(1,3)
monitor.write("Fuel temperature: ")
monitor.write(reactor.getFuelTemperature())
monitor.write(" C")
monitor.setCursorPos(1,4)
monitor.write("Energy buffer: ")
monitor.write(reactor.getEnergyStored())
monitor.write("RF")
monitor.setCursorPos(1,5)
monitor.write("Energy produced: ")
monitor.write(reactor.getEnergyProducedLastTick)
monitor.write(" RF/t")

Can someone help me?
Edited on 09 September 2016 - 04:51 PM
Lyqyd #2
Posted 09 September 2016 - 05:12 PM
You'll want to actually call the function. Your code is missing the parentheses on that line.
zacchi4k #3
Posted 09 September 2016 - 05:36 PM
You'll want to actually call the function. Your code is missing the parentheses on that line.
Whoops! I forgot them, and the computer was not giving any errors regrading them. Now it works. Thanks!
TheRockettek #4
Posted 09 September 2016 - 07:29 PM
You can merge those 3 lines by doing


term.write("Energy produced: " .. reactor.getEnergyProducedLastTick() .. " RF/T")

It will Write as

Energy produced: [number] RF/T

I also recomnend using math.floor on the temprature instead of it showing like

20.00047384719561

it will just show

20