Script

For the cartwall I Use a novation launchpad with a script from kloppi somwhere september something changed (after update) and the script don’t work anymore for the players.
This is the player part in the script what do I need to alter?

procedure OnPlayerStateChange(Playlist,PlayerIndex: integer; OldState: TPlayerState; NewState: TPlayerState);
var
i:integer;
begin

if (NewState = psLoaded) then
begin
playerset(PlayerIndex, cHighGreen,chighyellow);
for i:=4 to 7 do
begin
midiout (Launchpad_Device,144,Stopbuttons[i], cOff);
end;
end
else if (NewState = psEmpty) then
begin
playerset(PlayerIndex, cOff,cOff);
end
else if (NewState = psPlaying) then
begin
playerset(PlayerIndex, cBlinkRed,cHighRed);
end
else if (NewState = psFading) then
begin
playerset(PlayerIndex, cBlinkRed,cHighRed);

end

else if (NewState = psError) then
begin
playerset(PlayerIndex, cBlinkYellow,cBlinkRed);
end

else if (NewState = psLoading) then
begin
playerset(PlayerIndex, cBlinkGreen,cBlinkRed);
end;

end;

Any error messages in the System Log?

Is this the entire script? I don’t think so. I see a procedure “playerset” being used that must be defined somewhere (it’s not a built-in function of mAirList).

The entire script is here
https://github.com/Lexorius/Mairlist-Launchpad-Script/blob/master/NovationMidi.mls

And yes there is a message in the log

Runtime error “List index out of bounds (5193529)” in background script L:\NovationMidi_v5.mls, handling message: PLAYERCONTROL_STATECHANGE 1302DF460862B660 00 00000000 00000000 02 03 ?

In mAirList 5 - and beyond :wink: - OnPlayerStateChange needs an extra “Item: IPlaylistItem” parameter:

// Called when (playlist) player changes its state
procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer; OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);
begin
end;

The same is true for a number of other procedures (notably OnPlayetStart, OnPlayerStop). Please check the current “Background Script Template.mls” file in the program directory if all definitions are up to date.

it works again thanks :slight_smile: