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

bios:206: [string "startup"]:13: '=' expected

Started by rjqg327, 28 June 2012 - 01:46 AM
rjqg327 #1
Posted 28 June 2012 - 03:46 AM
i am running this code

function start()
print("password required to open")
a = read()
if a == "password" then
print ("accewss Granted")
rs.setOutput("right.true)
else
print ("access denied")
rs.setOutput("left", true)
sleep(3)
os.shutdown

end

what am i doing wrong? i gives me a bios:206: [string "startup"]:13: '=' expected when i start up please help!
Bossman201 #2
Posted 28 June 2012 - 04:06 AM
After formatting your code, your error wasn't hard to track down:
function start()
 print("password required to open")
 a = read()
 if a == "password" then
  print ("Access Granted") --Minor spelling error
  rs.setOutput("right", true) --Corrected code, unfinished string, nil function call: rs.setOutput("right", true). I did not even notice this until posting it in the forum, as the rest of the program became green. right.true is not a function, you put a period instead of a comma. Lastly, forgot to close the string, "right", by adding a quotation mark at the end.
 else
  print ("Access Denied") -- Capitalized words
  rs.setOutput("left", true)
  sleep(3)
  os.shutdown
 end --Forgot to close 'if' statement, or function. In short, you left out one 'end'.
end

Also, since you defined this as a function, you'll need to add:
start()
At the end of all the code to call the function or else after the computer starts up, it'll just go to the shell and not do anything.
Lyqyd #3
Posted 28 June 2012 - 05:34 AM
os.shutdown() instead of os.shutdown.