I'm trying to write a program that checks the power in my Stargate and it's state (connected, idle, etc...) and then turn my reactor on and of accordingly. It works for the power portion but does not seem to care about the of the gate. I also have a config file that is working I'm including it in case anybody notices something wrong with it.
here are the codes:
config file:
c = require("component")
e = require("event") ---here in case I choose to write other progams
r = c.getPrimary("br_reactor")
s = c.getPrimary("stargate")
t = require("term") ---here in case I choose to write other programs
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.
I'm trying to write a program that checks the power in my Stargate and it's state (connected, idle, etc...) and then turn my reactor on and of accordingly. It works for the power portion but does not seem to care about the of the gate. I also have a config file that is working I'm including it in case anybody notices something wrong with it.
here are the codes:
config file:
c = require("component")
e = require("event") ---here in case I choose to write other progams
r = c.getPrimary("br_reactor")
s = c.getPrimary("stargate")
t = require("term") ---here in case I choose to write other programs
now the code itself:
dofile("config")
if s.energyAvailable() <= 99999 and
s.stargateState() == idle then
r.setActive(true)
else if s.energyAvailable() == 1000000 or
s.stargateState() ~= idle then
r.setActive(false)
end
end
-----------------------------------------------------------------------------------------------------------------------------------
In the end I will be looping it but that i have no problem with except for programming in a "break" key that I have no idea.
For SGCraft methods and events go here: http://www.cosc.canterbury.ac.nz/greg.ewing/minecraft/mods/SGCraft/doc/ComputerCraft.html
As for Big Reactors methods and events I'll edit this when their site comes back online
Thanks in advance for any help you can give.
Link to post
Share on other sites