I’m not sure how fail-proof this solution is, but this is what I’m working with:
[code]A person has a list of stored actions called myActions.
First before an actor doing anything when the actor is a person (this is the add current action to myactions list rule):
add current action to myActions of the actor;
First after an actor doing anything when the actor is a person (this is the remove current action from myactions list rule):
truncate myActions of the actor to ((number of entries in myActions of the actor) - 1) entries;
continue the action;
[/code]
This will create a stack of actions being done by a person. You can easily alter it to work for things or whatever kind you need to track actions for, mine works for people because that’s all I needed it to.
Here’s an example of how to access the current action:
To decide which stored action is the/-- current action for (p - a person):
let entries be number of entries in MyActions of p;
if entries is not 0, decide on entry entries of myActions of p;
Likewise, you can access the whole stack to search for other actions, if that changes anything. You can compare them to “the action of taking the lamp” and stuff…
Also of note that unless you do something to the way actions are processed, actions will get finished one after the other and then the stack will be empty, so if you check for it in “Every turn” rules, it will be empty, as the “current action” has long since finished! So this only works if you’re going to have a rule for the created action, for instance, that checks which action generated it, as by that point it has not yet finished.
(I am using the latest inform version, I think it had some major improvements with stored actions, so this probably doesn’t work with older versions)