Script to check cartwall player

I’m trying to check if a cartwall player is loaded,
So I can light up a button if the file is loaded in that cartwall-spot and dim the button if the cartwall-spot is empty.

But I can’t find a function in the ‘Help-file’ to check if a cartwall player is loaded.
and, i’m curious what happens if I skip to a next page, if the ‘loaded’ state changes.

I’m more a tweaker than a coder.

So I hope someone already has a code for this :slight_smile:

This doesn’t work yet :wink:

procedure OnCartwallPlayerLoad(PlayerIndex: integer; Item: IAudioCartwallItem; PlaylistItem: IPlaylistItem; Duration: TTimeValue);
var i : integer;
begin
if (PlayerIndex= 1)  then begin
MambaNetRemote(0).SetSensor(31, true);
end;

if (PlayerIndex= 2)  then begin
MambaNetRemote(0).SetSensor(32, true);
end;

if (PlayerIndex= 3)  then begin
MambaNetRemote(0).SetSensor(33, true);
end;

end;


begin
end.

There is no procedure OnCartwallPlayerLoad, I’m afraid.

However, you can call the procedure OnCartwallPlayerStateChange(…) (watch out for the correct parameters!) and check for

if NewState = psLoaded then …

Thanks Tondose!

Any chance you could write an example line?

On…
If state…

Like I said, I can adjust, but I don’t know where to look for the right documentation to write such script myself.

I will share my final tested script here with the community.

So, cranking up my Windows machine then (cannot recall this by heart) …

All the syntax for background scripts can be found in the file Background Script Template.mls which is delivered with every installation into the the mAirList programme folder.

Try the following:

procedure OnCartwallPlayerStateChange(PlayerIndex: integer;
  OldState: TPlayerState; NewState: TPlayerState;
  Item: IAudioCartwallItem; PlaylistItem: IPlaylistItem;
  OnAirMode: TCartwallOnAirMode);
begin
  if NewState = psLoaded then
    MambaNetRemote(0).SetSensor(30 + PlayerIndex, true);
end;

begin
end.

Untested, as no Mambanet device available.

For the different player states available please make use of the search engine, they have been listed multiply around here. Some of them are

psLoaded
psPlaying
psPaused
psStopped

and so on.

2 Likes

Thank you!

I will test it and write a manual with the mambanet/axum settings for the community.
There’s a work around to set red for playing and green for loaded :slight_smile:

1 Like

It took some extra work, combining with other scripts, but here’s the working solution!

procedure OnLoad;
var
  i: integer;
  s: TPlayerStateArray;
begin

Cartwall.GetActivePagePlayerStates(s);

	for i := 1 to 14 do
	begin
		if (s[i] = psLoaded) or (s[i] = psPaused) or (s[i] = psStopped) then
			 MambaNetRemote(0).SetSensor(30 + i, true)
		else
			MambaNetRemote(0).SetSensor(30 + i, false);
	end;

end;


// Cartwall load

procedure OnCartwallPlayerStateChange(PlayerIndex: integer;
  OldState: TPlayerState; NewState: TPlayerState;
  Item: IAudioCartwallItem; PlaylistItem: IPlaylistItem;
  OnAirMode: TCartwallOnAirMode);
var
  i: integer;
  s: TPlayerStateArray;
begin

Cartwall.GetActivePagePlayerStates(s);

	for i := 1 to 14 do
	begin
		if (s[i] = psLoaded) or (s[i] = psPaused) or (s[i] = psStopped) then
			 MambaNetRemote(0).SetSensor(30 + i, true)
		else
			MambaNetRemote(0).SetSensor(30 + i, false);
	end;

end;
1 Like

Tutorial:

  • copy the script to a file, add this file to ‘background scripts’ in mairlist controlpanel.
    This wil make mAirlist send the commands to your AXUM/MAMBANET device.

NOTE: I assume that you have created a source for every cartwallplayer you have. This source is primary for communication with mairlist, I don’t use them for audio. See my earlier tutorials for setting up Cartwall players with Axum.

Let’s continue:

In your Axum control panel, go to [Surface configuration]
Open your mAirlist ‘Surface’ created to communicatie with mAirlist
For Sensor 31 select: source ->cartwall1 → alert
and so on for all your cartwall players an upcoming number.

go to [Surface configuration]
open your CRM-node ( in my case Node 'Axite-UI-6FBP-CRM )

scroll down to: Switch 23 off color set this to 1 (green)
and in the folowing column select: source → cartwall1 → alert

and so on for all your cartwall players in the corresponding button.

NOTE: I use red for playling: Switch 23 on color is set to ‘2’ (red).

Now loaded cartwall players will turn green!

1 Like

Node-Axite - Cartwall 1 is set to “start/stop”

All of the above works, but at the end of the item, it stays red…
Manual override turns it to green