# calling sub procedures

## Recommended Posts

Instead of BegSeq() which starts its own thread, is there some means to call a sequence and comeback once that procedure is completed?

In a Button Component, under Action tab, do start/stop sequence perform sequentially one after another?

say I have 4 start/stop sequence actions, starts 1of4, after completing 1of4, then 2of4, and so on

or

does it simply start the sequence and goes on to next?

I want to break down the long procedures for easier troubleshooting..

thx

##### Share on other sites

You can start a sequence as a function by calling it as such, so, instead of:

beginSeq(mySequence)

you would do:

mySequence()

This would cause mySequence to be called as a function in the current thread, thus blocking the current thread until the function returns. Please see section 5.17 of the user's guide for more detail and how to pass parameters.

As for the Action, they execute in order, but since start/stop a sequence isn't blocking, they'll all basically start at the same time. If you want control over this, create another sequence that the Action starts, and have that sequence control the timing.

BTW: keep Action's quick. Also, for debugging, you usually want the base sequence running as a sequence, not a function so that you can put in breakpoints. At present, you can't break a sequence that is running in a component Action (quick sequence), Channel / PID/ Alarming Event, protocol, or object. But if any of those start a sequence with beginseq(), then you can use the debugging tools on that sequence.