You can do this without a single line of code.
DVD SP has this feature called "Stories".
A "Story" is a group of markers from a track, re-arranged in the order you want, without duplicating media. The main use for this would be having two versions of a track without duplicating media (you could have, say, a standard edit of a movie and the director's cut).
One thing about stories: they play the markers in the order you want and then they are over when they reach the last marker.
At the same time, nothing prevents you from creating stories with only one marker on them.
So, you create your track with all the needed markers. And then you create stories with only one marker inside. They play the scene and then they perform the end jump (which could be the same or different than the main track)
That's all.
Adolfo Rozenfeld
Buenos Aires - Argentina
www.adolforozenfeld.com