List of active players in state description: translation

Game development with Board Game Arena Studio
Post Reply
User avatar
Tirix
Posts: 32
Joined: 17 December 2012, 15:13

List of active players in state description: translation

Post by Tirix »

Hi there,

I have a multi-active state where several players have to do an action, but not all.
I'd like to display the list of active players in the state description, like "Albert, Betty and Carl must move their meeple".
For this, in states.inc.php, I have the following:

Code: Select all

    15 => array(
    	"description" => clienttranslate('${playersList} must move their meeple'),
    	"descriptionmyturn" => clienttranslate('${you} must move your meeple'),
    	"args" => "argActivePlayerList",
And in game.php:

Code: Select all

    function argActivePlayerList() {
    	$players = $this->gamestate->getActivePlayerList();
    	$playersList = '';
    	for($i = 0; $i<count($players); $i++) {
    		$player_name = self::getUniqueValueFromDB( "SELECT player_name FROM player WHERE player_id = {$players[$i]}" );
    		$playersList .= ($i > 0 ?($i == count($players)-1 ? ' and ' : ', ') : '') . $player_name;
    	}
    	return array('playersList' => $playersList);
    }
I feel it's a bit of an overkill to just get the list of players, and the 'and' will not be translated correctly. Any idea about how to get this done?
Could we maybe have a generic variable like ${actplayer}? :roll:

Or maybe I shall just describe my state as "Other players must move their meeple"... anyway, nothing urgent here.
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: List of active players in state description: translation

Post by pikiou »

In a multi-active state, you can see on the player panels who is still playing (hourglass), and who isn't (profile picture). The information would be welcome in the state description as well, I agree, but it's already present if necessary.

A solution like ${actplayer} would be great, but the message should then be adapted to handle singular and plural forms: ${multiactplayer} are/is moving meeple(s)
In English it's fairly simple, but in other languages it could become hard to read.
Come to think of it, you could formulate it like this: "Still having to move meeples: Albert, Betty, Carl"

Also, adding color would make it even better!

Code: Select all

"<span style=\"font-weight:bold;color:#$playerColor;\">$playerName</span>"
Please share with us your solution if you code it, as I'll be interested in reusing it ^^
Post Reply

Return to “Developers”