Page 1 of 1

simplePause

Posted: 14 August 2022, 11:15
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?

Re: simplePause

Posted: 14 August 2022, 12:19
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);
		},
          

Re: simplePause

Posted: 14 August 2022, 13:43
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...

Re: simplePause

Posted: 14 August 2022, 14:02
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'.

Re: simplePause

Posted: 14 August 2022, 14:51
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.

Re: simplePause

Posted: 14 August 2022, 18:08
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).

Re: simplePause

Posted: 15 August 2022, 23:00
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...

Re: simplePause

Posted: 15 August 2022, 23:56
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.