Consider this: You have song with some pickup bars, the main theme, and a dramatic ending. You want to use it for a battle theme, but you don't want a dramatic ending with the fight still having half way to go. So you would (Maybe) use a script.
It would start the song as normal, then play through to a certain point (set in a variable, in total seconds).
If the battle was still going, the song would jump back to another point (set in another variable in the same way).
If the battle ends, the song skips forward to the ending, and does not continue to play any music afterward.
How would one go about doing this?