Hi all,
I'm working on my first project and having problems with initialising the Stats. I'm getting this error
Unexpected error: Wrong formatted data from gameserver 1 (method: createGame): JSON_ERROR_SYNTAX
Fatal error: Uncaught Error: Call to undefined function startsWith()
I'm using the code below which is meant to work out of the box from the wiki
https://en.doc.boardgamearena.com/Creat ... alkthrough
Any one have an idea? I must be missing something, or maybe there is a better example somewhere.
Thanks
I'm working on my first project and having problems with initialising the Stats. I'm getting this error
Unexpected error: Wrong formatted data from gameserver 1 (method: createGame): JSON_ERROR_SYNTAX
Fatal error: Uncaught Error: Call to undefined function startsWith()
I'm using the code below which is meant to work out of the box from the wiki
https://en.doc.boardgamearena.com/Creat ... alkthrough
Any one have an idea? I must be missing something, or maybe there is a better example somewhere.
Thanks
Code: Select all
public function initStats()
{
// INIT GAME STATISTIC
$all_stats = $this->getStatTypes();
$player_stats = $all_stats['player'];
// auto-initialize all stats that starts with game_
// we need a prefix because there is some other system stuff
foreach ($player_stats as $key => $value) {
if (startsWith($key, 'game_')) {
$this->initStat('player', $key, 0);
}
if ($key === 'turns_number') {
$this->initStat('player', $key, 0);
}
}
$table_stats = $all_stats['table'];
foreach ($table_stats as $key => $value) {
if (startsWith($key, 'game_')) {
$this->initStat('table', $key, 0);
}
if ($key === 'turns_number') {
$this->initStat('table', $key, 0);
}
}
}