Posted 12 September 2012 - 11:52 PM
Hello, I'm currently building a nuclear power plant. And, I'm currently at the stage of coding the whole system. Though, I tend to stray from RedNet because of it's insecure and limited capabilities. Thus, I had to find an alternative to communicate between the computers managing all of the systems.
The system uses bundled cables. Essentially, I'm still ironing out the specifics of the program. Though, there's one Mainframe computer which sends all of the commands via the cables. Since bundled cables are essentially a 16-channel redstone cable. A certain combination of colors would automatically send a command throughout the whole network. The other computers are constantly waiting for said commands. If it doesn't recognize a command, then, it ignores it. In a limited context, like, when a computer sends a command to another computer. It works. Though, when we have multiple computers, the receiver computers activates when it's not supposed to. So, automatically, it breaks the concept. Though, I prefer this system over RedNet because of it's local-capabilities. So, everything is closed. We are talking about a nuclear reactor. So, it's like an Ethernet cable over wifi.
Anywho, here's some code:
Mainframe Computer:
Blastdoor Computer:
Elevator Controls:
To me, the issue resides in this line of code:
if colors.test(rs.getBundledInput("top"), colors.white+colors.orange+colors.lightBlue) == true then
It checks of colors.white+colors.orange+colors.lightBlue is active. Though, if the main frame activates the exact command. A command with a line of code like this:
if colors.test(rs.getBundledInput("top"), colors.white+colors.orange) == true then
Would automatically activate that commands while activating the command up-top. Causing issues. I've tried a few options that did this:
The system uses bundled cables. Essentially, I'm still ironing out the specifics of the program. Though, there's one Mainframe computer which sends all of the commands via the cables. Since bundled cables are essentially a 16-channel redstone cable. A certain combination of colors would automatically send a command throughout the whole network. The other computers are constantly waiting for said commands. If it doesn't recognize a command, then, it ignores it. In a limited context, like, when a computer sends a command to another computer. It works. Though, when we have multiple computers, the receiver computers activates when it's not supposed to. So, automatically, it breaks the concept. Though, I prefer this system over RedNet because of it's local-capabilities. So, everything is closed. We are talking about a nuclear reactor. So, it's like an Ethernet cable over wifi.
Anywho, here's some code:
Mainframe Computer:
Spoiler
shell.run("clear")
function rsreset(sSide)
redstone.setBundledOutput(sSide, 0)
end
print("Welcome to the MainFrame")
print("You may control any systems in the power plant")
print("Here are the available commands:")
print(" cbd - Close Blast Doors")
print(" obd - Open Blast Doors")
print(" oed - Open Elevator Doors")
print(" ced - Close Elevator Doors")
print(" rme - Raise Main Elevator to Entrance Level")
print(" lme - Lower Main Elevator to Reactor Level")
while true do
event = os.pullEvent()
input = read()
cdb = "cbd"
odb = "obd"
oed = "oed"
ced = "ced"
rme = "rme"
lme = "lme"
shutdown = "shutdown"
if input == "cbd" then
print("Closing Blast Doors...")
rs.setBundledOutput("bottom" , colors.lightBlue+colors.white)
sleep(1)
rsreset("bottom")
sleep(0.1)
print("Waiting for Confirmation")
os.pullEvent("redstone")
print("Confirmation Received")
else if input == "obd" then
print("Opening Blast Doors...")
rs.setBundledOutput("bottom" , colors.lightBlue+colors.orange)
sleep(1)
rsreset("bottom")
sleep(0.1)
print("Waiting for Confirmation...")
os.pullEvent("redstone")
print("Confirmation Received...")
else if input == "oed" then
print("Override - Opening Elevator Door...")
rs.setBundledOutput("bottom" , colors.lightBlue+colors.magenta)
sleep(1)
rsreset("bottom")
sleep(0.1)
print("Waiting for Confirmation")
os.pullEvent("redstone")
print("Confirmation Received")
else if input == "ced" then
print("Override - Closing Elevator Door...")
rs.setBundledOutput("bottom" , colors.lightBlue+colors.yellow)
sleep(1)
rsreset("bottom")
sleep(0.1)
print("Waiting for Confirmation")
os.pullEvent("redstone")
print("Confirmation Received")
else if input == "rme" then
print("Raising Elevator to Entrance Level...")
rs.setBundledOutput("bottom" , colors.white+colors.orange+colors.magenta)
sleep(1)
rsreset("bottom")
sleep(0.1)
print("Waiting for Confirmation...")
os.pullEvent("redstone")
print("Confirmation Received...")
else if input == "lme" then
print("Raising Elevator to Reactor Level...")
rs.setBundledOutput("bottom" , colors.white+colors.orange+colors.lightBlue)
sleep(1)
rsreset("bottom")
sleep(0.1)
print("Waiting for Confirmation...")
os.pullEvent("redstone")
print("Confirmation Received...")
else if input == "shutdown" then
print("Exiting...")
shell.run("shutdown")
else
print("Input Not Recognized")
end
end
end
end
end
end
end
end
Spoiler
shell.run("clear")
function rsreset(sSide)
redstone.setBundledOutput(sSide, 0)
end
print("Welcome to Blast Doors and Elevator Controls")
print("Waiting for Command from MainFrame...")
while true do
event = os.pullEvent()
if colors.test(rs.getBundledInput("top"), colors.lightBlue+colors.white) == true then
print("Closing Blast Doors...")
rs.setBundledOutput("bottom" , colors.magenta)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.orange)
sleep(0.5)
rs.setBundledOutput("bottom" , colors.magenta)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.orange)
sleep(0.5)
rs.setBundledOutput("bottom" , colors.magenta)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.orange)
sleep(0.5)
rs.setBundledOutput("bottom" , colors.magenta)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.orange)
sleep(0.5)
rs.setBundledOutput("bottom" , colors.white)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.white)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.white)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.white)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
print("Door Closed")
rs.setBundledOutput("top" , colors.lightBlue+colors.black)
sleep(0.5)
rsreset("top")
end
end
if colors.test(rs.getBundledInput("top"), colors.lightBlue+colors.orange) == true then
print("Opening Blast Doors...")
rs.setBundledOutput("bottom" , colors.lime)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.yellow)
sleep(0.5)
rs.setBundledOutput("bottom" , colors.lime)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.yellow)
sleep(0.5)
rs.setBundledOutput("bottom" , colors.lime)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.yellow)
sleep(0.5)
rs.setBundledOutput("bottom" , colors.lime)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.yellow)
sleep(0.5)
rs.setBundledOutput("bottom" , colors.lightBlue)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.lightBlue)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.lightBlue)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
rs.setBundledOutput("bottom" , colors.lightBlue)
sleep(0.5)
rsreset("bottom")
sleep(0.5)
print("Door Opened")
rs.setBundledOutput("top" , colors.lightBlue+colors.black)
sleep(0.5)
rsreset("top")
end
end
if colors.test(rs.getBundledInput("top"), colors.lightBlue+colors.magenta) == true then
else if colors.test(rs.getBundledInput("top"), colors.white+colors.orange+colors.yellow+colors.lime+colors.pink+colors.gray+colors.lightGray+colors.cyan+colors.purple+colors.blue+colors.brown+colors.green+colors.red+colors.black) == false then
print("Override - Opening Elevator Door...")
rs.setBundledOutput("bottom" , colors.pink)
sleep(3)
rsreset("bottom")
print("Override Complete...")
rs.setBundledOutput("top" , colors.lightBlue+colors.black)
sleep(0.5)
rsreset("top")
end
end
if colors.test(rs.getBundledInput("top"), colors.lightBlue+colors.yellow) == true then
print("Override - Closing Elevator Door...")
rs.setBundledOutput("bottom" , colors.gray)
sleep(3)
rsreset("bottom")
print("Override Complete...")
rs.setBundledOutput("top" , colors.lightBlue+colors.black)
sleep(0.5)
rsreset("top")
end
end
end
Spoiler
shell.run("clear")
function rsreset(sSide)
redstone.setBundledOutput(sSide, 0)
end
print("Welcome to Raw Elevator CTRL")
print("Waiting for Command from MainFrame...")
while true do
event = os.pullEvent()
if colors.test(rs.getBundledInput("top"), colors.white+colors.orange+colors.magenta) == true then
print("Lifting Elevator")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.white)
sleep(1)
rsreset("bottom")
print("Elevator at Entrance Level")
rs.setBundledOutput("top" , colors.white+colors.orange+colors.black)
sleep(0.5)
rsreset("top")
end
end
if colors.test(rs.getBundledInput("top"), colors.white+colors.orange+colors.lightBlue) == true then
print("Lowering Elevator")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleep(1)
rsreset("bottom")
rs.setBundledOutput("bottom" , colors.orange)
sleeep(1)
rsreset("bottom")
print("Elevator at Reactor Level")
rs.setBundledOutput("top" , colors.white+colors.orange+colors.black)
sleep(0.5)
rsreset("top")
end
end
end
if colors.test(rs.getBundledInput("top"), colors.white+colors.orange+colors.lightBlue) == true then
It checks of colors.white+colors.orange+colors.lightBlue is active. Though, if the main frame activates the exact command. A command with a line of code like this:
if colors.test(rs.getBundledInput("top"), colors.white+colors.orange) == true then
Would automatically activate that commands while activating the command up-top. Causing issues. I've tried a few options that did this:
if colors.test(colors.combine(colors.white+colors.orange+colors.magenta) == true) and (colors.test(rs.getBundledInput("right"), colors.lightBlue+colors.yellow+colors.lime+colors.pink+colors.gray+colors.lightGray+colors.cyan+colors.purple+colors.blue+colors.brown+colors.brown+colors.green+colors.red+colors.red+colors.black) ~= true) then
Though, it doesn't seems to want to work. So, I'm stuck at that. Any help would be appreciated