Check if a player has already something (with pockets)

When I played adventures in the past, it always bothered me that I may have forgotten to take something in the beginning of the game that is essential later.

  • I wanted to be fair in my story and would like to give the player a hint that not all essential things were taken yet. That was easy. So before leaving a place, I checked if the player had three things and if not, warned the player (only once, they can leave anyway).

  • Inspired by @Zed 's answer, I wanted to make it more difficult for the player to take things by using the carrying capacity. I imagined the the player wears something with pockets, and also has his hands to carry stuff. I also managed to implement this, by modelling pockets:

    The pockets are nightwear-pockets. The pockets are part of the pyjamas. 
    The player wears pyjamas.

Now it got complicated, because I cannot foresee if the player will put the essential things in his pockets or just take them (players need to do that, because I have three essential things, and I limited the carrying capacity of the player to two).

So my idea was to implement two functions:

  • One that goes through the belongings of the player (worn or carried) and adds all things to a list possessions. This list is supposed to be a flat inventory, omitting containers, but adding what’s in them.
  • One that checks if all items in the list of essentials can be found in the list of possessions.

My problem is the first one, because the pockets are part of the pyjamas. Is there a way to check if a worn thing or a carried thing has parts or is a container?

I might use only one decide on function (phrase), because I had troubles passing a list to a To phrase. When using it in my condition, it looks somewhat like this:

	If { thing1, thing2, thing3 } is taken:

“if player encloses [item]”
This will cover anything the player has regardless of where he has it. :grinning:


🤦 Really? That simple?

1 Like

I was stunned too. lol

Thanks @Arlan, works like a charm.

My function shrunk then to this:

To decide whether (essentials - a list of things) is taken:
	repeat with item running through essentials:
		if the player does not enclose item:
			decide on false;
	decide on true.
1 Like