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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...