Incrementally adding things?

You guys have been so helpful so far, I really appreciate it!

Okay, so what I’m trying to do is have a hen lay multiple eggs in a nest. When the number of eggs gets to 10, I’d like the hen to be empty (more or less).

The issue is, in order to add eggs to the nest, I have to move random eggs…which means that sometimes eggs get moved back to the hen (I suppose) and then back to the nest, or out of my inventory and back to the nest. This is not good.

I’m searching through the documentation, and I can’t seem to find anything other than incrementing properties, scores etc. I tried enumeration using number of eggs in the nest + 1, but it doesn’t seem to like number of eggs in the nest except in the description ifs.

Is there a way to do this? Here’s my code to date:

[code]The Chicken Coop is a room. “You see chickens around the chicken coop.”

A hen is a portable animal. A hen is in the chicken coop. A nest is a container in the chicken coop.

An egg is a kind of thing. The plural of egg is eggs. An egg is edible.

Hens wear 10 eggs.

Rule for deciding the concealed possessions of the hen: yes.

Procedural rule while taking the hen:
ignore the can’t take other people rule.

After inserting the hen into the nest:
if the hen is wearing eggs:
say “The hen clucks and squawks, [if the number of eggs in the nest is 0]and all of a sudden she has laid an egg![end if] and protests!”;
now a random egg is in the nest;
otherwise:
say " Sadly, the hen shakes her head. She can lay no more eggs";[/code]

Unless there’s another reason for the hen to “wear” the eggs, you can start with the eggs out of play and check for the property “off-stage”.

[code]The Chicken Coop is a room. “You see chickens around the chicken coop.”

A hen is an animal. A hen is in the chicken coop. A nest is a container in the chicken coop.

An egg is a kind of thing. An egg is edible. There are 10 eggs.

This is the can’t take non-hen people rule:
if the noun is not the hen:
abide by the can’t take other people rule.

The can’t take non-hen people rule is listed instead of the can’t take other people rule in the check taking rulebook.

After inserting the hen into the nest:
if the number of off-stage eggs is greater than 0:
say “The hen clucks and squawks, [if the number of eggs in the nest is 0]and all of a sudden she has laid an egg![end if] and protests!”;
now a random off-stage egg is in the nest;
otherwise:
say " Sadly, the hen shakes her head. She can lay no more eggs";[/code]
The say phrase doesn’t work as expected and I don’t know what it’s trying to do. Is the hen not supposed to lay eggs if there’s one in the nest already?

(Also note that procedural rules are deprecated, so I’ve used another method of allowing to take the hen.)

I don’t think it’s necessary to have the eggs be out of play, but the important point that Juhana included is that you must specify where the random egg comes from. You could just as well have said “a random egg worn by the hen.”

Also, a point about chickens: Birds like to lay a clutch of eggs so they can set on several at once. If there is an empty nest and a nest with eggs in it, they will prefer to lay in the nest that has eggs, even if the eggs came from a different chicken, are a different color, or are made of wood! In fact that’s what the term “nest egg” refers to - a fake egg used to persuade chickens to lay in a particular place.

Please don’t let me ruin your game, though…