Take Al's advice. Even with sequence locals, you'd have to add a local variable inside each frame of the sequence to display which frame you're currently in. Once you've done a case statement inside a while loop, you can then take the next step and implement a real state machine. A state machine can perform just like a sequence structure - execute a number of steps in a fixed order, but also gives you a lot of options like changing the execution order on the fly, spectial error handling, early termination, etc.