Game Development Community

Remote Command Error - command must be a tag

by Jon Jorajuria · in Torque Game Engine · 02/04/2006 (4:54 pm) · 5 replies

OK the title is wrong, I fixed that issue, but what am I doing wrong here? The function does not want to work.

Client:
commandtoserver('JoinTeam', %teamid);

Server:
function serverCmdJoinTeam(%client, %teamid)
{
  Game.joinTeam(%teamid);
}

game.cs:

function TDMGame::joinTeam(%game, %this, %teamid)
{
   
   //We only have 2 teams so if team is greater than 2 or less than 0 its invalid.
   if (%teamid > 2 || %teamid < 0) 
      return false;
   //If we already are on that team return. 
   if (%teamid == %this.team.teamId)
      return false;

   %this.leaveTeam();

   if (%teamid == 1)
      %this.team = $Team1; 
   if (%teamid == 2)
      %this.team = $Team2;
   
   MessageAll('MsgClientJoinTeam', '\c2%1 joined the %2 side',
      %this.name,
      %this.team.name,
      %this.team.teamId,
      %this,
      %this.sendGuid,
      %this.score,
      // %this.isAiControlled(),
      %this.isAdmin,
      %this.isSuperAdmin);
      
      echo("JoinTeamThis=" @ %client);
      
    TDMGame::spawnPlayer();
}

Thank you in advanced.

#1
02/04/2006 (5:45 pm)
Are you sure the file with the commandToServer has compiled properly? Posting the section of the console log that shows the error would be handy, too.
#2
02/04/2006 (5:58 pm)
There are no errors, it just never works. However, if you remove %game from "function TDMGame::joinTeam(%game, %this, %teamid)" the function launches but the package sets the %this to %this=game.
#3
02/04/2006 (6:47 pm)
I always put %this first in the argument field. You didn't, don't know if that's the problem... BUT

Even then, to me.. it doesn't look like your functions are named properly for it to work.
You're passing %this as "game" but you have nothing telling TorqueScript where TDMGame is.
#4
02/04/2006 (6:50 pm)
It is part of a larger package.cs file with a Superclass default.cs. The problem is I have to put %game as the first arguement for the whole package thing to work correctly.
#5
02/04/2006 (7:31 pm)
I got it working...thank you.