Hi,
I am trying to send notifications to players, which don't seem to be making it to the client browsers.
I have a simple state machine:
So after "gameSetup", I am moving into state "roundSetup". The function for roundSetup is:
First off, the debug message is not showing up in the BGA request log. I know that logging is not visible if written from the constructor or gameSetup, but we are in a different state by this point. I expected it to work once we are out of the gameSetup state, but I guess I am mistaken.
I'm unsure if the notifyAllPlayers call is working. I do see the message 'Round # has begun!' for each player, in the notification area, but the commands in my .js function, notif_roundSetup, don't appear to be executing:
The plan for the roundSetup state was to inform each player which set of tokens they have in their hand. This needs to happen each round, before the first player acts. If my current approach is not correct, how should I handle this situation? Maybe include the initial set of tokens for each player in gameDatas instead of relying on notifications?
Thank you!
I am trying to send notifications to players, which don't seem to be making it to the client browsers.
I have a simple state machine:
Code: Select all
// The initial state. Please do not modify.
1 => array(
"name" => "gameSetup",
"description" => "",
"type" => "manager",
"action" => "stGameSetup",
"transitions" => array( "" => 10 )
),
// Note: ID=2 => your first state
10 => array(
"name" => "roundSetup",
"type" => "game",
"action" => "stRoundSetup",
"transitions" => array( "startRound" => 20 )
),
20 => array(
"name" => "playerTurn",
"description" => clienttranslate('${actplayer} must place a token'),
"descriptionmyturn" => clienttranslate('${you} must place a token'),
"type" => "activeplayer",
"possibleactions" => array( "playToken" ),
"transitions" => array( "playToken" => 25 )
),Code: Select all
function stRoundSetup()
{
// This doesn't seem to work
self::debug("In stRoundSetup");
// The message 'Round # has begun' IS showing up in the player notification area
self::notifyAllPlayers( "roundSetup", clienttranslate( 'Round # has begun!' ), array() );
// This is working
$this->gamestate->nextState('startRound');
}I'm unsure if the notifyAllPlayers call is working. I do see the message 'Round # has begun!' for each player, in the notification area, but the commands in my .js function, notif_roundSetup, don't appear to be executing:
Code: Select all
notif_roundSetup: function(notif)
{
//Neither of these commands are working
console.log('notif_roundSetup');
this.testVar = "WORKING";
},Thank you!