Page 1 of 1

[SOLVED] Stats Label

Posted: 09 June 2021, 22:36
by Badguizmo
Hello.

In Studio Doc (https://en.doc.boardgamearena.com/Game_ ... ts.inc.php) it is said that we can have label instead of int in the stats.

The example is :

Code: Select all

"value_labels" => array(
		11 => array( 
			0 => totranslate("None (or tied)"),
			1 => totranslate("Auren"), 
			2 => totranslate("Witches"), 
			3 => totranslate("Fakirs"), 
			4 => totranslate("Nomads"), 
			5 => totranslate("Chaos Magicians"), 
			6 => totranslate("Giants"), 
			7 => totranslate("Swarmlings"), 
			8 => totranslate("Mermaids"), 
			9 => totranslate("Dwarves"), 
			10 => totranslate("Engineers"), 
			11 => totranslate("Halflings"), 
			12 => totranslate("Cultists"), 
			13 => totranslate("Alchemists"), 
			14 => totranslate("Darklings"), 
		),
	)
I understand that this should be placed in the "stats.inc.php" file but then how do I get it to work (i.e. : display the string in final stats) ? The source code for "Terra mystica" (listed as an example) is not available.

Thank you ;)

Re: Stats Label

Posted: 09 June 2021, 23:48
by Tisaac
Here is an example, nothing more to do :

Code: Select all

$stats_type = [
  "table" => [
    "ending" => [
      "id" => STAT_EOG,
      "name" => totranslate("End of game trigger"),
      "type" => "int"
    ],
  ],

  "value_labels" => [
  	STAT_EOG => [
  		0 => totranslate("None"),
        	1 => totranslate("All houses built ending"),
        	2 => totranslate("Three plans completed ending"),
  		3 => totranslate("Permit refusal ending"),
  		4 => totranslate("End of deck ending (solo mode)"),
  	]
  ],

Re: Stats Label

Posted: 11 June 2021, 20:56
by Badguizmo
Thank you.

And lets says I have 3 identical stats that I want labels for. These labels are identical.

What should I do as the id must be unique ?

i.e. : the three stats:

Code: Select all

"guild_choice1"=>array("id"=>13, "name"=>toTranslate("1st Guild chosen"), "type" => "int"),
"guild_choice2"=>array("id"=>14, "name"=>toTranslate("2nd Guild chosen"), "type" => "int"),
"guild_choice3"=>array("id"=>15, "name"=>toTranslate("3rd Guild chosen"), "type" => "int"),
and the value label :

Code: Select all

"value_labels" => [
  	Guild_Names => [
        1 => totranslate("Fire"),
        2 => totranslate("Earth"),
  	3 => totranslate("Light"),
  	4 => totranslate("Plant"),
	...
  	]

Re: Stats Label

Posted: 11 June 2021, 21:24
by Tisaac
Not sure to follow you. Notice in my example the id of the stat is used in the values_labels for mapping
So 3 stats means 3 entries in values_label, even if they are the same (you can store it into a variable if you want to)
Badguizmo wrote: 11 June 2021, 20:56 Thank you.

And lets says I have 3 identical stats that I want labels for. These labels are identical.

What should I do as the id must be unique ?

i.e. : the three stats:

Code: Select all

"guild_choice1"=>array("id"=>13, "name"=>toTranslate("1st Guild chosen"), "type" => "int"),
"guild_choice2"=>array("id"=>14, "name"=>toTranslate("2nd Guild chosen"), "type" => "int"),
"guild_choice3"=>array("id"=>15, "name"=>toTranslate("3rd Guild chosen"), "type" => "int"),
and the value label :

Code: Select all

"value_labels" => [
  	Guild_Names => [
        1 => totranslate("Fire"),
        2 => totranslate("Earth"),
  	3 => totranslate("Light"),
  	4 => totranslate("Plant"),
	...
  	]

Re: Stats Label

Posted: 23 June 2021, 12:46
by quietmint
Badguizmo wrote: 11 June 2021, 20:56 Thank you.

And lets says I have 3 identical stats that I want labels for. These labels are identical.

What should I do as the id must be unique ?
Simply define the label array in a variable, then refer to it...

See here, I use $letters on two different stats: https://github.com/quietmint/bga-hardba ... ts.inc.php

Re: Stats Label

Posted: 24 June 2021, 23:06
by Badguizmo
Thanks :!: :!:

More clear now ^^

Managed to do it ;)