Laamapalmu Posted December 28, 2012 Posted December 28, 2012 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!
jonjon1234 Posted December 28, 2012 Posted December 28, 2012 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.
Laamapalmu Posted December 28, 2012 Author Posted December 28, 2012 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?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now