Go back 1 song part even through to previous song

// this was part of a much larger script. I have most of the extraneous removed.

On ControlChangeEvent(m : ControlChangeMessage) Matching 1,20,21,22,67,68,96,97,102 from M1

 var
  Incc : integer
  InValue : integer
  cc1 : controlChangeMessage
  CurrentPart : integer
  CurrentSong : Integer
  NumParts : integer
  //Print(m);
  
 Incc = GetCCNumber(m);
 InValue = GetCCValue(m)
 
//my cc for going back is 68
 If Incc == 68 then
If InValue>0 then
//is it the first song part?
 CurrentPart=GetCurrentSongPart()
 //Print (CurrentPart);
 If CurrentPart>0 then
// not the first song part so we just go back 1 song part
 SongPrevPart()
  elsif CurrentPart==0 then // going to previous song
//it is the first song part so we have to go back a song  
CurrentSong=GetCurrentSongIndex()
  if CurrentSong>0 then // not the first song
  PrevSong() // go to previous song
  NumParts=GetSongPartCount()// how many song parts
  //Print (NumParts);
  SetSongPart(NumParts-1)// set to last song part
  end
 end
end
End
1 Like

Please remember to put triple backquotes before and after your script so that it’s more easily readable. I have edited your post accordingly

1 Like