Another teaser...

In my game, I have a backpack with a pair of black straps, and a walking staff. Instead of putting the staff inside the backpack, I have the player sliding the staff through the straps(which go around the shoulders). I made the straps a ‘part of the backpack’, and an ‘open and unopenable’ container. The only thing that can go into the straps is the staff(all other objects get a ‘that just won’t fit’ response). The trouble is, when you take inventory, the staff is not listed when it is ‘in’ the pair of straps. I tried the following–

Rule for listing contents of the backpack when taking inventory: if the staff is in the pair of straps: say "(your staff is laying well-balanced in the straps.)"

The staff is still not listed.

Any hints?

Thanks.

I take it this has something to do with the straps being a part of the backpack…?? Though it’s an ‘open container’…??

Hmm. I’m not familiar enough with Inform to figure out the problem without having a stand-alone piece of code at hand (e.g., something that can be compiled and run). You might want to try putting the staff into the pair of straps and then typing “showme staff” to make sure it is behaving the way you expect it to.

Although I’m pretty sure the problem here is that your rule is not firing at all. You might need to just create a custom inventory rule that takes the staff into account. If it were not an issue of the staff being inside something that is part of the backpack, it would be simpler (just write an “after printing the name of the staff while taking inventory” rule that appends " (nestled safely in the pair of straps)" or something like that), but it looks like things are more complicated than that. Hopefully a more knowledgeable individual will come along and clarify how things work. I’m actually quite curious to know myself.

On the grammar front, though, I can say that it should be “Your staff is lying well-balanced in the straps.” “To lay” is a transitive verb, which means it requires an object (so you could say, “You lay your staff carefully on the table.”).

I’d say that is an unnecessarily cumbersome way to do this. You can just have it placed in your backpack like normally but substitute the way it’s written:

[spoiler][code]
Example Location is a room.

The staff is in Example Location.

The backpack is a wearable container.
The player is wearing the backpack.

Instead of inserting the staff into the backpack:
say “You place the staff between the straps of your backpack.”;
now the staff is in the backpack.

Instead of dropping the staff when the staff is in the backpack:
say “You slide the staff out from the straps and drop it on the ground.”;
now the staff is in the location.

After printing the name of the staff when taking inventory:
if the staff is in the backpack:
say " (lying well-balanced in the straps.)"[/code][/spoiler]
It’s your game and entirely up to you, but I find that the illusion of realism almost always beats realism. Unless it’s part of a puzzle, and the player is supposed to figure out where the staff will go, I’d say scrap the straps entirely.

Thank you, Suho, for your thoughts–
I looked all up and down the manual about the ‘rules for taking inventory’, and there is a phrase ‘Include contents’–but that is already in the standard code, and there is a phrase ‘include all contents’, but this does not seem to include the contents for parts of things. At any rate, I really don’t want to mess with the standard rules for inventory, until I am ready to focus on that(I really want to continue creating and working on the main body of the game, sparing the details for later).
So you can lay the staff, but the staff does not lay, it lies…?? (I wonder what other lies it has told me…??)
Thanks

You’re welcome, although I doubt I was all that much help. :slight_smile:

Don’t know if you saw itsgallus’ post above; s/he has an interesting idea for getting around the problem and simplifying things considerably.

itsgallus,
Actually, the staff in the straps is a part of a puzzle in another part of the game. The staff actually is too big to fit into the pack(although the pack is a holdall, certain objects are too big to reasonably fit into it). I have written in text and some rules that let the player know about the straps or fit the staff into them automatically. In one part of the game, he will have to do a particularly tricky jump.

Thanks

I see! That sounds like a cool puzzle! I think – but I’m not sure – that the main problem is that listing the contents of a container that is part of another container isn’t part of the inventory rules. You could do a work-around like this:

After taking inventory: if the staff is in the straps and the player is wearing the backpack: say "The staff is lying well-balanced in the straps of your backpack."

That way it’ll look something like this:

[code]

i
You are carrying:
some other things
a backpack (being worn)

The staff is lying well-balanced in the straps of your backpack.[/code]

Might not be as elegant as you’d like, but it’s easier than rewriting the inventory rules.

Edit: Another way is to simply rewrite the inventory text:

[spoiler]Instead of taking inventory: if the number of things carried by the player is greater than 0: say "You're carrying [a list of things carried by the player]. "; otherwise: say "You aren't carrying anything. "; if the player is wearing the backpack: if the number of things in the backpack is greater than 0: say "In your backpack is [a list of things in the backpack]."; otherwise: say "Your backpack is empty."; if the staff is in the straps: say "The staff is lying well-balanced in the straps."

It will turn out like this:

[code]Example Location
You can see a staff and a watch here.

take watch
Taken.

put watch in backpack
You put the watch into the backpack.

i
You aren’t carrying anything. In your backpack is a watch.

put staff in straps
(first taking the staff)
You put the staff into the straps.

i
You aren’t carrying anything. In your backpack is a watch.
The staff is lying well-balanced in the straps[/code][/spoiler]

It’s because the straps are a “part of” the backpack. Inventory doesn’t list parts. For example, the following code:

The foo is carried by the player. The bar is part of the foo.

Generates the following response:

Since the straps are never listed in inventory, the straps’ contents will never be listed, either. You’ll have to write a special rule for it.

Thanks itsgallus, I think I will use your suggestion of rewriting the inv. list. I kind of like the idea of redesigning it, actually.

Mike, yep I figured it had to do with the straps being a ‘part’. Previously, I was allowing the player to be able to ‘wear’ the staff, but only if he happened to also be wearing the backpack. Not very ‘realistic’, especially as I am writing in another puzzle where the player will have to crawl under a house, which will not allow him to ‘wear’ the backpack, he will be required to drag the pack along, without being able to carry anything else with him. Without giving too much else away, he will have to figure out how to bring along a light source, as he is looking for a way into the house(you know, locked, heavy-panel doors, locked plate-glass windows, your usual vacant mansion kind of problem). Come to think of it, he won’t be able to carry the staff in with it in the straps, because the hole he crawls through will be too narrow–hence an idea for another puzzle…I love this. I enjoy making games with lots of problems(wringing hands, evil grin).
Thanks