Im trying to open and close my doors trough a computer.
Everything works fine only showing the status about the door (OPEN or CLOSE) doesnt work
The code is shown below and to read the OPEN/CLOSE status is at the bottom (red cable)
Maybe someone can tell me what I do wrong.
-- ######################
-- ## CABLE USAGE
-- ######################
-- Computer ID 17
-- RED Cable - Blastdoor D2
-- ######################
-- ##
-- ######################
local standby = 5
local side = "bottom"
local YES = "y"
local back = "back"
local a = "a"
local b = "b"
local c = "c"
local d = "d"
local e = "e"
red = rs.testBundledInput("bottom", colors.red) -- D-2 BlastDoor
local width, height = term.getSize()
-- ######################
-- ####
-- ######################
while true do
term.setCursorPos(1, 1)
term.setBackgroundColor(colors.white)
term.clear()
term.setTextColor(colors.black)
term.setBackgroundColor(colors.orange)
term.clearLine()
term.setCursorPos(1, height)
term.clearLine()
local text = "Nuclear Research Facility"
term.setCursorPos(math.floor((width - #text) / 2), 1)
term.write(text)
-- ######################
-- #### MENU
-- ######################
term.setTextColor(colors.black)
term.setBackgroundColor(colors.white)
term.setCursorPos(1, 3)
term.write("|Menu| Radiation Doors")
term.setCursorPos(4, 5)
term.write("A: D-2 Entrance")
term.setCursorPos(4, 14)
term.setTextColor(colors.black)
term.write("Option: ")
local input = read()
-- ######################
-- #### radiation doors D2
-- ######################
if input == a then
shell.run("d2")
end
-- ######################
-- ## SHUTDOWN SYSTEM
-- ######################
if input == e then
shell.run("startup")
end
-- ######################
-- ## Door Status
-- ######################
if red == true then
term.setCursorPos(22,5)
term.setTextColor(colors.red)
term.setBackgroundColor(colors.white)
term.write("CLOSED ")
else
term.setCursorPos(22,5)
term.setTextColor(colors.lime)
term.setBackgroundColor(colors.white)
term.write("OPEN ")
end
os.pullEvent("redstone")
end
Edited by Xixili, 22 July 2014 - 10:45 PM.












