To cause it to keep doing loop until it loops 2 times with successful casts.
As you already check to see if you have actually cast the spell, are you allowed to actually not iterate unless it’s successful?
You can put that into a single line /castsequence Sidewinders, Aimed Shot, Marked Shot, Aimed shot,Aimed shot
The only thing to watch is if Sidewinders for example needs 50 focus (I don’t have a hunter so making this up to illustrate) and you don’t have anything that generates focus it will never get to Aimed Shot
Aimed shot costs 50 focus per shot.
And Marked shot cost 30 focus per shot and requires a proc.
The theory is:
Sidewinders puts up vulnerability for 7 seconds
You Aimed shot til vulnerability is down to about 2 seconds. (With patient sniper next time you get ((7 - Time left) * +15%)+100%) damage to Aimed shots.
At about 2 seconds you need to fire off a marked shot to refresh the timer back to 7 seconds and then repeat the aimed shots.
Marksman only has 120 focus post 7.1.5. And our regen is a combination of Sidewinders (+40 focus) and natural regen (~12 focus per second).
So, you cannot quite afford to put it purely in a castsequence. It would more have to look like: