Posted 13 March 2012 - 11:00 PM
I have a computer that I have wired up to a number of doors. I would like to open these doors with commands from the computer. However, I can't seem to get it working. Here's the code:
If you could not tell (this is literally the first program I've ever made, I likely got nothing right :mellow:/>/> ), the goal of the program is to ask the user which door to open, and have them enter a name of the door. Then, it will check the name of the door, and send a redstone signal to that door, cutting the other redstone signals. I currently only have two "Vaults" (666, with a Nether Portal, and 101, my bedroom), but will have two more later (unsure of how I'll number them, but they'll use the bottom and back redstone outputs). Vault 666 is to the right of the computer and Vault 101 is to the left. I've checked the wiring using the "redset" command, so I know that the doors will open with the proper redstone outputs. However, when I run the program (The name of the program is called "Open", btw), I get this error message:
Not sure what this means or what I'm doing wrong. Could someone help me figure out this error message and/or help cleanup my code?
print ("Hello")
print ("Where would you like to go today?")
door = io.read()
if door == "Vault 666" then
redstone.setOutput("back", false)
redstone.setOutput("left", false)
redstone.setOutput("right", true)
print ("Opening doorway to Vault 666...")
elseif door == "Vault 101" then
redstone.setOutput("back", false)
redstone.setOutput("right", false)
redstone.setOutput("left", true)
print ("Opening doorway to Vault 101...")
else
print ("Invalid entry.")
end
end
If you could not tell (this is literally the first program I've ever made, I likely got nothing right :mellow:/>/> ), the goal of the program is to ask the user which door to open, and have them enter a name of the door. Then, it will check the name of the door, and send a redstone signal to that door, cutting the other redstone signals. I currently only have two "Vaults" (666, with a Nether Portal, and 101, my bedroom), but will have two more later (unsure of how I'll number them, but they'll use the bottom and back redstone outputs). Vault 666 is to the right of the computer and Vault 101 is to the left. I've checked the wiring using the "redset" command, so I know that the doors will open with the proper redstone outputs. However, when I run the program (The name of the program is called "Open", btw), I get this error message:
> Open
bios:206: [string "Open"]:17: '<eof>' expected
Not sure what this means or what I'm doing wrong. Could someone help me figure out this error message and/or help cleanup my code?