Event order in action block?


#1

Is there a way to control the order of events inside a single action block or is it better to use multiple blocks for steps that require a specific sequence?


#2

Short answer. No. Yes.

Long answer;
Yes, you can control the order of events in side a single action block, just place the commands in the order that you want them done.
Top to bottom, that will be the order the commands are done.
Cut/copy and paste work just fine to shuffle things around.

There is no hard limit to the number of commands in a single action block. I personally have had over 1000 in one block.
So there is no need to have a string of actions blocks for any reason other than debugging is often easier if you break them up.
Remember, there is no way to put a break point in the middle of an action block, so if you do need to debug, you need to step into the block and grind your way through all the actions.

It really comes down to how you like to lay things out and if the ‘specific sequence’ you mention is easy to debug in one block or not.

So now you can see why the answer really is yes and yes. Yes, you can control the order, its top to bottom and yes, its better ot use multiple blocks, its a lot easier to debug.

[Note, this answer / question is really one of programming style, if you use OptoScript or program in a different style, you may have a different take on it (but the commands are still executed from top to bottom)]


#3

Thank you. It just seems that events get added in a somewhat random order when I add actions. But if I can cut/paste them into the correct order, good. :slight_smile:

This actually prompts a wish list item:
Move Up/Down buttons in the action block dialog window.


#4

Just to clarify, the commands always get added just above where you currently are in the block (indicated by the blue highlight). So if you want to add a command at the end of the block, arrow down so you’re at the bottom, like so:


Hope that helps!

-OptoMary


#5

I second this, Move up and down arrows would definitely speed things up!