top of page

73. Decreasing COUNTER

Description

Create a dialog counter that counts down rather than up.

Code

SET Count-n TO COUNT( RepeatedDialog )
REPEAT RepeatedDialog
...
SET Count-n TO Count-n - 1
END REPEAT

Explanation

This script creates a custom counter, Count-n (a number variable) that counts backward to 1. For illustration, we'll assume a repeated dialog containing five answers. On the first pass of the REPEAT, Count-n will be 5 (COUNT will be 1). On the second pass, Count-n will be 4 (COUNT will be 2). On the last pass, Count-n will be 1 (COUNT will be 5).

Make sure that SET Count-n TO Count-n - 1 is the last line of the REPEAT.

bottom of page