Honestly, i recommend you replace my solution with TheCoryKid's. It almost always better to use functions, as you will have to re-write the code over and over with my way. Also, both if input == "1" blocks will get called, one after the other. it will never alternate, unless you put another if then statement and combine the code.
As you doing the monitor program and the control program, i'm not that sure of how to do it on one computer.
You could use the parallel api, but that might have the monitor not update while you are inputting into the terminal.
You could run them one after the other, but that will pause one program while it runs the other.
The best way would be to connect the bundled cable to another computer, running the monitor program on a hidden one.
I tried and I get an error on line 29:
bios:388: [string "solar"]:29: 'then' expected
Its about this line:
rs.setBundledOutput("back", Curcolor - colors.yellow) -- turn off the color
term.setBackgroundColor(colors.white)
term.clear()
term.setCursorPos(1,1)
term.setBackgroundColor(colors.lightBlue)
term.setTextColor(colors.white)
print("Solar Array Control Terminal ")
while true do
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
term.setCursorPos(1,3)
term.clearLine()
write "Wich array do you wish to turn on or off?"
term.setCursorPos(1,4)
write "Array 1, 2, 3, 4, 5, 6, 7, 8:"
term.setCursorPos(1,5)
write ""
local input = string.lower( read() )
if input == "1 on" then
coloryellow = "on" -- will be used later
Curcolor = rs.getBundledOutput("back") -- Finds what colors are currently on
rs.setBundledOutput("back", Curcolor + colors.yellow) -- sets the currently on colors and the new color on
print "Unit 1 changed status "
end
if input == "1 off" then
Curcolor = rs.getBundledOutput("back") -- Finds the color like before
if coloryellow == "on" -- This will make sure it wont be messed up
rs.setBundledOutput("back", Curcolor - colors.yellow) -- turn off the color
colorgreen = "off" -- Set it back to off- it is off now
print "Unit 1 is OFF "
else
print("Unit 1 if already OFF ") -- tell them its off already
end
end
if input == "exit" then
term.clear()
term.setTextColor(colors.red)
redstone.setBundledOutput("back", 0)
term.setCursorPos(1,1)
print "Terminal shutting down"
sleep(2)
term.setCursorPos(1,1)
print "Its now safe to continue"
break
end
end