The counters are stored in an I6 array, but there’s no way to reliably know which of the array’s elements stores a specific rule’s counter. In any case trying to reset the internal first time counters would be much, much more cumbersome than using custom flags.
Maybe you can do what you want by applying an adjective to the widget and using it in the “…for the first time” rule, so you basically get two whacks at “…for the first time”? This works (in whatever version of Inform playfic uses):
Lab is a room.
The player carries a widget. The widget can be set or reset. The widget is set.
After examining the set widget for the first time: say "This is the first time you've examined the widget before eating the cookie."
After examining the reset widget for the first time: say "This is the first time you've examined the widget after eating the cookie."
The player carries a cookie. The cookie is edible.
Carry out eating the cookie: now the widget is reset.
Test me with "x widget/x widget/eat cookie/x widget/x widget".
It wouldn’t let you reset an arbitrary number of times, though.
Thanks Matt - unfortunately I’m going to be examining multiple first times - it’s one of the key mechanics of my new game. Looks like i’m going to need to be cumbersome.
Look at Emily’s “mood variation” extension which lets you pick a variation within quotes by a mood adjective. Maybe that could work combined with incrementing mood after saying a quip then resetting when the character does something else.