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

Locked door code is wrong? help please

Started by potatoes, 07 May 2012 - 12:18 AM
potatoes #1
Posted 07 May 2012 - 02:18 AM
hey, in computercraft 1.3.1 I'm trying to make a password protected door using the same code on http://computercraft.info/wiki/index.php?title=Making_a_Password_Protected_Door but I always seem to get the same error, even when using different versions of this code.

I'm using this without the –'s:

local side = "left" – Change left to whatever side your door / redstone is on, E.G: left, right, front, back, bottom, top. Be sure to leave the "s around it, though
local password = "bacon" – Change bacon to what you want your password to be. Be sure to leave the "s around it, though
local opentime = 5 – Change 5 to how long (in seconds) you want the redstone current to be on. Don't put "s around it, though
term.clear() – Clears the screen
term.setCursorPos(1,1) – Fixes the cursor position
write("Password: ") – Prints 'Password: ' to the screen
local input = read("*") – Makes the variable 'input' have the contents of what the user types in, the "*" part sensors out the password
if input == (password) then – Checks if the user inputted the correct password
term.clear() – Already explained up top
term.setCursorPos(1,1)
print("Password correct!") – Prints 'Password correct!' to the screen
rs.setOutput(side,true) – Output a redstone current to the side you specified
sleep(opentime) – Wait the amount of seconds you specifed, then..
rs.setOutput(side,false) – Stop outputting a redstone current
os.reboot() – Reboot the computer, reopening the lock
else – Checks if the user didn't input the correct password
term.clear()
term.setCursorPos(1,1)
print("Password incorrect!") – Prints 'Password incorrect!' to the screen
sleep(2) – Waits 2 seconds
os.reboot() – Reboot the computer, reopening the lock
end
but I always get this error:

bios:206: [string "Startup"] :18: '=' Expected
>

which if i'm correct, means it expects me to put a = variable at the end?
thanks!
Advert #2
Posted 07 May 2012 - 02:29 AM
Use code tags.

Is this the exact code you're using, or did you just copy paste this from somewhere else? I think you have a typo on line 18, most likely missing () to a function call.
potatoes #3
Posted 07 May 2012 - 02:37 AM
yes, I copied each line of code line for line, I wasn't missing a () function. I checked for typos, there were none.
Advert #4
Posted 07 May 2012 - 02:41 AM
If there were no typos, the code should be running fine. Check again, or take screenshots of your code and post it.
darkdave23 #5
Posted 07 May 2012 - 04:32 AM
Well i tested that code and it works perfectly on my computer.