' This script uses checkstack values and names to record the frequencies
' of numbers rolled (similar to the Roll Frequencies statistics screen)
' The frequencies of desired numbers are recorded as follows:
' - Checkstacks 1 thru 99 record frequencies of 1 thru 99
' - Checkstack names 0 thru 99 record frequencies of 100 thru 199
' - Checkstack name 99 is a catch-all for frequencies of 199 or greater
' Checkstack0 is used as a roll counter.
' For example, let's record frequencies for the numbers 5 & 8.
' If the first 10 rolls are 2,8,9,5,4,3,7,5,8,9 then the first of our numbers (8)
' appears on the 2nd roll and so checkstack2 will increment by 1 and the counter
' will reset to zero. Two rolls later a 5 appears so checkstack2 will increment
' by 1 again and the counter will reset to zero. Four rolls later a 5 appears again
' so checkstak4 will increment by 1 and the counter will reset. On the next roll
' an 8 appears so checkstack1 will increment by 1, etc.
' checkstack1 = 1
' checkstack2 = 2
' checkstack3 = 0
' checkstack4 = 1
If Initializing script Then
clear all(checkstacks, checkstacknames)
Else
add 1 to cs0.count
If dice total = any(5, 8) Then ' <--- put desired numbers here (such as 5,8)
If cs0.count < 100 Then
add 1 to cs(cs0.count)
ElseIf cs0.count < 199 Then
csn(cs0.count - 100) = csn(cs0.count - 100) + 1
Else
csn(99) = csn(99) + 1
EndIf
cs0.count = 0
EndIf
EndIf