Provided the statements in the initial condition that checks , the actual flow is this:
The first execution:
- The condition checks whether a variable named "pickleCount" exists (I.E. whether a value has been assigned to it), and if not, because the "Evaluate 'Not Set' as zero" is checked, proceeds as if that variable had been set to 0
- The statement "0 is less than 2" is evaluated and found to be true
- The first branch of the condition is executed
- The "Say Something with Text-To-Speech" renders its audio ("Pickle") and the sound system starts playing it back (immediately, as the "Wait until speech completes before continuing command" option is not enabled)
- The "Set an Integer Value" action, which should also have the "Evaluate Not Set as zero" option checked, checks whether a variable named "pickleCount" exists, and if not, proceeds as if it had been set to 0
- The value is computed; 0 + 1 = 1, so the "pickleCount" variable is created and its value is set to 1
- As there are no more reachable actions to execute, the command ends
The second execution:
- The condition checks whether a variable named "pickleCount" exists, and if so gets its value
- The statement "1 is less than 2" is evaluated and found to be true
- The first branch of the condition is executed
- The "Say Something with Text-To-Speech" renders its audio ("Pickle") and the sound system starts playing it back
- The "Set an Integer Value" action, which should also have the "Evaluate Not Set as zero" option checked, checks whether a variable named "pickleCount" exists, and if so gets its value
- The value is computed; 1 + 1 = 2, so the "pickleCount" variable's value is overwritten to be 2
- As there are no more reachable actions to execute, the command ends
The third execution (as well as any subsequent executions, providing the value of "pickleCount" is not modified externally):
- The condition checks whether a variable named "pickleCount" exists, and if so gets its value
- The statement "2 is less than 2" is evaluated and found to be false
- The second branch of the condition is executed
- The "Say Something with Text-To-Speech" renders its audio ("Winchester") and the sound system starts playing it back
- As there are no more reachable actions to execute, the command ends
What may clarify this behavior for you is to know that VoiceAttack "variables" are actually elements of a
Dictionary collection, to allow them to be created on the fly without first explicitly declaring them.
The "Evaluate 'Not Set' as zero" option makes the "Begin a Conditional (If Statement) Block" action check whether a given variable exists within the dictionary, and if not use a default value of 0 instead.
There are no visible loops used in this command (there may be loops used internally, but the logic as described in the action list does not constitute any), as the flow starts from the top, and continues to the bottom, without ever jumping back up (
this topic attempts to explain the different methods for controlling command flow, including loops).
To reset "pickleCount", you can simple change its value from any command, E.G.
Set integer [pickleCount] value to 0
In that case you're setting the value to 0, explicitly, meaning the variable will still exist within the dictionary, and rather than evaluating it as if the value were 0, the actual value of 0 will now be retrieved by the "Begin a Conditional (If Statement) Block" and "Set an Integer Value" actions.
That will not affect the actual flow of the command, as the logic remains the same (E.G. 0 is still less than 2, etc...; There is no functional difference between a variable value of 0, and the 0 produced by the "Evaluate 'Not Set' as zero" option, mathematically)