So I'm making a program that emits a redstone signal when the reactor's energy in the big reactors mod is full, and stops that signal when it's not full.
I'm sort of new to ComputerCraft. I'm using what little knowledge I know and my Java knowledge.
Sorry to bother about this. I may see like an idiot, but I'd like to learn computercraft better.
p = peripheral.wrap("back")
while true do
if p.getEnergyStored() = 10000000
then
redstone set ("right") (true)
else
redsone set ("right") (false)
Big Reactors Program
Started by SullyPlayer, Nov 08 2014 06:05 AM
1 reply to this topic
#1
Posted 08 November 2014 - 06:05 AM
#2
Posted 08 November 2014 - 09:36 AM
You're structure's completely broken, but you've clearly got the idea as to how the logic of the script would work.
Here's a corrected version of your code:
Though this block here:
... could be further shrunk:
Here's a corrected version of your code:
local p = peripheral.wrap("back")
while true do
if p.getEnergyStored() == 10000000 then
rs.setOutput("right", true)
else
rs.setOutput("right", false)
end
-- Scripts must pause every now and then;
-- ComputerCraft kills those that don't yield.
sleep(5)
end
Though this block here:
if p.getEnergyStored() == 10000000 then
rs.setOutput("right", true)
else
rs.setOutput("right", false)
end
... could be further shrunk:
rs.setOutput("right", p.getEnergyStored() == 10000000)
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











