When things work, but don't work

The reason Inform is set up with an implicit TAKE action is to support all the ways that containers can be customized.

The library has the notion of a closed transparent container built in. But you could also have sticky containers, containers of liquids, spell books implemented as containers, noisy containers that shout when you remove anything from them, etc.

Inform’s policy is that as long as you implement these by customizing the TAKE action, you’ve covered all other library actions. No player command can move objects around without moving them through the inventory. Furthermore, any limitations on TAKE will appear as a failure message after the “(first taking…)” line, so the game logic will be reasonably clear to the player.

Of course you don’t have to maintain this policy. You can define any actions you want. But if you change the plan, you have to start being careful about custom containers.

7 Likes

I completely understand your point now, thank you! :grin:

You just opened up a whole new world of containers to me! :star_struck:

It seems like you want, in general, to modify the player’s reach for a group of verbs while maintaining the enclosure model. You also want the indirect actions to be silent. One way to do this is to add silent taking before those rules, then modify the way that taking works with a rule for reaching inside [1] [2]. This will respect all of the rules of complex containers, but open nested containers if possible to silently retrieve visible / known objects before subjecting them to other verbs like dropping / giving / throwing / et cetera.

Section - Silent unpacking

A rule for reaching inside a closed openable container (called the barrier):
	if the barrier is enclosed by the player:
		try silently opening the barrier.
		
Before giving a thing (called the item) to a person:
	try silently taking the item.
Before dropping a thing (called the item):
	try silently taking the item.
Before throwing a thing (called the item) at something:
	try silently taking the item.
Before eating a thing (called the item):
	try silently taking the item.

Here is a test game:

"Silent Unpacking" by Jeremy Douglass

Test brief with "drop doll / eat snack / feed treat to No-Face".
Test inspect with "i / drop doll / i / eat snack / i / feed treat to No-Face / i / x treat".

The block giving rule does nothing.

Section - Silent unpacking

A rule for reaching inside a closed openable container (called the barrier):
	if the barrier is enclosed by the player:
		try silently opening the barrier.
		
Before giving a thing (called the item) to a person:
	try silently taking the item.
Before dropping a thing (called the item):
	try silently taking the item.
Before throwing a thing (called the item) at something:
	try silently taking the item.
Before eating a thing (called the item):
	try silently taking the item.

Section - Bathhouse

The Grand Tub is a room. "The grandest Bathhouse tub room."
No-Face is an animal. It is here.
The player is here.

A gilded cage is an openable closed transparent container. It is carried by the player.
A cat doll is in the cage.
A glass box is an openable closed transparent container. It is in the cage.
A salty snack is in the box. It is edible.
A shiny wrapper is an openable closed transparent container. It is in the box.
A tasty treat is in the wrapper. It is edible.

After giving a thing (called the sacrifice) to No-Face:
	try silently No-Face eating the sacrifice;
	say "No-Face says 'More!'".	

>[1] drop doll
Dropped.

>[2] eat snack
You eat the salty snack. Not bad.

>[3] feed treat to no-face
No-Face says “More!”

Now you can give (and feed), drop, throw, or eat a multi-contained item without any “(first …)” messages being displayed. If you want to constrain this behavior to things enclosed by the player, you can add that as a condition.

2 Likes

Just to follow up, if you want to disable the standard “(first taking the x)” message – in all circumstances when an “implicit taking” is generated, making any indirect taking action in the game behave silently – here is how:

The silent implicit taking rule is listed instead of the standard implicit taking rule in the for implicitly taking rulebook.
This is the silent implicit taking rule:
	try silently taking the noun.
1 Like