This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
NoirVinoCacao's profile picture

[lua][error] For input string: "1stOpen"

Started by NoirVinoCacao, 10 October 2012 - 09:54 AM
NoirVinoCacao #1
Posted 10 October 2012 - 11:54 AM
SpoilerI'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
Kazimir #2
Posted 10 October 2012 - 12:16 PM
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 b_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 b_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 b_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 b_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 b_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 b_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()
    for i = 1, 33 do
        elevatorUp()
    end
end
--moves elevator from 1st to 2nd floor
local function firstSecondUp()
    for i = 1, 8 do
        elevatorUp()
    end
end
--moves elevator from 2nd to third floor
local function secondThirdUp()
    for i = 1, 5 do
        elevatorUp()
    end
end
--moves elevator from third floor to second
local function thirdSecondDown()
    for i = 1, 5 do
        elevatorDown()
    end
end
--moves elevator from second floor to first floor
local function secondFirstDown()
    for i = 1, 8 do
        elevatorDown()
    end
end
--moves elevator from first floor to basement
local function firstBasementDown()
    for i = 1, 33 do
        elevatorDown()
    end
end
--closes all doors
local function closeDoors()
basementClose()
b_1stClose()
b_2ndClose()
b_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)
        b_1stOpen()
        sleep(10)
        closeDoors()
        firstBasementDown()
        x = "dazed"
        os.restart()

--basement 2nd floor button
        elseif colors.test(y, colors.brown) == true then
            print("Button Detected")
            basementOpen()
            sleep(5)
            closeDoors()
            basementFirstUp()
            firstSecondUp()
            sleep(1)
            b_2ndOpen()
            sleep(10)
            closeDoors()
            secondFirstDown()
            firstBasementDown()
            x = "dazed"
            os.restart()

--basement 3rd floor button
        elseif colors.test(y, colors.red) == true then
            print("Button Detected")
            basementOpen()
            sleep(5)
            closeDoors()
            basementFirstUp()
            firstSecondUp()
            secondThirdUp()
            sleep(1)
            b_3rdOpen()
            sleep(10)
            closeDoors()
            thirdSecondDown()
            secondFirstDown()
            firstBasementDown()
            x = "dazed"
            os.restart()

--1st floor basement button
        elseif colors.test(y, colors.) == true then
            print("Button Detected")
            basementFirstUp()
            b_1stOpen()
            sleep(5)
            closeDoors()
            firstBasementDown()
            basementOpen()
            sleep(10)
            closeDoors()
            x = "dazed"
            os.restart()

--1st floor 2nd floor button
        elseif colors.test(y, colors.orange) == true then
            print("Button Detected")
            basementFirstUp()
            b_1stOpen()
            sleep(5)
            closeDoors()
            firstSecondUp()
            b_2ndOpen()
            sleep(10)
            closeDoors()
            secondFirstDown()
            firstBasementDown()
            x = "dazed"
            os.restart()

--1st floor 3rd floor button
        elseif colors.test(y, colors.magenta) == true then
            print("Button Detected")
            basementFirstUp()
            b_1stOpen()
            sleep(5)
            closeDoors()
            firstSecondUp()
            secondThirdUp()
            b_3rdOpen()
            sleep(10)
            closeDoors()
            thirdSecondDown()
            secondFirstDown()
            firstBasementDown()
            x = "dazed"
            os.restart()

--second floor basement button
        elseif colors.test(y, colors.yellow) == true then
            print("Button Detected")
            basementFirstUp()
            firstSecondUp()
            b_2ndOpen()
            sleep(5)
            closeDoors()
            secondFirstDown()
            firstBasementDown()
            BasementOpen()
            sleep(10)
            closeDoors()
            x = "dazed"
            os.restart()

--second floor first floor button
        elseif colors.test(y, colors.lime) == true then
            print("Button Detected")
            basementFirstUp()
            firstSecondUp()
            b_2ndOpen()
            sleep(5)
            closeDoors()
            secondFirstDown()
            b_1stOpen()
            sleep(10)
            closeDoors()
            firstBasementDown()
            x = "dazed"
            os.restart()

--second floor third floor button
        elseif colors.test(y, colors.purple) == true then
            print("Button Detected")
            basementFirstUp()
            firstSecondUp()
            b_2ndOpen()
            sleep(5)
            closeDoors()
            secondThirdUp()
            b_3rdOpen()
            sleep(10)
            closeDoors()
            thirdSecondDown()
            secondFirstDown()
            firstBasementDown()
            x = "dazed"
            os.restart()

--3rd floor basement button
        elseif colors.test(y, colors.white) == true then
            print("Button Detected")
            basementFirstUp()
            firstSecondUp()
            secondThirdUp()
            b_3rdOpen()
            sleep(5)
            closeDoors()
            thirdSecondDown()
            secondFirstDown()
            firstBasementDown()
            basementOpen()
            sleep(10)
            closeDoors()
            x = "dazed"
            os.restart()

--3rd floor 1st floor button
        elseif colors.test(y, colors.gray) == true then
            print("Button Detected")
            basementFirstUp()
            firstSecondUp()
            secondThirdUp()
            b_3rdOpen()
            sleep(5)
            closeDoors()
            thirdSecondDown()
            secondFirstDown()
            b_1stOpen()
            sleep(10)
            closeDoors()
            firstBasementDown()
            x = "dazed"
            os.restart()

--3rd floor 2nd button
        elseif colors.test(y, colors.) == true then
            print("Button Detected")
            basementFirstUp()
            firstSecondUp()
            secondThirdUp()
            b_3rdOpen()
            sleep(5)
            closeDoors()
            thirdSecondDown()
            b_2ndOpen()
            sleep(10)
            closeDoors()
            secondFirstDown()
            firstBasementDown()
            x = "dazed"
            os.restart()
end
end