Item limit: Putting an object inside something you carry

I’m sure this is a relatively quick-fix but for the life of me I can’t find the solution in any of the guides I use or the documentation.

I’ve been thwarted by my own item limit! I’ve set the limit at 2 for the player (excluding worn items). At this point in the game the player, in the given situation MUST be carrying both a lit torch (the pesky problem from my last topic) and a bucket. The bucket was found in a small stream which contains water. When testing my code with actual gameplay I found that the game will give the player this response:

In the small stream are water and a bucket.

take bucket
put water in bucket
(first taking water)
You’re carrying too many things already.
You are carrying:
a bucket
a red silken cape (being worn)
a walking stick (providing light)

The corresponding code is:

Underground Stream is a room in A Cave.  Underground Stream is south of Grand Foyér.  "[if unvisited]You seem to have sumbled upon an underground stream deep in the cave.  Who knew there was going to be so much water in the dessert?[end if]  It's pretty cold down here.  The main cavern is to the North."  There is a small stream in Underground Stream.  The small stream is an open enterable scenery container. There is water in the small stream.  There is a bucket in the small stream.  The bucket is an open container. Description of bucket is "A small tin bucket.  It looks like it might hold about a gallon of water."  Description of the small stream is "The water here looks clear.  If you jumped in it would probably only come up to your ankles."

I expect there’s just a quick rule to solve this so if anyone knows the answer off the top of their head I’d love to hear it. Thanks!

Inform takes the position that you have to be holding something before you can insert it into something else. That’s why your inventory limit is being hit.

One way to deal with this is to create a ‘fill’ action (I’m assuming there isn’t one already) that will move the water directly into the bucket container. Then do something like this:

Before inserting the water into the bucket: try filling the bucket instead.
I’m leaving out a few intermediate steps here, and it’s untested. But does that explain the situation?


Yeah you’ve definitely sent me in the right direction. I have a rule for “filling it with” as follows:

Filling it with is an action applying to two things. Understand "fill [something] with [something]" as filling it with. Check filling it with: if the noun is not a container: say "[The noun] can't hold things, silly."
Still, I get the feeling that this rule, while Inform has accepted its code as correct, is not operating the way I think it is. I don’t think Inform knows that when I perform the action “fill bucket with water” that the bucket now contains water.

I tried a code like:

The noun now contains "[the second noun]"

Though that didn’t work.

When it’s used in conjunction with:

Instead of inserting water into bucket: try filling the bucket with instead.

it turns up this result:

put water in bucket
You must supply a second noun.

The syntax is “now the second noun is in the noun”. (ch. 8.11. in the manual.)

The parser pretty much says it: you forgot to say what to fill the bucket with. Try:

Instead of inserting water into bucket: try filling the bucket with water.

As a general note about “try:” you may be tempted to think of a situation like this as restarting the current action only with a different verb. But that’s not how “try” works. “Try” creates a whole new action that runs, potentially simultaneously, with the current one. It’s possible to have a very large number of actions going at once if each one tries another action. This happens in the library with situations where automatic actions are performed, such as opening a door before going through it – or in your case, taking the water before inserting it into a container. That’s caused by this rule in the library:

Check an actor inserting something into (this is the can't insert what's not held rule): if the actor is carrying the noun, continue the action; if the actor is wearing the noun, continue the action; issue miscellaneous library message number 26 for the noun; silently try the actor taking the noun; if the actor is carrying the noun, continue the action; stop the action.

It’s possible to modify the “current action” variable and then try it as a new action. There are even cases where it’s possible to change action variables in mid-action. But usually that’s not what you want to do.

After some fiddling around and checking more syntax problems it works like a charm!

Thanks guys, I really appreciate all the help!