Posted 02 April 2013 - 01:56 PM
Hello all, i'm relatively new to computercraft and have encountered the following error while trying to construct a program.
I'm not certain what in the code caused the error, but I think it might be due to the program not being able to access the menus.
I'll explain what it is I wanted the program to do first then i'll post the code up which hopefully someone could correct for me.
I wanted a menu system which could access two different sub menus with their own gui. I've used the gui part of the code before and tried to combine it with a menu program i'd found, somewhat disastrously xD anyway here's the code I made apologies it's so long.
The error is it loops the message ''No Such Program''
Thankyou for your help in advance and I apologies for the mess that is my code and it's length.
P.s it appears it isn't displaying the GUI screen properly in the paste above, whilst it does in notepad.
I'm not certain what in the code caused the error, but I think it might be due to the program not being able to access the menus.
I'll explain what it is I wanted the program to do first then i'll post the code up which hopefully someone could correct for me.
I wanted a menu system which could access two different sub menus with their own gui. I've used the gui part of the code before and tried to combine it with a menu program i'd found, somewhat disastrously xD anyway here's the code I made apologies it's so long.
The error is it loops the message ''No Such Program''
term.setTextColor(colors.green)
while x ~= "exit" do
print("-------------------------------")
print("Titan Manifold Control System:")
print("Alpha to select Titan Activation Protocols.")
print("Omega to select Titan Adminstrative Protocols.")
print("Type exit to go back to previous menu.")
write(" Enter a command now my princeps.")
print("-------------------------------")
x = io.read()
if x == "Alpha" then
while y ~= "exit" do
y = io.read()
if y == "on" then
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.green)
print" ---------------------------------------------- "
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" ---------------------------------------------- "
term.setCursorPos(19,3)
print"Current Status:"
if colors.test(redstone.getBundledOutput("back"), colors.blue) == false then
Reactor = "Off"
else
Reactor = "On"
end
if colors.test(redstone.getBundledOutput("back"), colors.black) == false then
Containment = "Off"
else
Containment = "On"
end
if colors.test(redstone.getBundledOutput("back"), colors.yellow) == false then
Flood Protocol = "Off"
else
Flood Protocol = "On"
end
if colors.test(redstone.getBundledOutput("back"), colors.gray) == false then
Illumination = "Off"
else
Illumination = "On"
end
if colors.test(redstone.getBundledOutput("back"), colors.red) == false then
Reactor Access = "Off"
else
Reactor Access = "On"
end
if colors.test(redstone.getBundledOutput("back"), colors.orange) == false then
HazMat locker = "Off"
else
HazMat locker = "On"
end
term.setCursorPos(5,5)
write("1 - Reactor activation: ")
write(Reactor)
term.setCursorPos(28,5)
write("2 - Reactor Containment: ")
write(Containment)
term.setCursorPos(5,7)
write("3 - Flood Protocol: ")
write(Flood)
term.setCursorPos(28,7)
write("4 - Illumination: ")
write(Illumination)
term.setCursorPos(5,9)
write("5 - Reactor Access: ")
write(Reactor Access)
term.setCursorPos(28,9)
write("6 - HazMat locker: ")
write(HazMat locker)
term.setCursorPos(3,12)
write("Select a Service From The List Above And Enter")
term.setCursorPos(7,13)
write("Its ID Below Or leave Blank To Log Out")
term.setCursorPos(21,15)
write("Enter ID: ")
sleep(1)
input = read()
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.green)
print" ---------------------------------------------- "
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" ---------------------------------------------- "
term.setCursorPos(15,9)
if input == "1" then
if Reactor == "On" then
print"Reactor Initialised"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.blue))
else
print"Reactor Deactivated"
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.blue))
end
elseif input == "2" then
if Reactor Containment == "On" then
print" Reactor Containment Deactivated"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.black))
else
print" Reactor Containment Activated"
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.black))
end
elseif input == "3" then
if Flood Protocol == "On" then
print"Flood Protocol Deactive"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.yellow))
else
print"Flood Protocol Active"
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.yellow))
end
elseif input == "4" then
if Titan Illumination == "On" then
print" Titan Illumination deactivated"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.gray))
else
print" Titan Illumination Activated"
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.gray))
end
elseif input == "5" then
if Reactor Access == "On" then
print"Reactor Access Withdrawn"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.red))
else
print"Reactor Access Granted"
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.red))
end
elseif input == "6" then
if HazMat locker == "On" then
print" HazMat locker locked"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.orange))
else
print" HazMat locker unlocked"
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.orange))
end
else
end -- if y = on/off
end -- while y
end -- if Alpha
if x == "Omega" then
while u ~= "exit" do
u=io.read()
if y == "on" then
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.green)
print" ---------------------------------------------- "
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" ---------------------------------------------- "
term.setCursorPos(19,3)
print"Current Status:"
if colors.test(redstone.getBundledOutput("back"), colors.blue) == false then
Head blast doors. = "Off"
else
Head blast doors. = "On"
end
if colors.test(redstone.getBundledOutput("back"), colors.black) == false then
Carapace access hatches. = "Off"
else
Carapace access hatches. = "On"
end
if colors.test(redstone.getBundledOutput("back"), colors.yellow) == false then
Carapace boarding hatch. = "Off"
else
Carapace boarding hatch. = "On"
end
if colors.test(redstone.getBundledOutput("back"), colors.gray) == false then
Thoracic Elevator. = "Off"
else
Thoracic Elevator. = "On"
end
if colors.test(redstone.getBundledOutput("back"), colors.red) == false then
Point Defence system. = "Off"
else
Point Defence system. = "On"
end
term.setCursorPos(5,5)
write("1 - Head blast doors.: ")
write(Head blast doors.)
term.setCursorPos(28,5)
write("2 - Carapace access hatches.: ")
write(Carapace access hatches.)
term.setCursorPos(5,7)
write("3 - Carapace boarding hatch.: ")
write(Carapace boarding hatch.)
term.setCursorPos(28,7)
write("4 - Thoracic Elevator.: ")
write(Thoracic Elevator.)
term.setCursorPos(5,9)
write("5 - Point Defence system.: ")
write(Point Defence system.)
term.setCursorPos(3,12)
write("Select a Service From The List Above And Enter")
term.setCursorPos(7,13)
write("Its ID Below Or leave Blank To Log Out")
term.setCursorPos(21,15)
write("Enter ID: ")
sleep(1)
input = read()
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.green)
print" ---------------------------------------------- "
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" | |"
print" ---------------------------------------------- "
term.setCursorPos(15,9)
if input == "1" then
if Head blast doors == "On" then
print"Head blast doors extended"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.blue))
else
print"Head blast doors Retracted"
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.blue))
end
elseif input == "2" then
if Carapace access hatches. == "On" then
print" Carapace access hatches. Sealed"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.black))
else
print" Carapace access hatches. Open"
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.black))
end
elseif input == "3" then
if Carapace boarding hatch. == "On" then
print"Carapace boarding hatch. Retracted"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.yellow))
else
print"Carapace boarding hatch Sealed."
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.yellow))
end
elseif input == "4" then
if Thoracic Elevator. == "On" then
print" Thoracic Elevator. Direction Upper level"
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.gray))
else
print" Thoracic Elevator. Direction Lower level"
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.gray))
end
elseif input == "5" then
if Point Defence system. == "On" then
print"Point Defence system Deactivated."
rs.setBundledOutput("back", colors.subtract( rs.getBundledOutput( "back" ), colors.red))
else
print"Point Defence system. Active."
rs.setBundledOutput("back", colors.combine( rs.getBundledOutput( "back" ), colors.red))
end
else
end -- if u = on/off
end -- while u
end -- if em
end -- while z
Yes it's a computer control system for the functions in my titan (40k reference).Thankyou for your help in advance and I apologies for the mess that is my code and it's length.
P.s it appears it isn't displaying the GUI screen properly in the paste above, whilst it does in notepad.