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

[Error] Login Server Errors

Started by blackplage, 16 August 2012 - 12:12 AM
blackplage #1
Posted 16 August 2012 - 02:12 AM
Im copying the code (and checking it) on the wiki to make a login system for multiple users

in the end i get this error

bios:206: [string "Server":19: '=' expected

can someone tell me what this means?

Oh, and my coding:
[spoiler]os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print("This is a Server Computer!")
print("There is no user interaction here!")
print("Use one of the other computers!")
local firstCycle = true
local validSender = false
local modemSide = "top"

users = { }
users = { blackplage, SwatChan, Guest }
passwords = { }
passwords = { blackplage, SwatChan, Guest }
senders = { }
senders = { 85, 87, 88, 89, 90 }
fuction bootUp()
rednet.open(modemSide)
end
while true do
validSender = false
if firstCycle then
bootUp()
end
senderId, message, distance = rednet.receive()
for i,v in pairs(senders) do
if v == senderId then
validSender = true
break
end
end
if validSender then
for k,v in pairs(users) do
if message == k then
valid = true
password = passwords[v]
else
valid = false
end
end
if valid then
rednet.send(senderId. password)
else
rednet.send(senderId, "Not Valid'0
end
end
end
Cranium #2
Posted 16 August 2012 - 02:20 AM
I think you forgot the comparison value for firstCycle. You are not comparing it to anything.
inventor2514 #3
Posted 16 August 2012 - 03:12 AM
fuction bootUp() should be function bootUp(); just a simple typo.
blackplage #4
Posted 16 August 2012 - 03:36 AM
fuction bootUp() should be function bootUp(); just a simple typo.
I double checked that with what i have typed out on the server computer and its correct there, i just messed up when i copied it from minecraft to here :I
Lettuce #5
Posted 16 August 2012 - 03:47 AM
rednet.open(modemSide) is invalid. "left" "right" "top" or "back" must be declared, and must be in quotes. Effectively, that computer doesn't even know what a "modem" is, let alone what side it's on. If you're about to say "I do declare what side it's on in the minecraft code," then give us the real code, or we're useless on this end.
Luanub #6
Posted 16 August 2012 - 03:54 AM
Syntax looks good, are you still getting the error?

The only thing I notice with the code is you dont need the commented lines below

users = { } -- this is redundant remove it, you are declaring it on the next line
users = { blackplage, SwatChan, Guest }
passwords = { } -- this is redundant remove it, you are declaring it on the next line
passwords = { blackplage, SwatChan, Guest }
senders = { } -- this is redundant remove it, you are declaring it on the next line
senders = { 85, 87, 88, 89, 90 }

rednet.open(modemSide) is invalid. "left" "right" "top" or "back" must be declared, and must be in quotes. Effectively, that computer doesn't even know what a "modem" is, let alone what side it's on. If you're about to say "I do declare what side it's on in the minecraft code," then give us the real code, or we're useless on this end.

He has this near the top. It should work.


local modemSide = "top"
Lettuce #7
Posted 16 August 2012 - 04:17 AM
How about near the bottom,

rednet.send(senderId, "Not Valid'0
you used a single quote mark instead of a double, leaving an incomplete string, a seemingly random 0, and you forgot to close your parenthesis. That'll break a program.

ALSO:

I've never used string variables, luanub. Do you have to put quotes around the variable? Because I know if you declare a side it's:

rednet.open("top")

with quotes.
inventor2514 #8
Posted 16 August 2012 - 04:50 AM
Try adding quotes around the users and passwords table elements.

users = { "blackplage", "SwatChan", "Guest" }
passwords = { "blackplage", "SwatChan", "Guest" }
Luanub #9
Posted 16 August 2012 - 05:05 AM
ALSO:

I've never used string variables, luanub. Do you have to put quotes around the variable? Because I know if you declare a side it's:

rednet.open("top")

with quotes.

No you should never have to put quotes around a var, only strings. I usually do this for my rednet, and sometimes bundled cables.

local sSide = "right"
rednet.open(sSide)

or

rs.setBundledOutput(sSide, colors.orange)

It looks inventor2514 found the issue. Without having the quotes around the strings in the table it is looking for vars with those names instead of doing the string comparison.
ardera #10
Posted 16 August 2012 - 09:30 AM
EDIT: Sorry, didn't read the 5th post…