Melscript Help

Hi,
just after a bit of help in mel.
I have a object attatched to a motion path, i need a piece of mel script, as when it reaches the end it follows the path back to the start, but the object moves backwards. Its set to follow the curve, and ive used the oscillate command at the end, but how can it always follow the direction its travelling in?