Ok, so, I'm playing on a modpack (Tekkify) that has both Big Reactors and OpenComputers, and I'm trying to write a program that monitors a turbine I have set up after I start the program. I sadly don't know a lot about lua or OC on my own to fix this, so I'm looking to get some help possibly from people who have more know-how on with OC. I've already written up a rough mock of what I want, though it doesn't quite work as I had imagined-- it goes through the program once, prints the items I'm attempting to track to the screen once, I was using a while loop to hopefully make it check the values over and over, but it doesn't seem to be doing that.
local term = require("term")
local component = require("component")
local turbine = component.br_turbine
local tActive = turbine.getActive()
local tRPM = math.ceil(tonumber(turbine.getRotorSpeed()))
local tRf = math.ceil(tonumber(turbine.getEnergyStored()))
local tRfPt = math.ceil(tonumber(turbine.getEnergyProducedLastTick()))
while tActive do
os.sleep(1)
term.clear()
print(tRPM, " RPM")
print(tRf, " RF Stored")
print(tRfPt, " RF/t")
end
If, due to my lack of knowledge of how loops work other than them just looping, I actually did what I was hoping for wrong, please, tell me how I can fix it so I might learn for future instances. Thank you in advance!
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Ok, so, I'm playing on a modpack (Tekkify) that has both Big Reactors and OpenComputers, and I'm trying to write a program that monitors a turbine I have set up after I start the program. I sadly don't know a lot about lua or OC on my own to fix this, so I'm looking to get some help possibly from people who have more know-how on with OC. I've already written up a rough mock of what I want, though it doesn't quite work as I had imagined-- it goes through the program once, prints the items I'm attempting to track to the screen once, I was using a while loop to hopefully make it check the values over and over, but it doesn't seem to be doing that.
local term = require("term") local component = require("component") local turbine = component.br_turbine local tActive = turbine.getActive() local tRPM = math.ceil(tonumber(turbine.getRotorSpeed())) local tRf = math.ceil(tonumber(turbine.getEnergyStored())) local tRfPt = math.ceil(tonumber(turbine.getEnergyProducedLastTick())) while tActive do os.sleep(1) term.clear() print(tRPM, " RPM") print(tRf, " RF Stored") print(tRfPt, " RF/t") endIf, due to my lack of knowledge of how loops work other than them just looping, I actually did what I was hoping for wrong, please, tell me how I can fix it so I might learn for future instances. Thank you in advance!
Link to post
Share on other sites