roll.count

From RPTools Wiki
Revision as of 23:01, 9 February 2023 by Conversion script (talk | contribs) (Conversion script moved page Roll.count to roll.count: Converting page titles to lowercase)
Jump to navigation Jump to search

The special variable roll.count holds the current iteration of current loop. It may be used with the following roll options for looping:

The roll.count begins at 0.

Examples

Simple Count

[COUNT(5, "<br>"): "This is roll " + roll.count]

Outputs:

This is roll 0
This is roll 1
This is roll 2
This is roll 3
This is roll 4

Inner and Outer Loop

[r,foreach(item,"a,b,c,d,e,f",""),code: {
	Loop: [r: roll.count] - [r: item] - 
	[r,count(6): roll.count]<br>
}]

Outputs:

 Loop: 0 - a - 0, 1, 2, 3, 4, 5 
 Loop: 1 - b - 0, 1, 2, 3, 4, 5 
 Loop: 2 - c - 0, 1, 2, 3, 4, 5 
 Loop: 3 - d - 0, 1, 2, 3, 4, 5 
 Loop: 4 - e - 0, 1, 2, 3, 4, 5 
 Loop: 5 - f - 0, 1, 2, 3, 4, 5 

Related Pages