Giving Actions to People, Unexpected Result

I’m trying to learn how to achieve some intermediate-level-difficulty effects using Inform-7. To this end, I recently conducted this experiment:

The player is in a room called the test room.
The apple is here.
The ball is here.

A person has an action called the plan.
The plan of the player is taking the apple.

After someone (called the taker) taking something:
	try the plan of the taker;

The code executes without error, but when the player takes the ball, they do not try to take the apple. I can see that this is the case when I turn on ACTIONS. I’m not surprised that the code didn’t work- I was just guessing at things based on what I’d read in the documentation so far. What surprises me is that it still executed without any error message. What did my code even do?

This is probably counterintuitive, but “someone” does not include the player (see Writing With Inform 12.12), so that’s why nothing is happening (you’re probably on top of this and just futzing around, but you’ll also need to add some conditionals to govern what happens when the “plan” action fires twice, as in this example – like, a plausible way this would play out is the player takes the ball, which fires an implicit TAKE APPLE, which in turn will fire a second TAKE APPLE since your After rule applies any time an object is taking. So this will be confusing for the player!)

2 Likes

The solution, by the way, is to replace “someone” and “taker” with “an actor”, which does include the player. (And remove the “called” bit.)

The test room is a room.
	The apple is here.
	The ball is here.

A person has an action called the plan.
	The plan of the player is taking the apple.

After an actor taking something:
	try the plan of the actor;

Of course, this second take action triggers that code again, so if you want to prevent that:

After an actor taking something when the plan of the actor is not waiting:
	let the temp action be the plan of the actor;
	now the plan of the actor is waiting;
	try the temp action.
1 Like