ok i did what you said it seem to work. now to make it work properly i would need a way to send it to send it to a different mode than 0 at the end.
for exemple instead of mode=2
timer>pauseDuration : set to mode0
i would need something more like: mode=2
timer>pauseDuration : set to lastmode+1
or something like that. i dont know if it would work or if im clear.