Game Development Community

Server/Client side gameTSCtrl

by Jendrik Posche · in Torque Game Engine · 09/17/2008 (5:04 am) · 1 replies

Hey all,

I have a problem with this gametsctrl class. I added a boolean to this class to determine that a certain key has been pressed/released. However this boolean is only known on the server side and not client side.

Now there is no such thing as packupate/unpackupdate and I also tried to :
commandToClient/Server but i get this error message:

NetConnection::serverToGhostId - could not find specified object.

I used the following code:

commandToServer('BPressedServer', %val);

function serverCmdBPressedServer(%client, %val){

%guiID = %client.getGhostID( PlayGui ) ;
commandToClient(%client, 'BPressedClient', %guiID, %val);
}

function clientCmdBPressedClient(%guiid, %val){

%gui = ServerConnection.resolveGhostID( %guiid );
%gui.fooKey( %val );
}

Any idea why I get this error and how can I solve this problem?

Greets

#1
09/17/2008 (3:40 pm)
So the server knows the state the button should be in and needs to tell the client to set it to that state? Well if you know the client for which this applies, maybe something like this...
commandToClient( %client, 'SetBool', %bool );

// on the client side
function SetBool( %bool )
{
   YourCtrl.foo = %bool;
}