This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
wowplayer101's profile picture

Multi-Choice list (HELP!)

Started by wowplayer101, 05 July 2012 - 03:30 AM
wowplayer101 #1
Posted 05 July 2012 - 05:30 AM
Hey guys, I just started using computercraft with Tekkit on my server, and I'm trying to set up a nuclear reactor interface so you have multiple paths you can choose- whether to continue, turn on reactor, cool reactor, ETC. I have my central computer set so that to even access the mainframe, you need to enter a password.

The problem I'm having is that I can't figure out the programming for a multiple choice system.
I have something as follows:

print ("Welcome to The Nuclear Reactor Mainframe!")
print ()
print ("Please select an action to take.")
print ("1. Reactor Menu")
print ("2. Early Warning Systems")
print ("3. Manual Shutdown")
print ("4. Cancel")

input = read()
if input == "1" then
term.clear()
term.setCursorPos(1,1)
print (" Reactor Menu ")
print ()
print ("1. Start Reactor")
print ("2. Start Cooling Systems")
print ("3. Begin Timer Until Uranium Refill Required") –I'm making the refill of uranium manual, so there are no "accidents"
print ("4. Cancel")
input = read()
if input == "1" then
term.clear()
term.setCursorPos(1,1)
print ("Accessing Files…")
sleep(2)
print ()
print ("Starting Reactor…")
sleep(2)
redstone.setOutput("back", true) –I have a NOT gate setup, so this will turn the reactor on (will run continously without a redstone signal)
print ()
print ("Reactor Successfully Started")

Now here's the part I need help with. I want the program to return to the Nuclear Reactor Menu, not the mainframe menu or the startup password entry. The only way I've learned to program this is to type os.shutdown() to shut down the computer and then restart, but then you'd have to navigate there again. If someone could:
A: Help me with the return function of my programming (to the previous page)
and B: Either proofread my programming or tell me how to do this…

The program should look something like this

startup –> Enter Password –> type in Nuclear Reactor –> Display Reactor Mainframe Choices
1. Reactor Menu
2. Early Warning Systems
3. Emergancy Shutdown
4. Cancel

1. Should Entail:
Starting the Reactor
Stopping the Reactor
Starting the Cooling Systems (just needs to power pistons to let water flow in)
Stopping Cooling Systems
Start Timer Until Next Uranium Refill
and the all important: Cancel
2 Should just have:
Starting the Sirens
Stopping the Sirens (Manually; the sirens will automatically go off at 4500 degree heat)
3 Needs another redstone output, just to activate pistons, destroying redstone circuitry, turning off reactor
4 another cancel

Also, would there be any way for me to display this all on the monitor I have above the computer?
I have no disk drives or anything like that, so all sides are open for redstone except top and front.
(as if i haven't asked enough =P) Would there also be a way for the program to automatically check for a redstone output on one side (idc which) so if the overheating gets too bad, it can pull up a screen on the monitor asking if you want to shut off the reactor or not? (it can use the same output as the one to manually turn on-off reactor in order to shut the reactor off)

Thanks to anyone who even looks at this post. I know it's quite wordy, and takes a while to get through. I would greatly appreciate help on this here =P Remember, I'm new to this (2 days, in fact)
so I won't understand much of lua or programming language.

Thanks, thanks, and thanks again!
Lyqyd #2
Posted 05 July 2012 - 05:46 AM
Duplicate of topic found here.