Page 1 of 1

Stats seemingly not working.

Posted: 27 October 2015, 22:11
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?

Re: Stats seemingly not working.

Posted: 28 October 2015, 02:42
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.

Re: Stats seemingly not working.

Posted: 03 November 2015, 21:40
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,

Re: Stats seemingly not working.

Posted: 02 May 2020, 19:21
by rickbill
I have a similar problem ... it works in hearts but in my app it fails. Did I mess up a setting unwittingly?

Re: Stats seemingly not working.

Posted: 02 May 2020, 20:40
by apollo1001
Wow, that's an old thread!

What issue exactly are you having?

Re: Stats seemingly not working.

Posted: 02 May 2020, 21:48
by RicardoRix
If you add new stats then you need to Control Panel, 'Reload statistics configuration'

Re: Stats seemingly not working.

Posted: 02 May 2020, 23:34
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]

Re: Stats seemingly not working.

Posted: 03 May 2020, 10:47
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