#increment and check counter (if the variable doesn't exist it is basically zero, becoming 1 after the increment) inc=$counter if=($counter > 5) set=$counter:1 if=($counter = 1) do=count1 if=($counter = 2) do=count2 if=($counter = 3) do=count3 if=($counter = 4) do=count4 if=($counter = 5) do=count5 exit :count1 echo="First call!" exit :count2 echo="Second call!" exit :count3 echo="Third call!" exit :count4 echo="Fourth call!" exit :count5 echo="Fifth call - starting over!" exit
A more simplified version would look like this – if you just need the actual number:
#increment and check counter (if the variable doesn't exist it is basically zero, becoming 1 after the increment) inc=$counter if=($counter > 5) set=$counter:1 echo="This is call number {$counter} of 5!"
Note: Global variables are shared across all alerts so make sure to either chose unique names or add preprocessor placeholders like [id]
or [name]
to the variable name, eg. inc=$count[id]
!
Always double check that you are using the right syntax/alert!