I posted something about this before and i guess i didnt think it through enough, but now it hink i may hav:

Once a %variable reaches a certain number it would perform specified commands.
Example:
on *:SET:%counter.msgs:1000:/set %counter.msgs 0
This would meen once the variable %counter.msgs reaches 1000 it would reset it self.

Hope that does make sense,
Thanks always,
Baden