Game Development Community

scoreboard not registering on LAN client

by Donald Teal · in Torque 3D Professional · 07/15/2010 (5:24 am) · 1 replies

I am using T3D1.0.1 with UAiSK1.4 w/teams
had this in 1.1b and worked fine but sense reverting back to 1.0.1 my scoreboard no longer
lists anything on the clients connected to the host in a LAN. Scoreboard stays blank and the
clients don't show up on the host. Host sees himself and the bots but no connected clients.

in scripts/client/playerList.cs I have
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Hook into the client update messages to maintain our player list and scores.
//-----------------------------------------------------------------------------

addMessageCallback('MsgClientJoin', handleClientJoin);
addMessageCallback('MsgClientDrop', handleClientDrop);
addMessageCallback('MsgClientScoreChanged', handleClientScoreChanged);
addMessageCallback('MsgClientJoinTeam', handleClientJoinTeam);

function handleClientJoin(%msgType, %msgString, %clientName, %clientId, %guid,
      %score, %kills, %deaths, %isAI, %isAdmin, %isSuperAdmin)
{
   PlayerListGui.update(%clientId, detag(%clientName), %isSuperAdmin, %isAdmin,
   %isAI, %score, %kills, %deaths);
}

function handleClientDrop(%msgType, %msgString, %clientName, %clientId)
{
   PlayerListGui.remove(%clientId);
}

function handleClientScoreChanged(%msgType, %msgString, %score, %kills, %deaths, %clientId)
{
   PlayerListGui.updateScore(%clientId, %score, %kills, %deaths);
   echo(" score:"@%score@" kills:"@%kills@" deaths:"@%deaths);
}

function handleClientJoinTeam(%msgType, %msgstring, %clientname, %team, %clientId, %guid,  
       %score, %kills, %deaths, %isAI, %isAdmin, %isSuperAdmin )  
{  
   error("Join Team: ClientID = " @ %clientId @ " Team = " @%team@ " PlayerName = " @%clientname);  
   PlayerListGui.updateTeam(detag(%clientname),%clientId, %team, %score, %kills, %deaths);  
} 
 
// ----------------------------------------------------------------------------
// GUI methods
// ----------------------------------------------------------------------------

function PlayerListGui::update(%this,%clientId,%name,%isSuperAdmin,%isAdmin,%isAI,%score, %kills, %deaths)
{
   // Build the row to display.  The name can have ML control tags,
   // including color and font.  Since we're not using and
   // ML control here, we need to strip them off.
   %tag = %isSuperAdmin? "[Super]":
          (%isAdmin? "[Admin]":
          (%isAI? "[Bot]":
          ""));
   //%text = StripMLControlChars(%name) SPC %tag TAB %score TAB %kills TAB %deaths;
   //UAISK Team: Start
   //Get the out put color for our text, based on what team the play or bot is
   switch(%clientId.team){
      case 1: %color = "\c1";
      case 2: %color = "\c2";
      case 3: %color = "\c3";
      case 4: %color = "\c4";
      case 5: %color = "\c5";
      case 6: %color = "\c6";
      case 7: %color = "\c7";
      case 8: %color = "\c8";
      case 9: %color = "\c9";
      default: %color = "\c1";
   }

   //Display the text in the player list
   %text = %color @ StripMLControlChars(%name) SPC %tag TAB %score TAB %kills TAB %deaths;
   //UAISK Team: End

   if (%clientId.team == 1)
   {
      if (PlayerListGuiList.getRowNumById(%clientId) == -1)
         PlayerListGuiList.addRow(%clientId, %text);
      else
   	      PlayerListGuiList.setRowById(%clientId, %text);
	
         PlayerListGuiList.sortNumerical(1,false);
         PlayerListGuiList.clearSelection();
   }
   else if (%clientId.team == 2)
   {
   	   if (PlayerList2GuiList.getRowNumById(%clientId) == -1)
   	      PlayerList2GuiList.addRow(%clientId, %text);
   	   else
   	      PlayerList2GuiList.setRowById(%clientId, %text);
	
   	      PlayerList2GuiList.sortNumerical(1,false);
   	      PlayerList2GuiList.clearSelection();
   }
}

