The 2nd point is key to understanding what’s going on
I probably didn’t explain it very well. When Rules for each object & clone are evaluated sequentially during each frame. And the first code block of each When if evaluated as true is executed during that same frame, before going on to the next When of that object or beginning the evaluation of the When rules of the next object.
Let’s look at your code & jump to a point in time when
- the clones have been created
- Test variable equals 21
Keep referring the order of the objects and When rules (shown above) as we walk through this.
So at the beginning of the next frame, the player goes to the 1st object’s (“Text”'s) 1st When rule. When Test variable = 21. This is true, so it executes the 1st block of that When rule. (<<< this is the meaning of my 2nd point in the post above) Set Test variable to 2.
Then (even if there were more blocks in that 1st When) it goes to the next rule. When 7=7. This is also true, so the player executes the 1st block in that rule. Set Text to Test variable. So the text now reads “2”.
Then (even if there were more blocks in that When) it goes to the next rule. When Game Starts. Not true, so it skips the code inside the rule.
On to the next rule… ok, there are no more for the 1st object. So it goes to the 1st Rule of the 2nd object (Text 3 with Clone Index 1). When Text 3 Total Clones < 20. Not true, skip.
When Test variable = self Clone Index. Remember these go in the order of creation so we’re on Clone Index 1 with Test variable = 2. Therefore the rule is not true, skip.
Now on to the next object. Text 3 with Clone Index 2. When Text 3 Total Clones < 20. False, skip. When Test variable = self Clone Index. True, execute the 1st block in the rule. Increase Test variable by 1. So now Test variable equals 3.
On to the next object. Text 3 with Clone Index 3… Hopefully you seen the pattern. So after the Player finishes with all 20 Text 3 clones, what does Test variable equal? 21! And that ends the frame (remember, all of the above was during 1 frame).
Almost done with the explanation, just need to consider the beginning of the next frame. As the Player executes the next frame, if any rules from the last frame were still executing, it would go to the 2nd block of those rules instead of evaluating the rule. If the rule had ended it starts over and re-evaluates the rule. All your rules only had 1 code block so that makes it easier to understand as all rules had finished and will now be re-evaluated.
Looking at just the first 2 rules of the 1st object (Text), you’ll see that When Test variable = 21 is true, so it’s set to 2. Then the text set read “2”. And the frame continues until Test variable again equals 21 at the end of the frame. Test variable is continually incremented as expected, but is only equal to 2 when the Set Text block is executed.
Does it make more sense now?