simplePause

Game development with Board Game Arena Studio
Post Reply
User avatar
Tabaskov
Posts: 24
Joined: 18 July 2016, 10:18

simplePause

Post by Tabaskov »

Hi,
I don't understand how simplePause works.

In a function of my php I have :

Code: Select all

self::notifyAllPlayers( 'simplePause', '', ['time' => 6000] );
// wait 6 seconds to display the next notification
self::notifyAllPlayers( 'message', $message, [] );
but my message is displayed instantly. Maybe I'm missing something, or maybe I didn't understand what the simplePause does, but it seemed to me that it delays the next notification. Any ideas?
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: simplePause

Post by RicardoRix »

If you look in setupNotifications() there is a way to add a time delay to a notification there.

Code: Select all

	setupNotifications : function() {
	 	dojo.subscribe('tokenMoved', this, "notif_tokenMoved");
                          
                ....       

		this.notifqueue.setSynchronous('tokenMoved', 300);
		},
          
User avatar
Tabaskov
Posts: 24
Joined: 18 July 2016, 10:18

Re: simplePause

Post by Tabaskov »

Yes, but I'm looking for a delay so that a simple message in the game log appears after 6 seconds. This would be more on the server side.
Does the "simplePause" type work as described in the documentation? I wonder...
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: simplePause

Post by RicardoRix »

oh...
I'd never come across the simplePause before, I wonder if that's new.

Anyway I noticed that Century: Spice Road game has a mysterious 'simplePause' message in the log, maybe that game has a clue.

You could you try 'log' rather than 'message'.
User avatar
Tabaskov
Posts: 24
Joined: 18 July 2016, 10:18

Re: simplePause

Post by Tabaskov »

There is a mention of simplePause in the yourgamename.js doc, under Pre-defined notification types.
If it worked it would be very convenient for my needs, but obviously there is a problem somewhere. Obsolete ?
Also for info replacing 'message' by 'log' nothing changes.
User avatar
gilthe
Posts: 17
Joined: 30 October 2015, 22:05

Re: simplePause

Post by gilthe »

I think the meaning might just be to create it yourself: set up a (named like MyPause) notify with an empty message but using setSynchronous to create a wait (in JS). In php, issue first this "fake" notify, then directly afterwards issue a second notify with your desired message. This is just a workaround that setSynchronous only adds delay after posting the message (but not before).
User avatar
Tabaskov
Posts: 24
Joined: 18 July 2016, 10:18

Re: simplePause

Post by Tabaskov »

Good evening,
thank you for your answers. In fact I was in a method that is called at the beginning by the setupNewGame, I think that in this case the notifications are not yet processed, that must be the reason...
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: simplePause

Post by Tisaac »

Tabaskov wrote: 15 August 2022, 23:00 Good evening,
thank you for your answers. In fact I was in a method that is called at the beginning by the setupNewGame, I think that in this case the notifications are not yet processed, that must be the reason...
What do you mean ? When starting a game, the page is load in the first active state so any notification sent before will be in the log but not go through listeners.
Post Reply

Return to “Developers”