More options for action tracking (e.g. if we have...)

While running down an unrelated issue, I noticed some interesting things about the way that action tracking works.

First, in addition to tracking action success with respect to specific nouns, the subsystem also tracks whether a given action has succeeded with any noun. This can be tested by omitting the noun in an if we have... construction, e.g.:

if we have examined: [true if any examining action by any actor has succeeded, regardless of noun]

I’m guessing that this was implemented for intransitive actions actions like looking or taking inventory, but it works with transitive actions, too. The caveat is that the condition must use the bare action name, so if we have examined something: won’t work.

Second, the underyling data structure keeps track of whether or not any action at all has succeeded for a given noun. I couldn’t find anything in the documentation indicating how to make use of this, but it’s not difficult to create the required phrase:

To decide whether we have interacted with (O - object):
	(- TestActionBitmap({O}, NULL) -).

As a demonstration of it working:

Every turn:
	repeat with X running through things:
		say "[X]: [if we have interacted with X]YES[else]no[end if]."

Third, the underlying data structure also keeps track of whether any action at all has succeeded. Again, I couldn’t find anything built-in that makes use of this, but to set it up:

To decide whether any action has occurred:
	(- TestActionBitmap(nothing, NULL) -).

This last will evaluate false until after at least one action results in success.

8 Likes