Cartwall fade out if main player starts.

Hi all,
we face a small problem in the german forum, but there is nobody who is able to solve / help us with the problem at the moment.
What we want sounds quite easy but is to hard for us “Programmer newbies” gg.

What we want:
If we start one of the main players, all active cartplayers should fade out (or stopp).

My idea was to use a notification script to fetch the event that main player start:

At first i try to implement an procedure in an procedure (but everytime get error message).
So i decide to make a global variable (c1), i know, not fine, but if works, then ok. So i have the following script for the player start event (same works with another script fine for “c1”)

[sub]procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer);
begin
if PlayerIndex = 0 then c1 := 1;

end;[/sub]

Now i tried to make a second procedure and use for an IF case the variable “c1”.

[sub]procedure SetFadeTrigger ( iIndex : integer ; iValue : boolean ) ;

begin
if c1 = 1 then begin
iIndex := 1;
iValue := true;
c1 := 0;
end;
end;[/sub]

Here i try only to fade out cartplayer numer two. But nothing happens. I try in notification script as also a global script.
I don’t get any error message, but i think that something with the procedure call is not correct.

So, if there is somebody who can help, please. I become crazy, sitting since 20 hours and have no idea what to do :slight_smile:

Thanks

There’s no need to use any triggers. Just fade out all cart players manually:

procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer);
var
  i: integer;
begin
  for i := 0 to GetEngine.GetCartwallControl.GetPlayerCount - 1 do
    GetEngine.GetCartwallControl.GetPlayerControl(i).FadeOut;
end;

(untested)

Or am I missing something?

Thanks Torben,
thought you are on holiday?
That’s exact what we want to do. I will test this afternoon.
But it looks like that some more commands has changed as i found in the helpfile with the commands.

Btw, you said, there is no need for any triggers. Does it mean this one will not a notification script?
Not urgent, i will try both :slight_smile:

Have a nice sunday.

Yes, but French 3G networks are far to cheap to leave the laptop at home :wink: I will take a look into the forum once in a while.

Piet: You do need to put the code in OnPlayerStart, in your notification script.

Look more closely at Torben’s code! ;D

BFN
CAD

Hi Cad,
thanks for your information.
It was a missunderstanding from my side.
I thought that this script will be an general script, which runs all time in background, and if the OnPlayerStart appears it will jump automatically to this procedure.
(Remember me a little bit on my old Borland C days which are around 15 years ago)

So i believe that i go al little bit wrong with the expression “notification script”.

For myself, at the moment i’m struggeling a little bit with the several script types.
As i understand at the moment all scripts are a type of a notification scripts (or, better say, all scripts which should start by any trigger command).
But if im right, there is also some kind of general script which runs all time, from the moment i start MaL, and do some “background work”, or? I thought that the notification script (the file) will only executed at the moment an event occures.

What was confusing me a little bit is, that Torben say i don’t need any trigger. Because i thought that the OnPlayerStart (means the push on the start button) is the trigger and if understand you correctly than it is what i meant.
Also which is quite strange for me that i need a “Get” Variable to Set a value. (Because in the Help File i found these get and also set commands)
But on the second view i understand. The “Get” i need to get the informations about the CWPlayer (numbers and so on) and i can use directly the command i wanna use (e.g. FadeOut).
And did you know if i can find somewhere an actual list for MaL 3.0.x where to see the structures for the commands?
Or maybe i’m only to stupid to read the Help File correctly. But how i can see that i need the GetEngine->GetCartwallControl->GetPlayerControl to be able to set the Fadeout?

I think it is time to learn object orientated programming :slight_smile:

Thanks all for help

BTW, sorry for my bad english, but i hope you can understand me :smiley:

Add:
We found that the command GetEngine is not correct. But it looks lite with “Engine” is working.

There are no scripts which “are running all the time” in mAirList. There are “ordinary scripts” which are executed once, and there are notification scripts which are loaded at startup, and their “On…” procedures are called whenever the respective event occurs.

The cartwall triggers are a totally different thing. They have nothing to do with notification scripts or scripting in general.

