Game Development Community

Chapter 6 - Direct Messaging

by Chad Ramos · in Torque Game Engine · 10/25/2006 (7:17 am) · 1 replies

**Let it be know, I do have a dedicated server up and running with clients connecting**

At the very start of the chapter there is a section titled "Direct Messaging" which basically goes over commandToClient and commandToServer. I am trying to implement this section into my code but have run into a few problems. The first thing we are asked to do is set up a key binding in presetkeys.cs like so....
function SendMacro(%Val) 
{
   Echo("Test T");	
   switch$ (%Val)
   {
     case 1:
         Echo("Test T Case1");
        %msg = "Hello World!";
     case 2:
         Echo("Test T Case2");
         %msg = "Hello? Is this thing on?";
     default:
         Echo("Test T Case3");
         %msg = "Nevermind!";
   }
   CommandToServer('TellEveryone', %msg);
   Echo("Test T END");
}
PlayerKeymap.Bind(keyboard, t, SendMacro );
This works fine and I can see my debug statements in the console.

We are then asked to go over to the server side and add some code to server/server.cs. This is what I added....
function ServerCmdTellEveryone(%client,%msg) 
{
    Echo("Tell Everyone on server");
    TellAll(%client,%msg);
}

function TellAll( %sender, %msg) 
{
   Echo("TellALL");
   %count = ClientGroup.getCount();
   for ( %i = 0; %i < %count; %i++ )
   {
     Echo("TellALL for loop");
     %client = ClientGroup.getObject(%i);
     commandToClient(%client,'TellMessage', %sender, %msg);
    }
}

Now when I get a client up and running on a server and hit my keybinding in game I get this message on the server console....

serverCmdTellEveryone: Unkown command;

It seems like the message is being passed properly from the client but is not being handle correctly from by the server.

Also, we are asked to add one final message back on the client side. Which is...
function clientCmdTellMessage(%sender, %msgString)
{
 // blah blah blah
}
Am I correct in assuming this is suppose to go into client/client.cs

Thanks

Chad

#1
10/28/2006 (5:39 am)
You have an capital S in servertellcmd ... i think ive heard this thread somewhere else