function PlayerListGui::updateTeam(%this,%clientname,%clientId,%team,%score, %kills, %deaths)
{
  error ("Update Team: PlayerName = " @%clientname @ " ClientID = " @ %clientId @ " Team = " @ %team);

   if (%clientId.team == 1)
   {
      %text = StripMLControlChars(%clientname) TAB %score TAB %kills TAB %deaths;

      if (PlayerListGuiList.getRowNumById(%clientId) == -1)
          PlayerListGuiList.addRow(%clientId, %text);
       
      %textid = PlayerListGuiList.getRowTextById(%clientId);

      PlayerListGuiList.setRowById(%clientId, %textid);

      PlayerListGuiList.sortNumerical(1,false);
      PlayerListGuiList.clearSelection();
			
      PlayerList2GuiList.removeRowById(%clientId);	// Remove from other side // .team
      PlayerList2GuiList.clearSelection();
		
   }

   else if (%clientId.team == 2)
   {
      %text = StripMLControlChars(%clientname) TAB %score TAB %kills TAB %deaths;

      if (PlayerList2GuiList.getRowNumById(%clientId) == -1)
		      PlayerList2GuiList.addRow(%clientId, %text);
	 
      %textid = PlayerList2GuiList.getRowTextById(%clientId);
      PlayerList2GuiList.setRowById(%clientId, %textid);

      PlayerList2GuiList.sortNumerical(1,false);
      PlayerList2GuiList.clearSelection();

      PlayerListGuiList.removeRowById(%clientId);	// Remove from other side // .team
      PlayerListGuiList.clearSelection();
   }
}

function PlayerListGui::updateScore(%this,%clientId,%score, %kills, %deaths)
{
   if (PlayerListGuiList.getRowNumById(%clientId) != -1)
   {
      error ("Updated Score Team1: ClientID = "@%clientID@" Score = "@%score);
   	   %text = PlayerListGuiList.getRowTextById(%clientId);
   	   %text = setField(%text, 1,%score);
   	   %text = setField(%text, 2, %kills);
         %text = setField(%text, 3, %deaths);
      PlayerListGuiList.setRowById(%clientId, %text);

      PlayerListGuiList.sortNumerical(1,false);
      PlayerListGuiList.clearSelection();
   }
   else if (PlayerList2GuiList.getRowNumById(%clientId) != -1)
   {
      error ("Updated Score Team2: ClientID = "@%clientID@" Score = "@%score);
   	   %text = PlayerList2GuiList.getRowTextById(%clientId);
   	   %text = setField(%text, 1,%score);
   	   %text = setField(%text, 2, %kills);
         %text = setField(%text, 3, %deaths);
   	   PlayerList2GuiList.setRowById(%clientId, %text);

      PlayerList2GuiList.sortNumerical(1,false);
      PlayerList2GuiList.clearSelection();
   }
}

function PlayerListGui::remove(%this,%clientId)
{
   PlayerListGuiList.removeRowById(%clientId);
   PlayerList2GuiList.removeRowById(%clientId);
}

function PlayerListGui::toggle(%this)
{
   if (%this.isAwake())
      Canvas.popDialog(%this);
   else
      Canvas.pushDialog(%this);
}

function PlayerListGui::clear(%this)
{
   // Override to clear the list.
   PlayerListGuiList.clear();
   PlayerList2GuiList.clear();
}

function PlayerListGui::zeroScores(%this)
{
   for (%i = 0; %i < PlayerListGuiList.rowCount(); %i++) {
      %text = PlayerListGuiList.getRowText(%i);
      %text = setField(%text,1,"0");
      %text = setField(%text, 2, "0");
      %text = setField(%text, 3, "0");
      PlayerListGuiList.setRowById(PlayerListGuiList.getRowId(%i), %text);
   }
   PlayerListGuiList.clearSelection();
}

any help as to why this is happening would be greatly appreciated.

EDIT: moved all gui functions to playerList.cs instead of having some in both playerList.cs and playerList.gui

#1
11/03/2010 (7:26 pm)
anyone got any ideas on this? now in 1.1 b3 and having problems again with this.