Hi,
This sounds like something you can adapt the Pizza Prince example to do… but you also need to count the number of evidence bags you have in play and adjust the printed name when necessary.
So this is what I can come up with, but it’s got some rickety bits:
[code]“Bags of Evidence Bags”
The Lab is a room.
The player wears a coat. A supply of evidence bags is in the coat. Understand “pocket” as the coat. Understand “bag” as the supply of evidence bags.
[this is a bit lazy compared to implementing the pocket separately–having a pocket as part of the coat is possible but will require some special inventory handling]
An evidence bag is a kind of container. An evidence bag has a number called identifier.
The printed name of an evidence bag is “evidence bag [identifier]”. An evidence bag is usually proper-named.
Understand the identifier property as describing an evidence bag. [allows the player to refer to bags as “evidence bag 3” etc.]
The identifier count is initially 1. [creates a variable that keeps track of how many evidence bags we have created.]
Evidence Bag Limbo is a room. Ten evidence bags are in Evidence Bag Limbo.
A clue is a kind of thing. Ten clues are in the Lab.
Instead of taking the supply of evidence bags:
let chosen bag be a random evidence bag in Evidence Bag Limbo;
if chosen bag is nothing: [That is, there were no bags remaining]
say “[too many bags]”;
otherwise:
move the chosen bag to the player;
now the identifier of the chosen bag is the identifier count;
increment the identifier count; [that is, increase it by 1]
say “You take a bag and name it [chosen bag].” [since this happens after changing the identifier of the chosen bag, it will print its new identifier]
To say too many bags:
say “You have too many bags to keep track of. Try emptying one and putting it back in your pocket.”
Rule for implicitly taking the supply of evidence bags:
let chosen bag be a random evidence bag in Evidence Bag Limbo;
if chosen bag is nothing: [That is, there were no bags remaining]
say “[too many bags]”;
otherwise:
move the chosen bag to the player;
now the identifier of the chosen bag is the identifier count;
increment the identifier count; [that is, increase it by 1]
say “(taking [chosen bag] from your pocket)”;
now the noun is the chosen bag.
[Recycling the bags]
Definition: a container (called vessel) is empty if nothing is in the vessel.
After inserting an empty evidence bag into the coat:
move the noun to Evidence Bag Limbo;
continue the action.
[and now we have a bunch of grotty stuff about trying to make sure we interpret the player’s command correctly]
Does the player mean taking a held bag: it is very unlikely.
Does the player mean inserting something into the supply of evidence bags: it is very unlikely.
Does the player mean doing something with an evidence bag (called the first bag) when the player’s command includes “1”:
if the identifier of the first bag is 1, it is very likely.
[/code]
That last line has to do with an issue where the number 1 can be understood as anything whatsoever, so you sometimes have to give the parser an extra nudge to associate the number 1 with the right thing.
Also despite my best efforts, sometimes when you do “take bag/take bag” it decides you mean the bag you just took. I’m not sure what’s going on here–I’m not that good with Does The Player Mean rules.
Anyway I hope this is a good start!