Game Development Community

Has anyone else ever got this error?

by Tasty Green Pees :-, · in Torque Game Engine · 02/21/2006 (2:18 pm) · 7 replies

Can anyone explain why I keep getting the error

Mapping string: playWaveAnimation to index: 3
serverCmdplayWaveAnimation: Unknown command.

As far as i can see everything is in order.

In the default.bind.cs file I have this...
moveMap.bindCmd(keyboard, "ctrl w", "commandToServer('playWaveAnimation',\"wave\");", "");

In player.cs I've added the following...
function Player::playWaveAnimation(%this, %anim)
{
	%this.setActionThread("celwave");
}

and in data/shapes/player/player.cs is have:
...
sequence27 = "./player_celwave.dsq celwave";
...

shouldn't this work?

#1
02/21/2006 (2:57 pm)
You need a

function serverCmdplayWaveAnimation(%client, %animation)
{
   %client.player.playWaveAnimation(%animation);
}
#2
02/21/2006 (6:48 pm)
I see what you're doing matt. tried it but still getting the same error
#3
02/21/2006 (7:10 pm)
Actually Matt has a minor typo as well--it should be look like this overall:

moveMap.bindCmd(keyboard, "ctrl w", "commandToServer('playCel',\"wave\");", "");

and
function serverCmdPlayCel(%client,%anim)
{
   if (isObject(%client.player))
      %client.player.playCelAnimation(%anim);
}

--and it already exists in Torque 1.4 starter.fps. You shouldn't have to change a thing--just load up starter.fps in Torque 1.4 and hit ctrl-w.

Regarding commandToServer, here's the general syntax:

The first argument you send is the 'tag' of the command. On the server side, to properly catch this command, you need to have a script function (no namespace, just the function name) that has a stem (first set of words) that is "serverCmd", followed immediately by the tag:

function serverCmdPlayCel(%this, %anim)
{
...
}

This would correspond to:

moveMap.bindCmd(keyboard, "ctrl w", "commandToServer('playCel',\"wave\");", "");
#4
02/21/2006 (8:22 pm)
Argh!... it keeps giving me this:

Mapping string: playCel to index: 3
tutorial.base/server/player.cs (665): Unknown command playCelAnimation.
  Object (1333) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
#5
02/21/2006 (8:26 pm)
Scratch that! It worked!

I copied your code just changed "playCelAnimation" to "setActionThread".

Just got one more question, Stephen, can you please explain this line:
if (isObject(%client.player))
#6
02/21/2006 (9:27 pm)
Thats just validating that %client.player is an object and not just a number.
%client.player holds the numerical ID of the Player object the client is using.
If the player were destroyed, and client.player not cleared out, then .player would still be the same numerical value, it just isn't pointing to anything vaid.

Its how you get warnings/errors in console that read something like this:
Cant find object (1238) attempt to call function doSomething();

isObject() just does a check first to keep stuff like that from poping up. Useful for things that are under play control or scheduled events, as players die, and the id isn't valid anymore.
#7
02/22/2006 (3:34 am)
Thanks you, Sebastien.