Stats seemingly not working.

Game development with Board Game Arena Studio
Post Reply
User avatar
ZPolansky
Posts: 5
Joined: 08 December 2013, 19:56

Stats seemingly not working.

Post by ZPolansky »

Gah!
I'm having trouble with the statistics.
No matter what I do, I get an error like so:

Code: Select all

Unexpected error: Propagating error from GS 1 (method: createGame): Fatal error during thisismytestgame setup: Unknow statistic id: table turnsNumber
when I try to initstat any stat.

I have reloaded statistics configuration to update stats.inc.php in the control panel, and it looks like this:

Code: Select all

$stats_type = array(
"table" => array(
        "turnsNumber" => array("id"=> 10,
                    "name" => totranslate("Number of turns"),
                    "type" => "int" ),
    ),
    "player" => array(
        "coveredOwn" => array(   "id"=> 10,
                                "name" => totranslate("Amount of own letter covered."), 
                                "type" => "int" ),                          
        "coveredOther" => array(   "id"=> 11,
                                "name" => totranslate("Amount of opponent's letter covered."), 
                                "type" => "int" ),
	"coveredBlank" => array(   "id"=> 12,
                                "name" => totranslate("Amount of spaces with no letter covered."), 
                                "type" => "int" )
    )
);
and my call to initstat is in setupNewGame in game.php and looks like:

Code: Select all

self::initStat( 'table', 'turnsNumber', 0 );
self::initStat( 'player', 'coveredOwn', 0 );
self::initStat( 'player', 'coveredOther', 0 );
self::initStat( 'player', 'coveredBlank', 0 );
What is going wrong here?
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: Stats seemingly not working.

Post by pikiou »

Your code should be working. Unless uppercase letters should be avoided, but I doubt that.
IMO it's a file problem. You cay try the following:
- reload everything, commit & build, reload again, then commit & build again. It sounds desperate but it could fix it.
- modify the stats, reload them and check the log messages from that reload. Do they show anything unusual?
If none of the above works, you'll need help from the admins.
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Stats seemingly not working.

Post by sourisdudesert »

Hi,

Stats are not loaded in this case because "getGameName" method has been changed.

We are going to change skeleton to make sure no one else change this method.

Cheers,
User avatar
rickbill
Posts: 2
Joined: 27 April 2020, 07:16

Re: Stats seemingly not working.

Post by rickbill »

I have a similar problem ... it works in hearts but in my app it fails. Did I mess up a setting unwittingly?
User avatar
apollo1001
Posts: 191
Joined: 21 July 2015, 10:41

Re: Stats seemingly not working.

Post by apollo1001 »

Wow, that's an old thread!

What issue exactly are you having?
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: Stats seemingly not working.

Post by RicardoRix »

If you add new stats then you need to Control Panel, 'Reload statistics configuration'
User avatar
rickbill
Posts: 2
Joined: 27 April 2020, 07:16

Re: Stats seemingly not working.

Post by rickbill »

actually my problem seems to be exactly as stated in the original post ...

I reloaded from control panel and all looks good ... (just like shown in the original post)

then when I get to the "self::initStat('table','handNbr',0);" call in my setupNewGame function ... I see the error as described in the original post ...

"Unexpected error: Propagating error from GS 1 (method: createGame): Fatal error during thisismytestgame setup: Unknow statistic id: table handNbr"

...

the code in the hearts sample works fine ... I must have stepped on something but have no clue where to go look next ...

if I comment out all code associated with the statistics ... the game runs okay

(obviously I am a newbie to BGA coding/scripting)

BTW, thanks to all help so far and to those helping in the future! :) [thumbs up]
User avatar
apollo1001
Posts: 191
Joined: 21 July 2015, 10:41

Re: Stats seemingly not working.

Post by apollo1001 »

Okay, is it possible you are running a game which started before you implemented the stats.

E.g. try the following:
1. Express stop all games
2. Control Panel > Reload stats.
3. Express start a new game
Post Reply

Return to “Developers”