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

bios:338: [string "startup"]:20: syntax error

Started by K9_Illya, 09 February 2013 - 09:34 PM
K9_Illya #1
Posted 09 February 2013 - 10:34 PM
Hey Guys Im Having a little trouble with my program
Im Getting a "bios:338: [string "startup"]:20: syntax error" with the following code:


rednet.open("top")
while true do
term.clear()
term.setCursorPos(2,1)
write("Please Enter The Password")
term.setCursorPos(2,2)
write("Password: ")
password = read("*")
if password == "minecraft" then
term.clear()
term.setCursorPos(2,1)
write("Welcome Illya")
term.setCursorPos(2,2)
write("Please Enter A Command")
term.setCursorPos(2,3)
write("Command: ")
command = read()
if command == "Open" then
id, rednet.broadcast("open")
term.setCursorPos(2,4)
write("Opened")
end
if command == "Close" then
id, rednet.broadcast("close")
term.setCursorPos(2,4)
write("Closed")
end
if not password == "minecraft" then
term.clear()
term.setCursorPos(2,1)
write("ACCESS DENIED")
term.setCursorPos(2,2)
write("INITIATING LOCKDOWN SEQUENCE")
sleep(60)
end
end

The Error is on Line 20 according to Minecraft:
[img]C:\Users\Sebel\Desktop\Untitled.png[/img]
Thanks for the help
GravityScore #2
Posted 09 February 2013 - 11:09 PM
Hey Guys Im Having a little trouble with my program
Im Getting a "bios:338: [string "startup"]:20: syntax error" with the following code:

–snip–

Thanks for the help

Shouldn't you put this in its own topic? I think hijacking people's threads is illegal…

Anyway, to solve the issue now and to not waste time, etc… Solution:

The code:

id, rednet.broadcast("open")
You declared the variable id wrong. Variables are declared using the = sign to assign a value to them, like:

variable_name = "hello"
-- Or in your case:
rednet.broadcast("open")
id, msg = rednet.receive(1)

If you get rid of the "id," before rednet.broadcast, it should work, like:

rednet.broadcast("open")

Remember to apply this to all 3 of your rednet.broadcasts.