Game Development Community

Connection Variables [Solved]

by Jesse Allen · in Torque 3D Professional · 10/11/2014 (6:01 pm) · 4 replies

I wanted to report this and see if anyone could replicate the problem. What I'm doing is I'm passing variables to the server when the player connects. Up until now, I've had no problems with doing this because I was passing only 2 variables (login and password) to the server. But now, I am adding some additional logic so that a 3rd variable gets passed and the 3rd one won't pass. I've added the variables to the core/server/server.cs and updated the GameConnection::onConnect() in server/GameCore.cs to reflect the changes.

I am sure the scripts are correct otherwise, since if I change the 3rd variable to be passed in 2nd it will be passed fine. Something is preventing me from sending more than 2 variables in addition to the regular variables. For example, the default GameConnectioin::onConnect() looks like this:

function GameConnection::onConnect(%client, %name)
{
...
}

This works:
function GameConnection::onConnect(%client, %name, %param1, %param2)
{
...
}

This doesn't work:
function GameConnection::onConnect(%client, %name, %param1, %param2, %param3)
{
...
}


Any suggestions? I've looked at the source in gameConnection.cpp and it appears that there is an index in place there so theoretically I should be able to add more variables. Is this a bug?

#1
10/11/2014 (6:06 pm)
Jesse,

The first thing I noticed is that param3 should be %parma3, but it may just be a typo when you typed it in here.

function GameConnection::onConnect(%client, %name, %param1, %param2, param3)
#2
10/11/2014 (6:13 pm)
You're right, but unfortunately I just typo'd it here on the forums and not in the game scripts :P Gosh, I wish it would have been that simple. I'll update the original post, thanks for the heads up.
#3
10/11/2014 (6:23 pm)
Alright, I solved it. I'm going to post about it here though because it did take me a bit to track it down. Since we're calling GameConnection::onConnect() in our scripts/server/GameCore.cs I took it for granted that it was actually overwriting the default function in /core. It wasn't.

What you have to do is update the core/scripts/server/clientConnection.cs to reflect the changes as well. This is solved, I'll flag the post as solved and rename it to something easier to find and maybe if someone else has an issue they'll find it later.
#4
10/11/2014 (9:27 pm)
Stock templates! Gotta love 'em.