Posted 10 October 2012 - 11:54 AM
Spoiler
I'm having a hard time figuring out what the error is. Mostly because I cannot find out exactly what that error is. If anyone can tell me what causes that error code and/or tell me what is wrong it would be greatly appreciated.Nvm. I've figured it out. I don't know how to delete the post.
Spoiler
--clears terminal
local function clear()
term.clear()
term.setCursorPos(1,1)
end
--moves elevator up one notch
local function elevatorUp()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.purple)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.purple)
sleep(0.5)
end
--moves elevator down one notch
local function elevatorDown()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.cyan)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.cyan)
sleep(0.5)
end
--opens basement door
local function basementOpen()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.pink)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.pink)
sleep(0.5)
end
--closes basement door
local function basementClose()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.gray)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.gray)
sleep(0.5)
end
--opens first floor door
local function 1stOpen()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.white)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.white)
sleep(0.5)
end
--closes first floor door
local function 1stClose()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.orange)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.orange)
sleep(0.5)
end
--opens second floor door
local function 2ndOpen()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.lightBlue)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.lightBlue)
sleep(0.5)
end
--closes second floor door
local function 2ndClose()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.magenta)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.magenta)
sleep(0.5)
end
--opens 3rd floor door
local function 3rdOpen()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.lime)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.lime)
sleep(0.5)
end
--closes 3rd floor door
local function 3rdClose()
rs.setBundledOutput("left", rs.getBundledOutput("left") + colors.yellow)
sleep(0.5)
rs.setBundledOutput("left", rs.getBundledOutput("left") - colors.yellow)
sleep(0.5)
end
--moves elevator from basement to first floor
local function basementFirstUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
end
--moves elevator from 1st to 2nd floor
local function firstSecondUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
end
--moves elevator from 2nd to third floor
local function secondThirdUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
elevatorUp()
end
--moves elevator from third floor to second
local function thirdSecondDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
end
--moves elevator from second floor to first floor
local function secondFirstDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
end
--moves elevator from first floor to basement
local function firstBasementDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
elevatorDown()
end
--closes all doors
local function closeDoors()
basementClose()
1stClose()
2ndClose()
3rdClose()
end
clear()
closeDoors()
--basement 1st floor button
while x ~= "dazed" do
y = rs.getBundledInput("back")
sleep(0.5)
print("No activity")
if colors.test(y, colors.green) == true then
print("Button Detected")
basementOpen()
sleep(5)
closeDoors()
basementFirstUp()
sleep(1)
1stOpen()
sleep(10)
closeDoors()
firstBasementDown()
x = "dazed"
os.restart()
--basement 2nd floor button
else if colors.test(y, colors.brown) == true then
print("Button Detected")
basementOpen()
sleep(5)
closeDoors()
basementFirstUp()
firstSecondUp()
sleep(1)
2ndOpen()
sleep(10)
closeDoors()
secondFirstDown()
firstBasementDown()
x = "dazed"
os.restart()
--basement 3rd floor button
else if colors.test(y, colors.red) == true then
print("Button Detected")
basementOpen()
sleep(5)
closeDoors()
basementFirstUp()
firstSecondUp()
secondThirdUp()
sleep(1)
3rdOpen()
sleep(10)
closeDoors()
thirdSecondDown()
secondFirstDown()
firstBasementDown()
x = "dazed"
os.restart()
--1st floor basement button
else if colors.test(y, colors.) == true then
print("Button Detected")
basementFirstUp()
1stOpen()
sleep(5)
closeDoors()
firstBasementDown()
basementOpen()
sleep(10)
closeDoors()
x = "dazed"
os.restart()
--1st floor 2nd floor button
else if colors.test(y, colors.orange) == true then
print("Button Detected")
basementFirstUp()
1stOpen()
sleep(5)
closeDoors()
firstSecondUp()
2ndOpen()
sleep(10)
closeDoors()
secondFirstDown()
firstBasementDown()
x = "dazed"
os.restart()
--1st floor 3rd floor button
else if colors.test(y, colors.magenta) == true then
print("Button Detected")
basementFirstUp()
1stOpen()
sleep(5)
closeDoors()
firstSecondUp()
secondThirdUp()
3rdOpen()
sleep(10)
closeDoors()
thirdSecondDown()
secondFirstDown()
firstBasementDown()
x = "dazed"
os.restart()
--second floor basement button
else if colors.test(y, colors.yellow) == true then
print("Button Detected")
basementFirstUp()
firstSecondUp()
2ndOpen()
sleep(5)
closeDoors()
secondFirstDown()
firstBasementDown()
BasementOpen()
sleep(10)
closeDoors()
x = "dazed"
os.restart()
--second floor first floor button
else if colors.test(y, colors.lime) == true then
print("Button Detected")
basementFirstUp()
firstSecondUp()
2ndOpen()
sleep(5)
closeDoors()
secondFirstDown()
1stOpen()
sleep(10)
closeDoors()
firstBasementDown()
x = "dazed"
os.restart()
--second floor third floor button
else if colors.test(y, colors.purple) == true then
print("Button Detected")
basementFirstUp()
firstSecondUp()
2ndOpen()
sleep(5)
closeDoors()
secondThirdUp()
3rdOpen()
sleep(10)
closeDoors()
thirdSecondDown()
secondFirstDown()
firstBasementDown()
x = "dazed"
os.restart()
--3rd floor basement button
else if colors.test(y, colors.white) == true then
print("Button Detected")
basementFirstUp()
firstSecondUp()
secondThirdUp()
3rdOpen()
sleep(5)
closeDoors()
thirdSecondDown()
secondFirstDown()
firstBasementDown()
basementOpen()
sleep(10)
closeDoors()
x = "dazed"
os.restart()
--3rd floor 1st floor button
else if colors.test(y, colors.gray) == true then
print("Button Detected")
basementFirstUp()
firstSecondUp()
secondThirdUp()
3rdOpen()
sleep(5)
closeDoors()
thirdSecondDown()
secondFirstDown()
1stOpen()
sleep(10)
closeDoors()
firstBasementDown()
x = "dazed"
os.restart()
--3rd floor 2nd button
else if colors.test(y, colors.) == true then
print("Button Detected")
basementFirstUp()
firstSecondUp()
secondThirdUp()
3rdOpen()
sleep(5)
closeDoors()
thirdSecondDown()
2ndOpen()
sleep(10)
closeDoors()
secondFirstDown()
firstBasementDown()
x = "dazed"
os.restart()
end
end
end
end
end
end
end
end
end
end
end
end
end
Edited on 10 October 2012 - 10:24 AM