I think once you get more into OO programming, you will understand why you need to Get so many objects when actually setting a value.

Engine (sorry for the typo above) returns the IEngine objects which aggregates all playout functionality (cartwall and playlists). It’s method “GetCartwallControl” returns a reference to the cartwall control object, which encapsules the cart player control objects which you can access by the IPlayerControl interface obtained by calling “GetPlayerControl(index)”. On that IPlayerControl interface, you can call the various methods to control the player or set it’s properties.

The object/interface names are suffixed by “Control” because mAirList’s architecture follows the model-view-controller programming pattern, and what you actually access is the controller part.

Hi,
thanks, so far so good and i understand. Also i need to read ten times before understnd in german :smiley: But that’s another problem gg
The only problem i have at the moment to find out which commands are part of which class and how are the codes for the settings :slight_smile:
So i didn’t know that i need the Engine to get the informations about the “containers” below.

But i think…comes time comes light on :smiley:

Ok, switch brain to cooking mode. I will try one where i mean is correct. A short yes or no later on would be enough:

I want to stop payer A if cartwall player 3 ist started:

procedure OnCartPlayerStart(PlayerIndex: integer);
begin
  if PlayerIndex = 2 then
     Engine.GetPlayBackControl.GetPlayer(0).stop
end;

Brain cooking mode = off

Please say yes, because then i understand how to read the helpfile :D:D
If not than i will sitch back to brain cooking mode (damn it’s all so long ago gg)

Thanks all for help

I think that’s correct, Piet.

But to do that action, it would be easier to use an ‘Action On Start’ for Cartwall Player 3! ;D

If you have a file loaded in Cartwall Player 3:

  1. Right-click Cartwall Player 3.
  2. Click Properties.
  3. Click the Options tab.
  4. Click the Add… button to the right of Actions On Start.
  5. Click Execute Command.
  6. Type the command PLAYER 1-1 STOP into the box, then click OK.

If you prefer, you can use the command: PLAYER 1-1 FADEOUT (instead of STOP). That will fades Player 1 out instead of just STOPping it.

Note that you cannot set up the Action unless there is a file loaded into the Cartwall Player.

Two things to remember about doing this with an Action instead of a Notification Script:

  1. If you load a different file into Cartwall Player 3 afterwards, the Cartwall Player will ‘forget’ the Action.
  2. If you Save set, the Action WILL be saved along with the carts. So when you Load that cartwall set, the Action will be ‘loaded’ as well.

I hope that helps? I also hope I have not confused you!

BFN
CAD

Hi Cad,
thanks for help and explanation. This time it will not confuese me :slight_smile:

For me it is important to understand how to find the combination of a complete command to get access to some settings.
The example i give was just an quick idea. Later on it will look mor big. For the “do while” cases as whell as other “general” programming commands, that is not the biggest problem (ok, sometime, too) but at the moment i didn’t figure out how to create the construct, because the help file will show the forward way, but mostly you know the command what you wanna do, but didn’t know from which container it is. To find the relation between is the most complicate.
But i try to learning quick. Was sitting yesterday night another couple of hours only playing with some simple scripts to see if i’m able to get them work.

At least i do this, because i like to support the german forum a little bit in quite easy scripting things special for midi and players, not for DB at the moment gg), but there are many like me, without any knowledge how to do the scripting.

Thanks to all, special to Torben who can not stop working also at holiday. I think i must initiate a whole internet shutdown in france to get him to some more relax :D… this is a joke nothing else :wink:

Oh, it was you! When I was trying to approve a few license requests on my iPhone while shopping for breakfast at Carrefour in Bourges this morning, Orange suddenly told me that my Internet access had expired… but just a few minutes later it was ok again :wink:

Tip for everyone who travels to France: Get a Orange Mobicarte (15 Euros including 5 Euros of credit) plus the Internet Max option (12 Euros), it will give you 30 days of free 3G surfing. And in case you run your own mail server, let it listen to some non-standard IMAP and SMTP ports, because these protocols are not included in the data plan - at least not on their default ports :wink: