johanberntsson / PunyInform

A fast and compact library for writing text adventure games for the Z-machine running on 8-bit computers as well as other platforms.
MIT License
176 stars 17 forks source link

GET BALL FROM BOX should trigger a TAKE #129

Closed auraes closed 3 months ago

auraes commented 3 months ago

If I explicitly take a ball from a box, or if I simply take the ball, this doesn't generate the same rules.
In the first case, the react_before and before for the ##Take action are missing:

You can see a box (which contains a ball) here.

> get ball from box
react_before remove
before remove
react_after remove
after remove
react_after take
after take
Removed.

You can see a box (which contains a ball) here.

> get ball
react_before take
before take
react_after take
after take
Taken.

auraes commented 3 months ago

I said something wrong. I have to intercept the ##Take and ##Remove actions simultaneously if I want to act on the object taken including a container or a supporter object.

fredrikr commented 3 months ago

This works the same as in the standard library, and as you say, you need to catch both Take and Remove in before to block an object being picked up.

Closing.

DavidGriffith commented 3 months ago

Thanks.

For the benefit of others watching, @fredrikr cited page 89 of DM4 over at https://gitlab.com/DavidGriffith/inform6lib/-/issues/132 for this behavior. The relevant text is

For instance, if you only want to prevent an object from entering the player’s possession, you need only block the Take action, unless the object is initially in something or on something, in which case you need to block Remove as well.