CommandToServer not working
by Jonathon Stevens · in Torque Game Engine · 02/02/2006 (11:28 am) · 5 replies
Friends,
I can't seem to get a commandToServer call to work. Here is a bit from my server/scripts/commands.cs:
Here is a a bit from my client/scripts/client_commands.cs:
I did exec the client_commands and both files are showing in the console.log as compiling and loading without error or warning. I am able to step through to the part where it calls the server just fine. I even am able to step past it without anything showing up in the console.log or my output windows if i execute something past the commandToServer.
It never runs the actual NewFunction function. I didn't add anything for NewFunction anywhere else but in those two spots that you see above. Is there somewhere else I should be declaring it or something?
I can't seem to get a commandToServer call to work. Here is a bit from my server/scripts/commands.cs:
function serverCmdNewFunction(%client)
{
echo("I MAD IT YOU GOOFY BASTID!!!");
}Here is a a bit from my client/scripts/client_commands.cs:
commandToServer('NewFunction');I did exec the client_commands and both files are showing in the console.log as compiling and loading without error or warning. I am able to step through to the part where it calls the server just fine. I even am able to step past it without anything showing up in the console.log or my output windows if i execute something past the commandToServer.
It never runs the actual NewFunction function. I didn't add anything for NewFunction anywhere else but in those two spots that you see above. Is there somewhere else I should be declaring it or something?
About the author
With a few casual games under his belt as CEO of Last Straw Productions, Jonathon created the increasingly popular Indie MMO Game Developers Conference.
#2
you can test it from the console, too.
eg just enter into the console:
are you sure that server/scripts/commands.cs is compiling correctly ?
if you've got a syntax error elsewhere in the file, it will use the last good compile.
- delete server/scripts/commands.dso
and run again, checking that the .dso gets recreated.
also of course check the console for error messages.
02/02/2006 (11:36 am)
Hmm, looks pretty correct.you can test it from the console, too.
eg just enter into the console:
commandToServer('NewFunction');are you sure that server/scripts/commands.cs is compiling correctly ?
if you've got a syntax error elsewhere in the file, it will use the last good compile.
- delete server/scripts/commands.dso
and run again, checking that the .dso gets recreated.
also of course check the console for error messages.
#3
so do i need that connected first? I'm trying to do a login system where the client handles most of the work and the server just checks the db for the un/pw and returns something to the client
02/02/2006 (11:39 am)
This part is NOT executing BEFORE i try to do a commandtoserver:%mission = "starter.rpg/data/missions/stronghold.mis";
if ($pref::HostMultiPlayer)
%serverType = "MultiPlayer";
else
%serverType = "SinglePlayer";
createServer(%serverType, %mission);
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs($pref::Player::Name);
%conn.setJoinPassword($pref::Player::Password);
%conn.connectLocal();so do i need that connected first? I'm trying to do a login system where the client handles most of the work and the server just checks the db for the un/pw and returns something to the client
#4
02/02/2006 (5:36 pm)
Once i added the above code, it works fine now! thanks!
#5
02/02/2006 (5:39 pm)
ConnectLocal() seems a bit suspect for a real server/client situation...
Torque 3D Owner Stephen Zepp