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

Error bios:206: [string "startup"]:37: '=' expected

Started by JdKnight85, 27 November 2012 - 10:00 AM
JdKnight85 #1
Posted 27 November 2012 - 11:00 AM
I'm coding a program for a password lock door that has a manual override and a master password that bypasses security so I can fully use the terminal. I have no idea what is wrong. Any attempt to help will be appreciated. Here is my code:

term.clear()
term.setCursorPos(1,1)
os.pullEvent = os.pullEventRaw

password = "1234"
masterpassword = "4321"
manualoverride = "5678"

print("Door Status: Locked")
write "Please Enter Password: "
local input = read("*")

if input == (password) then
print("Password Accepted - Access Granted")
redstone.setOutput("back",true)
sleep(7)
os.shutdown

elseif == (masterpassword) then
print("Processing…")
sleep(1)
print("Terminal Is Now Unlocked")
sleep(2)
print("Welcome Back, JdKnight85")

elseif input = (manualoverride) then
print("Override Accepted")
redstone.setOutput("back",true)

else
print("Password Incorrect")
sleep(2)
print("Rebooting…")
sleep(1)
os.reboot

end





Line 37 is "end". Id on't understand why thats wrong. Aren't you supposed to always put "end"
KaoS #2
Posted 27 November 2012 - 11:12 AM
os.shutdown and os.reboot are functions and should be os.shutdown() and os.reboot()
JdKnight85 #3
Posted 27 November 2012 - 11:21 AM
Thank you, that fixed the first error, but now it is telling me "startup:9: attempt to call nil"
KaoS #4
Posted 27 November 2012 - 12:56 PM
you must have misspelt one of the functions in your actual code. most likely the print command. that error is caused when you try to call something (use as a function) that is not actually a function. example

local myvar='mystring'
myvar('myparam')

would throw the error: "attempt to call string" because myvar is not a function… perhaps you accidentally used prit("Door Status: Locked") or something. the only other thing that could cause this is if you have overwritten a function by accidentally using it as a variable. for example


local oFile=io.open('stored_info','r')
read=oFile:read()
oFile:close()

the above code would work perfectly except that now I have overwritten the read command with whatever is in the file 'stored_info'. it is a mistake I make fairly often actually, just be careful
remiX #5
Posted 27 November 2012 - 01:22 PM
And your last elseif looks like this:

elseif input = (manualoverride) then[/code
should have two =
KaoS #6
Posted 27 November 2012 - 01:25 PM
ahhhh there we go, can't believe I missed that.nice one remiX
JdKnight85 #7
Posted 27 November 2012 - 02:16 PM
Thank you so much for everything. I used a capital p in print by mistake. everything works fine now. I really appreciate the help.