refreshClientScore

This is the development community to discuss tribes mod coding or to ask questions.

Moderator: Moderators

Post Reply
User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
Posts: 94
Joined: Thu Mar 05, 2009 12:53 pm
Location: Mars

refreshClientScore

Post by Ghost » Wed Dec 18, 2013 1:53 am

So i'm trying to get it to display a players Armor in the tab menu instead of which team they are on. This refreshClientScore function confuses the hell out of me. This is what i'm working with...

Code: Select all

function Game::refreshClientScore(%clientId)
{
   %armor = Player::getArmor(%clientId);
   %team = Client::getTeam(%clientId);
   // objective mission sorts by team first.
   Client::setScore(%clientId, "%n\t%t\t     "      @$personalEnergy[%clientId]@"\t%p\t%l", %clientId.score + (9 - %team) * 10000);
//   Client::setScore(%clientId, "%n\t%t\t  " @ %clientId.score, %clientId.score);
}


I have tried tweaking this dozens of times by adding the %armor variable to no avail. I don't understand %n\t%t\t or "\t%p\t%l", so some help would be appreciated.

User avatar
C--
Sorry....
Posts: 3299
Joined: Thu Apr 06, 2006 2:32 pm

Re: refreshClientScore

Post by C-- » Wed Dec 18, 2013 4:38 pm

replace %t with " "@player::getArmor(%clientId)@" "

where player::getArmor(%clientId) can be replaced with the expression that evaluates to what you want.

You can also use setTeamScoreHeading() and setClientScoreHeading() to modify the table headers for the 2
tables you see in the menu. the hex chars there somehow represent the width of the cell of the table. Probably not, I am not sure...

Code: Select all

setClientScoreHeading("Player Name\t\x78Team\t\xC8Score");
setTeamScoreHeading("Team Name\t\xC8Score");

User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
Posts: 94
Joined: Thu Mar 05, 2009 12:53 pm
Location: Mars

Re: refreshClientScore

Post by Ghost » Fri Dec 20, 2013 1:07 am

Thanks man. How would I go about getting the name of the armor rather than the shape file though? Right now it says larmor instead of Light Armor.

User avatar
C--
Sorry....
Posts: 3299
Joined: Thu Apr 06, 2006 2:32 pm

Re: refreshClientScore

Post by C-- » Fri Dec 20, 2013 12:43 pm

Base mod has this code

Code: Select all

$ArmorType[Male, LightArmor] = larmor;
$ArmorType[Male, MediumArmor] = marmor;
$ArmorType[Male, HeavyArmor] = harmor;
$ArmorType[Female, LightArmor] = lfemale;
$ArmorType[Female, MediumArmor] = mfemale;      
$ArmorType[Female, HeavyArmor] = harmor;

$ArmorName[larmor] = LightArmor;
$ArmorName[marmor] = MediumArmor;
$ArmorName[harmor] = HeavyArmor;
$ArmorName[lfemale] = LightArmor;
$ArmorName[mfemale] = MediumArmor;


At the beginning of item.cs, you can use $armorname to move from armor block to the item, and then
you can get the item's .description field.

So if you have %armor that is equal to "larmor", then $ArmorName[%armor].description should evaluate to "Light Armor".
Hope that explains some things

User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
Posts: 94
Joined: Thu Mar 05, 2009 12:53 pm
Location: Mars

Re: refreshClientScore

Post by Ghost » Fri Dec 20, 2013 2:48 pm

Thanks bud! :D

Post Reply