Scripts: WHICH Playlist Caused An Event?

I am using Notification Scripts which are firing when a Playlist is Empty.

(Hopefully!) simple question: I have two Playlists and the Event fires for both. How can I find out which of the two Playlists is Empty? I can obtain the Playlist object but I then cannot tell whether ‘that’ Playlist is Playlist 1 or Playlist 2. (or 0 and 1 if you prefer :wink: ) What I would like to do is to take actions based on which Playlist is Empty.

There must be an easy way to do this but I do not know the Properties/Attributes of the Playlist object!

Thanks in advance.

BFN
CAD

You are right, this is not possible at the moment. I will add another method to the playlist interface to obtain its number.

As a workaround, you might use CurrentPlaylist.GetPlayer(0).GetName to check for the name of the playlist’s first player.

Torben

Dear Torben,

Thanks as always for your prompt reply.

Am I correct if I say that for a Player notification, you can use the same workaround? In this case:

playerObject := <whatever>.GetPlayer; sName := playerObject.GetName;
I think it is best if all Notification objects have an easy way to identify the object which caused the Event to fire; this makes scripting very much easier, and much more flexible!

Thanks again.

BFN
CAD

The ntPlayerStart etc. events pass the player object as Interface parameter #0:

[code]var
n: INotification;
pl: IPlayer;

begin
n := GetNotification;

if (n.GetNotificationType = ntPlayerStart) then begin
pl := n.GetInterface(0);
SystemLog('ntPlayerStart was sent by player ’ + n.GetName);
end;
end.[/code]

(not tested)

By the way, I am making some changes to the scripting interface right now, which will affect the way you access playlists and players. However, I will provide a complete language reference (yet without documentation) with the next release.

Torben