CommandToServer() problems
by Robert Norris · in Torque Game Engine · 09/19/2005 (7:34 am) · 4 replies
Hi,
i've implemented some stuff for my game using the commandToServer command. When i test my application on my local machine, everything is working fine, but when i test it with a client connection to my gameserver, it doesn't work. In other words, calls like these
call this function in my command.cs file
but calls like these
don't call
Any suggestion why the second kind of call doesn't work when the client is connected to the game server? I'm sure, it's a simple problem, but i don't see it ;)
i've implemented some stuff for my game using the commandToServer command. When i test my application on my local machine, everything is working fine, but when i test it with a client connection to my gameserver, it doesn't work. In other words, calls like these
moveMap.bindCmd( keyboard, 1, "CommandToServer(\'UsePowerUp\', \"1\");", "" ); moveMap.bindCmd( keyboard, 2, "CommandToServer(\'UsePowerUp\', \"2\");", "" );
call this function in my command.cs file
function ServerCmdUsePowerUp(%client, %number){
...
}but calls like these
function TimeLoop::onUse(%this,%obj)
{
...
CommandToServer('TimeLoopActivation', %obj.client, %obj);
...
}don't call
function ServerCmdTimeLoopActivation(%client, %obj){
...
}Any suggestion why the second kind of call doesn't work when the client is connected to the game server? I'm sure, it's a simple problem, but i don't see it ;)
About the author
#2
I must also say, that i don't get any error messages... that's the reason why i don't know anything about the problem.
UPDATE:
i've changed the parameters of the second call, but it only works when i test it local...
command.cs
timeloop.cs
The echo in command.cs never appears when the client is connected to the dedicated server.
09/19/2005 (11:08 am)
Yes. Both examples, where the CommandToServer() call appears, are in seperate files, but could this be a problem? And Note: The first example works when the client is connected to a dedicated gameserver... perhaps there is a problem with the "CommandToServer('TimeLoopActivation', %obj.client, %obj);" call in the secon example? ... the parameter %obj.client isn't really necessary... i will check this tomorrow if no one has another hint :)I must also say, that i don't get any error messages... that's the reason why i don't know anything about the problem.
UPDATE:
i've changed the parameters of the second call, but it only works when i test it local...
command.cs
function ServerCmdTimeLoopActivation(%client){
echo("ServerCmdTimeLoopActivation(%client)");
...
}timeloop.cs
function TimeLoop::onUse(%this,%obj)
{
echo("TimeLoop used ->" @ %obj);
...
CommandToServer('TimeLoopActivation');
...
}The echo in command.cs never appears when the client is connected to the dedicated server.
#3
09/19/2005 (1:33 pm)
Are your serverCmd's in the "server" directory? That would explain why they don't work client-only.
#4
As i waked up today i thought about the meaning of a CommandToServer function... when i call "CommandToServer('TimeLoopActivation');" i'm already on serverSide, so using the CommandToServer method makes no sense :)
But why does it work on my local machine? Anyway... i will change my code now.
UPDATE:
I've changed my code and all works fine now :D
Thank you so much for your replies!
best regards
rob
09/19/2005 (11:16 pm)
Yes ;) As i waked up today i thought about the meaning of a CommandToServer function... when i call "CommandToServer('TimeLoopActivation');" i'm already on serverSide, so using the CommandToServer method makes no sense :)
But why does it work on my local machine? Anyway... i will change my code now.
UPDATE:
I've changed my code and all works fine now :D
Thank you so much for your replies!
best regards
rob
Torque 3D Owner Matthew Langley
Torque
"function ServerCmdTimeLoopActivation(...)" ?