Hi,
I'm resurrecting an old thread to ask something to the admins, and maybe to other developers depending on the admin's answer.
Are the statements in the quote below still true today? I'd like to use a notifyAllPlayersBut( $playerId ) notif, because the active player has already received a notification for this action earlier (other players receive it only if the active player confirms it, and not if he/she cancels it). If I send a notif only to other players at the table, spectators won't receive it, and if I send a notifyAllPlayers(), even if the active player ignores the interface changes, the notification message is still written in the log (so it will be written twice for this player, since he/she has already received the same notif earlier).
pikiou wrote: ↑01 April 2016, 09:57
English short answer before the long french one: because of the current long pooling system used by BGA, it [a notifyAllPlayersBut() method] would be really unoptimized so it doesn't exist. You do have to use two notifications and yeah it's annoying
Les admins m'ont expliqué il y a deux ans que si un "NotifyAllPlayersBut" n'existait pas, c'est parce qu'il n'avait semblé nécessaire dans quasiment aucun des jeux qu'ils avaient adaptés. J'avais du creuser un peu la question pour me rendre compte qu'en réalité ça n'était hélas pas possible à cause du module externe de long pooling utilisé par BGA : les messages envoyés à un groupe d'utilisateurs nécessitent d'ouvrir un canal de discussion à ce groupe d'utilisateurs, et "NotifyAllPlayersBut" nécessiterait d'ouvrir autant de canaux que de joueurs. Hors minimiser le nombre de canaux est essentiel au bon fonctionnement du site, d'où l'absence de cette fonction.
J'ai un temps pensé coder moi-même cette fonction "NotifyAllPlayersBut" en utilisant plein de "NotifyPlayer", mais les spectateurs ne recevraient rien.
Du coup ta solution de double notification est la bonne.
If a notifyAllPlayersBut() is still impossible, is there a
clean way to conditionally not display the message of a notif in the log? (in my case, if the player is active, but I could also use something in the notif args)
For now, this is what I plan to do if nothing else is possible:
EDIT: wait, actually I think this is not needed:
Separate the notif in two notifs, one with the log message only, and another one without log message, with the informations for interface changes.
Use notifyAllPlayers() for the notif with args and without message. The active player doesn't process it since the changes are already done in their interface.
END OF EDIT
The notif
with the log message is sent to each non-active player with notifyPlayer( $playerId, ... ), and to spectators with a notifyAllPlayers( 'spectatorNotif', ...) that only specators subscribe to, following Quinarbre's suggestion earlier in this thread. (But I don't understand why he's manually placing the message in the log in notif_cardPlayedSpectator(), I didn't try this yet, so there might be something that doesn't work as I would expect.)