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

BIOS:14: error

Started by BrandonHerman, 16 January 2017 - 09:42 PM
BrandonHerman #1
Posted 16 January 2017 - 10:42 PM
Brand new to computercraft, trying to make a locked door with computers. The code I put in was
while true do
term.clear()
term.setCursorPos(1, 1)
print("Please Enter Password:")
input = read("*")
if input == "Password" then
redstone.setOutput("back", true)
sleep(2)
redstone.setOutput("back", false)
end
end
and when I put in startup, i get an error saying

BIOS:14: [String "startup"]:4: ')' Expected

Anyone know why?
Lyqyd #2
Posted 17 January 2017 - 04:07 AM
Moved to Ask a Pro.
Bomb Bloke #3
Posted 17 January 2017 - 05:37 AM
The code you've provided won't produce that error. Double check that the file you're running contains the code you think it does - for example, consider whether any floppy disk drives are attached to the computer.
houseofkraft #4
Posted 20 January 2017 - 10:43 PM
First of all, you should indent your code and use code blocks
The Indented Code

[url="http://www.computercraft.info/wiki/Loops#The_While_loop"]while[/url] true do
	[url="http://www.computercraft.info/wiki/Term_(API)"]term[/url].[url="http://www.computercraft.info/wiki/Term.clear"]clear[/url]()
	[url="http://www.computercraft.info/wiki/Term_(API)"]term[/url].[url="http://www.computercraft.info/wiki/Term.setCursorPos"]setCursorPos[/url](1, 1)
	[url="http://www.computercraft.info/wiki/Print"]print[/url]("Please Enter Password:")
	input = [url="http://www.computercraft.info/wiki/Read"]read[/url]("*")
	if input == "Password" then
	  [url="http://www.computercraft.info/wiki/Redstone_(API)"]redstone[/url].[url="http://www.computercraft.info/wiki/Redstone.setOutput"]setOutput[/url]("back", true)
	  [url="http://www.computercraft.info/wiki/Os.sleep"]sleep[/url](2)
	  [url="http://www.computercraft.info/wiki/Redstone_(API)"]redstone[/url].[url="http://www.computercraft.info/wiki/Redstone.setOutput"]setOutput[/url]("back", false)
   end
end

EDIT: The indented code is a little derped.

Second of all, like Bomb Bloke said above. The code shouldn't produce any error.
Edited on 20 January 2017 - 09:44 PM
Dragon53535 #5
Posted 21 January 2017 - 07:46 AM
Generally we don't need the links to the functions, many of us have a nice understanding of the functions provided through CC so we know what they do. If we don't, it's easy to google. Like has been said above, indentation is a nice programming practice to use as it allows you to spot certain issues easier, as well as know the extent of certain scopes. In the case of your code here, to reiterate what was said, it cannot produce that error with what you've provided here, perhaps the code on the computer is one or two characters off.