Trying to understand "understand"

Absorb is a new action - you need to write check/carry out/report rules to handle the default cases. See Chapter 12, particularly sections 12.7 and 12.9.

I’ve had a look at those sections, but I still can’t figure out what I need to do. In the absorbing example, how do I phrase the check / carry out / report rules?

Like this (at work, so I hope it compiles).

[code]A thing can be absorption-resistant.

Check absorbing when the noun is the player (this is the block self-absorption rule):
say “Absorbing yourself is a dangerous act that would achieve little.” instead.
Check absorbing when the noun is an absorption-resistant thing:
say “[The noun] resist[if the noun is plural-named]s[end if] your attempts, and will not be absorbed.” instead.

Carry our absorbing:
move noun to Hidden;
now the noun is absorbed.

Report absorbing:
say “Done.”[/code]

Thanks for that. I just tried it but unfortunately it didn’t compile and threw this series of error messages at me:

The action definition still exists, right? (“Absorbing is an action applying to…”) The error messages suggest that it doesn’t.

Ouch. That’s embarrassing. Turned out I’d changed something :frowning: and didn’t even realise.

Now I’ve changed it back and - hey presto! - it work! Big thanks, everyone. I might actually get this game done now.

The game sounds interesting! Presuming the ‘smashing stuff’ thread is related it also sounds a lot like my life. I smash whatever I can’t absorb.

I seem to have run into another problem. Surprising, I know. On the plus side, I have managed to figure out a few things myself, but this one’s got me well and truly stumped.

The absorbing side of things seems to work fine, but releasing them is causing me no end of trouble. Firstly if I attempt to release an item that it isn’t possible to absorb (like a doorway), I get

Is there a way to prevent Inform from referring to items that can’t be absorbed?

I’m also hitting a snag in that if I have more than one item in the game with a similar name, like a cell door and a metal door, when I try to release one, I’m told

This happens even if neither of the doors are absorbed, or even visible to the player, and whichever one I select is then followed by the default error message that there is nothing in SADI to be released right now.

I can’t test this right now, but you could try restricting the scope of releasing to only absorbed things:

Releasing is an action applying to one visible thing.
Understand "release [any absorbed thing]" as releasing.

This assumes you already have the adjective “absorbed” defined, e.g. as in Shadow Wolf’s original example earlier. If not, you could define it as, say:

Definition: a thing is absorbed if it is in Hidden.

Ps. If you try to release something which is not absorbed using the code above, you’ll probably get a message saying that “That noun did not make sense in this context.” You should be able to change that using this monster of a rule (again, untested!):

Rule for printing a parser error when the latest parser error is the noun did not make sense in that context error and the player's command includes "release": say "You have not absorbed any such thing."

I avoid restricted grammar tokens like this unless it’s absolutely necessary. For this case, I would instead bias the disambiguation:

Does the player meaning releasing a not absorbed thing: it is very unlikely.

An action will only find things out of scope if you’ve used “any” in the grammar token. Take that out unless you want the release action to apply to things outside the location.

Ditto, but this seems like one of the rare situations where they’d be appropriate. If I understand the original question right, the “absorbed” things don’t really exist in the game, except in a some non-physical sense, and the “releasing” action can only meaningfully apply to absorbed things. Thus, it’s kind of similar to, say:

Thinking about is an action applying to one visible thing. Understand "think about/of [any known thing]" as thinking about. where “known things” might include things the player has seen in the past, or even unphysical, out-of-play things like “your misspent youth”.

…but he does want it to apply to things outside the location (and, indeed, only to certain things outside the location).

That said, I suppose an alternative to using “any” would be to use an explicit scoping rule, like this:

[code]
Releasing is an action applying to one visible thing.
Understand “release [something]” as releasing.

After deciding the scope of the player when releasing:
repeat with item running through absorbed things:
place the item in scope.

Does the player mean releasing something which is not absorbed: it is unlikely.
Instead of releasing something which is not absorbed, say “That is already here.”
[/code]The main difference between this and the “release [any absorbed thing]” is that this way, the message given if the player tries to release something unabsorbed will be different depending on whether the player can see the thing they’re trying to release. Also, despite the “does the player mean” rule, Inform may sometimes suggest unabsorbed things for release when using this method. (Specifically, this happens if there are two or more absorbed and one or more unabsorbed things that could match the player’s command.) Although both of these could be fixed (the latter using Jon Ingold’s Disambiguation Control extension), I’m not really convinced that either of them is desirable in the first place.

Thanks, I tried that and it worked a treat. I have to admit, half of the coding goes over my head but I think I’m finally beginning to get to grips with some of it.

Thanks again.