Modifying the standard report taking rule response, according to the holder of the noun

This is something that I have been struggling with for some time, and have not come up with a satisfactory rule. I am trying to modify the ‘Taken.’ response, according to what the noun was in or on when the player took it. The following does not work, as they return a problem message, due to ambiguities with the noun and verb tense:

After taking something which was in the backpack: if the backpack is worn: say "By no small feat of sleight of hand, you reach back and retrieve [the noun] from the backpack."

After taking something when the noun was in the backpack:....

I’ve tried using

After taking something when the holder of the noun was the backpack:

This compiled, but on the initial try in testing, it returned “Taken.”, but subsequent tries returned the correct response.

I’ve tried editing the standard report taking rule response, such as–

The standard report taking rule response is "[if the backpack was the holder of the noun]….

this acted exactly the same–first response was ‘Taken.’, subsequent ones were correct.

There must be a better way to do this…??

Rather than futzing around with past-tense conditions, I’d set a variable at the beginning of the action.

The taking action has a object called the holder taken from.

Setting action variables for taking:
	now the holder taken from is the holder of the noun.

Report taking a thing:
	instead say "Taken from [holder taken from]."

2 Likes

Thank you so much, Zarf!

And if you use an action variable, you can use a really cool but under-documented feature of Inform, the matched as clause!

The taking action has a object called the holder taken from (matched as "from").

Setting action variables for taking:
	now the holder taken from is the holder of the noun.

Report taking a thing from a supporter (called the surface):
	instead say "Taken from [the surface], which is a supporter."

This is the mechanism that lets you use “to”, “from”, “by”, “through”, and “with” with the “going” action (“instead of going through the tiny door with the enormous boulder…”), even though “going” has only a single noun (the direction). Now you can write rules about “taking from” freely, and it’ll work just the way you expect!

4 Likes

Very good; I had forgotten about that feature.

It’s tremendously obscure, but sometimes it turns out extremely helpful. I think I learned about it first in the Counterfeit Monkey source (“creating”).

1 Like

Thanks to you both–now I can go back into all of my games and add these tidbits!:smiley:

1 Like