Jump to content

Recommended Posts

Posted

Hi. Im looking for Source code to Computercraft which is looping. If os.time is 8 pm it will turn Nuclear Reactor on and if os.time is 8 am it will stop. It's my idea in my friends little city. In day we produce energy with solars and night's with nuclear. Thank you!

Posted

 local side = "Side the redstone output is on"

while true do

sleep(0)

if os.time = "2000" then -- Replace 2000 withy he number that represents 8:00pm

print("Turning Reactor ON")

reactOn = 1

rs.setOutput(side, false)

elseif os.time == "0800" then

print("Turning Reactor OFF")

reactOn = 0

rs.setOutput(side, true)

end

end

Should work.

Posted

 local side = "Side the reactor control is on"

while true do

sleep(0)

if os.time == "2000" (Or whatever 8pm is in os.time() ) then

print("Turning Reactor ON")

reactOn = 1

rs.setOutput(side, false)

elseif os.time == "0800" then

print("Turning Reactor OFF")

reactOn = 0

rs.setOutput(side, true)

end

end

Should work.

Thank You! : )

Umm what is that reactor control? redstone output or thermal meter?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...