Posted 13 July 2012 - 05:47 PM
Hey, I'm working on making a nuclear reactor setup thats hooked into a computer which runs all of the programs. I have a menu and subMenu system set up. When the reactor is started, one of the colored wires is turned on. What I wanted to know was if I choose a different thing from the menu, will that color wire turn off? And when it goes back to the home menu after a selection is chosen, will all those wires stay on? I will paste the code so you can see what I mean.
Also another question I have is how do I get only certain lines of the code to appear on the monitor next to the computer?
Thanks for the help!
local function reactorMenu()
while true do
term.clear()
term.setCursorPos(1,1)
print("***************************")
print()
print("Reactor Menu")
print()
print("1. Start Reactor")
print("2. Stop Reactor")
print("3. Perform Maintainence")
print("4. Start Refill Timer")
print("5. Back")
e, p = os.pullEvent()
if e == "char" then
if p == "1" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Loading Mainframes...")
sleep(3)
print()
textutils.slowPrint("Loading Subsystems...")
sleep(2)
redstone.setOutput("bottom", colors.brown)
sleep(2)
print()
textutils.slowPrint("Starting Cooling Systems...")
sleep(2)
print()
textutils.slowPrint("Starting Reactor...")
sleep(2)
redstone.setBundledOutput("bottom", colors.green)
sleep(2)
print()
textutils.slowPrint("Reactor Successfully Started")
elseif p == "2" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Shutting Down Mainframes...")
sleep(3)
print()
textUtils.slowPrint("Shutting Down Subsystems...")
sleep(2)
print()
textutils.slowPrint("Closing Water Cooling Valve...")
sleep(2)
print()
textutils.slowPrint("Shutting Down Reactor...")
sleep(2)
print()
textutils.slowPrint("Reactor Successfully Shutdown")
sleep(2)
return
elseif p == "3" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Checking Reactor is Shutdown...")
sleep(2)
textutils.slowPrint("Reactor Shutdown...")
sleep(1)
textutils.slowPrint("Shutting Water Cooling Valve...")
sleep(2)
print()
textutils.slowPrint("Opening Maintainence Doors")
sleep(2)
redstone.setBundledOutput("bottom", colors.cyan)
sleep(2)
return
elseif p == "4" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Function Not Implemented...")
sleep(2)
return
elseif p = "5" then
retrun
end
end
end
end
So, let me explain what all of this does. Brown wires turn on the water. Green turn the reactor on, and Cyan opens some of the doors in the place. So when the reactor is started, the green wires will turn on and start the reactor. What i wanna know is in the stop reactor part of the code. Do I need to have some code to turn the wires off? I know to turn wires on it redstone.setBundledOutput("side", colors.green) but is there something i need to do to turn it off?Also another question I have is how do I get only certain lines of the code to appear on the monitor next to the computer?
Thanks for the help!