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

[Solved] bios:338; [string "startup"]:9: ´<name>´ exected

Started by TheRavenBlue, 13 July 2013 - 02:46 AM
TheRavenBlue #1
Posted 13 July 2013 - 04:46 AM
just at the title says i get that error when i reboot my computer with this code in startup:


	term.clear()
	term.setCursorPos(1,1)
	os.pullEvent = os.pullEventRaw
	
	password = "Base"
	masterpassword = "Secret"
	
	print("B: Close S: Open")
	write: ("Password:")
	local input = read("*")
	
	if input == (password) then
	print("Door Closing Please Wait...")
	redstone.setOutput("bottom",true)
	sleep(5)
	redstone.setOutput("bottom",true)
	sleep(5)
	redstone.setOutput("bottom",true)
	sleep(5)
	os.shutdown()
	
	elseif input == (masterpassword) then
	print("Door Opening Please Wait...")
	redstone.setOutput("back",true)
	sleep(5)
	redstone.setOutput("back",true)
	sleep(5)
	redstone.setOutput("back",true)
	os.shutdown()
	
	else
	
	print("Unknown Password, Check Spelling")
	sleep(5)
	os.shutdown()
	
	end


where did i do wrong?
TheOddByte #2
Posted 13 July 2013 - 05:12 AM
At line 9 you wrote

write:("Password: ")

You should just remove the":" just after write

write("Password: ")

And also… Use a loop instead of using 'os.shutdown' since I'm guessing you are using this as a startup file…
And in the beginning of the loop you could use a clear function..

Here's some functions you may get some use for


function clear()
  term.clear()
    term.setCursorPos(1,1)
end

function drawAt(x,y,text)
  term.setCursorPos(x,y)
    write(text)

Grim Reaper #3
Posted 13 July 2013 - 05:13 AM
You've put a colon next to 'write' on the 9th line. The interpreter thinks that you're trying to index 'write' as a table and is expecting the name of a function to pass 'write' to as a parameter along with "Password: ".
Kingdaro #4
Posted 13 July 2013 - 05:48 AM
For the record,

redstone.setOutput("bottom",true)
sleep(5)
redstone.setOutput("bottom",true)
sleep(5)
redstone.setOutput("bottom",true)
sleep(5)

Is the same as:

redstone.setOutput("bottom",true)
sleep(15)
TheRavenBlue #5
Posted 13 July 2013 - 06:18 AM
Thanks for all replyes!