Page 2 of 2
Re: Notification subscription callback completely ignored in JS
Posted: 03 February 2022, 23:17
by Tisaac
cervofulgure wrote: ↑03 February 2022, 20:29
It goes straight to this game state from setup
setup -> newRound -> playerTurn -> etc ->
here is the pseudcode:
Code: Select all
function setup:
do some stuff
go to next state newRound
function stNewRound (game state):
pick some cards and move to other location
tell all players so we can animate cards in the ui
self::notifyAllPlayers
goto player turn: $this->gamestate->nextState()
function stNextPlayer (activeplayer state):
If first player is active player: do some stuff and notify all players
self::notifyAllPlayers
goto net state, etc
** UPDATE **
Notification JS callbacks do work if they are called within a player action during the an activeplayer state.
So my question is: How the hell can we show players things moving around without being in an activeplayer state?
It sounds pretty much like the quote you gave is the correct explanation.
Notifications sent when starting the game are not received and handled by your js code, only the logs are displayed.
Re: Notification subscription callback completely ignored in JS
Posted: 04 February 2022, 03:36
by DexterHugo
It's hard to troubleshoot your code without seeing it - it could be something as simple as a misspelling. But - you've also said something about animation and I wonder if you are too rapidly firing events and causing yourself problems? I set the following to make sure my notifications have enough time to complete:
Code: Select all
dojo.subscribe('DiscardFavor', this, "notif_DiscardFavor");
this.notifqueue.setSynchronous( 'DiscardFavor', 1100 );
That gives me 1.1 seconds to play the animation on the screen (which takes exactly 1 second) before the next event can run, even if it arrives in the queue early.
Also- maybe you should cut your code down to super simple like you're showing us here. There isn't anything obviously wrong, but I would want to verify how you assemble your notification and later how you parse it. Also, you question about how to show players things moving around without being in an active player state. I have points in my game where all players are active and doing things, or players are not active, but they can still do things in their private game area (akin to taking notes for a deduction grid). That can happen even if the game state is so ever briefly in the "game" mode instead of active player or multiple active player.
Re: Notification subscription callback completely ignored in JS
Posted: 06 February 2022, 22:37
by Victoria_La
Yeah why the pseudocode? The notifyAllPlayers probably missing some args or they are wrong type, framework is not very good at pointing the problems