[I6] Handling body parts as containers in inventory

Hello! So, I’ve finally got around to starting to work on this IF idea that’s been in my head for some years. I use I6, because I don’t really like the wordy I7 syntax, the games become slow, and anyway I’m the programmer kind of person who doesn’t mind dabbling I6. Well, more on that elsewhere.

Is this a good place to ask my maybe silly questions on I6? For example:

How do you handle body parts which are containers? Like, you want to hide a diamond in your mouth, put dough in your ear like in KQ3, stuff a pea up your nose?

I’m aware of two ways to do body parts:

  1. Give them to the player as items. But then they show up in the inventory. “You are carrying: A mouth, a nose, an ear…” I could add invent[; rtrue;] to them, but then I see ugly blank lines in the inventory list!
    Also, how do I achieve: “A pea (up your nose), some dough (in your ear), a diamond (hidden in your mouth)”? I assume writelist.h is my friend, right?

  2. The other solution I’ve seen is to put them in the player’s scope. Then they don’t show up in the inventory, but if I put things into them, these disappear from the inventory, too! And it’s hard to get them back. I’d like to just “give diamond to troll”, automatically “(taking the diamond out of your mouth first)”.

So, am I down the completely wrong road? Would it be easier to give the diamond an “in_mouth” flag? Or give all jewelry a “has inmouthputtable”?

Or is there some magic bodyparts.h somewhere which I could just use?

I think that triform’s anatomy property fit your bill. But triform isn’t a “magic .h” (whose are called extensions) but an alternate library, replacing Graham’s standard library, and also has a more elaborate and flexible container/supporter handling, worth a shot in your context

On top of it, you’re lucky, because triform was just updated last month, and I’m just fooling around it (up to having uncovered a minor but embarassing oversight…) so at least I can point to this (Indeed, this weekend I have fooled/messed around both triform’s anatomy and container handling (but not together…)

Best regards from Italy,
dott. Piergiorgio.

My first approach would be:

Add the body parts to scope. Create a class for objects which can be carried in/on a body part. Add a (possibly individual) property “bodypart_parent” which indicates that an object is in/on a certain bodypart. Add an invent routine to the class which can describe where the object is. Add an after routine which sets bodypart_parent to 0 whenever the object gets a new parent.

1 Like

Thank you for the great tips! Fredrik’s idea sounds like a good way to go, but Triform seems to offer quite a few interesting features which make some other things more convenient. So I think I’ll give that a try…