Complicated holdall

I have a complicated object. Part of it is a container, and I would like to use that container as a player’s holdall. Unfortunately, because it’s only a part of the object, and not held directly by the player, the “use player’s holdall…” rule won’t do anything with it. Do I have to rewrite the whole rule to get this to work, or is there a simpler solution?

I’d also like the game to ignore the holdall if it is “unknown.” How the heck would I do that?

[code]The Cargo Hold is a room.

The Spacinator is a device in the cargo hold.

A rocket engine, a cup of cold tea, a toy dinosaur, and a motorcycle helmet are in the cargo hold.

The carrying capacity of the player is 2.

A thing can be known or unknown. The inner space is unknown.

The inner space is a player’s holdall. It is closed. Understand “hole” as the inner space. It is part of the spacinator.

Before inserting anything into the Spacinator, try inserting the noun into the inner space instead.

Before removing anything from the Spacinator, try removing the noun from the inner space instead.

Instead of switching on the spacinator:
say “A hole, black as ink, opens up in the side of the Spacinator.”;
Now the inner space is open;
Now the inner space is known.

Instead of switching off the spacinator:
say “The hole on the side of the Spacinator shrinks down to a pinpoint and disappears.”;
Now the inner space is closed.

test me with “get spacinator/switch it on/get engine/put engine in spacinator/get tea/get dinosaur”[/code]

By the way, I just noticed that the “before removing anything from the spacinator…” rule doesn’t do anything useful to “get engine from Spacinator.”

Maybe it makes more sense for the container to be the “main” object and have the other things (such as devices) be parts of that?

I still have the known/unknown issue, though.

Rewriting and replacing the “use player’s holdall” rule is the easiest solution as far as I can tell. It’s not very long.

Am I the only person that would want a “replace this rule” button next to the “unlist” button in the Index?

It would automatically paste:

The foo rule is not listed in the bar rulebook.

Rule for frobbing the glitch (this is the new foo rule):
    [copy of foo rule]

[edit]I think the pasted code would also have to establish the right rule order somehow (in this case, the “use player’s holdall” rule must come before the “can’t exceed carrying capacity” rule.) I don’t know how that’s traditionally done.[/edit]

Maybe I’m just intimidated by looking for rule text in source files, but it seems like this convenience would be eminently useful.

Speaking of looking through source files, is there an Inform 7 plugin for MacVim?

Thanks for your encouragement, Andrew. Here is the new (rather long), semi-working code with the player’s holdall rule replaced:

[spoiler][code]The Cargo Hold is a room.

The Spacinator is a device in the cargo hold.

A rocket engine, a cup of cold tea, a toy dinosaur, and a motorcycle helmet are in the cargo hold.

The carrying capacity of the player is 2.

A thing can be known or unknown. The inner space is unknown.

The inner space is a player’s holdall. It is closed. Understand “hole” as the inner space. It is part of the spacinator.

The use player’s holdall to avoid exceeding carrying capacity rule is not listed in the check taking rulebook.

The new use player’s holdall rule is listed before the can’t exceed carrying capacity rule in the check taking rulebook.

check an actor taking (this is the new use player’s holdall rule):
if the number of things carried by the actor is at least the
carrying capacity of the actor:
if the actor encloses a known player’s holdall (called the current working sack):
let the transferred item be nothing;
repeat with the possible item running through things carried by
the actor:
if the possible item is not lit and the possible item is not
the current working sack and the possible item does not enclose the current working sack, let the transferred item be the possible item;
if the transferred item is not nothing:
issue library message taking action number 13 for the
transferred item;
silently try the actor trying inserting the transferred item
into the current working sack;
if the transferred item is not in the current working sack, stop the action;

Before inserting anything into the Spacinator, try inserting the noun into the inner space instead.

Before removing anything from the Spacinator, try removing the noun from the inner space instead.

Instead of switching on the spacinator:
say “A hole, black as ink, opens up in the side of the Spacinator.”;
Now the inner space is open;
Now the inner space is known.

Instead of switching off the spacinator:
say “The hole on the side of the Spacinator shrinks down to a pinpoint and disappears.”;
Now the inner space is closed.

test me with “get spacinator/get engine/get tea/switch spacinator on/get tea/get dinosaur/put engine in spacinator”
[/code][/spoiler]

I say semi-working because Library Message 13 seems a little confused (do I have to dig through source code again? Crikey!). It says “(putting the rocket engine into nothing to make room)” - sounds like it’s lost track of the object of the command.

No matter, though, simple enough to change that to a “say” phrase instead.

I think all you need to do here is something like:

This is the new foo rule:
    [whatever you want the new foo rule to do]

The new foo rule is listed instead of the foo rule in the bar rulebook.

That looks great! Is there an official place for feature requests?

inform7.uservoice.com/

Uh oh, this situation is worse than I thought. Here’s a new twist:

[spoiler][code]The Cargo Hold is a room.

The Spacinator is a device in the cargo hold.

A rocket engine, a cup of cold tea, a toy dinosaur, and a motorcycle helmet are in the cargo hold.

The carrying capacity of the player is 2.

A thing can be known or unknown. The inner space is unknown.

The inner space is a player’s holdall. It is closed. Understand “hole” as the inner space. It is part of the spacinator.

The new use player’s holdall rule is listed instead of the use player’s holdall to avoid exceeding carrying capacity rule in the check taking rulebook.

[edit]Oh dear. Pardon me. “You haven’t got that” is the standard library message for trying to drop something that you’re not carrying, whether or not you’re carrying it indirectly. Sheesh!

I guess I will be rewriting the “can’t drop what’s not held” rule.

This is the new use player’s holdall rule:
if the number of things carried by the actor is at least the carrying capacity of the actor:
if the actor encloses a known player’s holdall (called the current working sack):
let the transferred item be nothing;
repeat with the possible item running through things carried by the actor:
if the possible item is not lit and the possible item is not the current working sack and the possible item does not enclose the current working sack, let the transferred item be the possible item;
if the transferred item is not nothing:
issue library message taking action number 13 for the transferred item;
silently try the actor trying inserting the transferred item into the current working sack;
if the transferred item is not in the current working sack, stop the action;

Before inserting anything into the Spacinator, try inserting the noun into the inner space instead.

Before removing anything from the Spacinator, try removing the noun from the inner space instead.

Instead of switching on the spacinator:
say “A hole, black as ink, opens up in the side of the Spacinator.”;
Now the inner space is open;
Now the inner space is known.

Instead of switching off the spacinator:
say “The hole on the side of the Spacinator shrinks down to a pinpoint and disappears.”;
Now the inner space is closed.

test me with “get spacinator/turn spacinator on/get engine/put engine in spacinator/drop engine”[/code][/spoiler]
This is essentially the same code, but I’ve changed the test to show this problem:

It appears that something that’s inside a part of an object that the player carries doesn’t count as something that the player has.

I haven’t looked at the code for the check dropping rule yet, so I’m not sure where I’ll be able to change the code…

Or perhaps I should go back to making the container the main object, and the device a part of it?

Oh dear. Pardon me. “You haven’t got that” is the standard library response anytime you drop something you’re not holding, regardless of whether you’re holding it indirectly.

I guess I’ll be rewriting the “can’t drop what’s not held” rule.