Grouping Rules for Assemblies

I’m trying to control how assemblies are grouped together statements with assemblies.
Basically any behavior other than the default would be great.

[code]“Noodles” by “Anonymous Girly-Girl”

The Locker Room is a room.

Ownership relates a person (called the owner) to a thing. The verb to own means the ownership relation.

A cheerleader is a kind of woman.

Betsy and Alice are cheerleaders in the locker room.

A cheer locker is a kind of fixed in place container.
A cheer locker is usually openable and closed. [and locked, but for demo purposes not so much]
Every cheerleader owns a cheer locker (called her locker) which is within the locker room.
Rule for printing the name of a cheer locker: say “[owner]'s Locker”.
First before listing contents: group cheer lockers together as “lockers”.
Understand “locker for [something related by reversed ownership]” as a cheer locker.

In the locker room are 5 cheer lockers.

Dana and Carla are a women in the locker room.
Carla’s Locker is a cheer locker owned by Carla. It is here.
Dana’s Locker is a cheer locker owned by Dana. It is here.

test me with “open locker for alice / look”[/code]

The lockers that weren’t created with assemblies are fine (of course)
If I open Alice or Betsy’s locker I get a listing that looks right.

Is there some way to control equality/equivalence rules? That might do the trick too. It looks like the lockers being created by “Every cheerleader owns a cheer locker…” and “In the locker room are 5 cheer lockers.” are treated the same.

I experimented with using a pre-processor before. I may have to start doing that again… :frowning:

A good rundown of what can and cannot be done with assemblies might be nice if someone has the time to explain it all.

I’m not sure what behaviour exactly you want, but if you need better handling of how room descriptions are printed, you might want to look into the Tailored Room Descriptions and Room Description Control extensions. They let you create smarter and more specific rules for how things are listed in a room description. For example:

[code]“Noodles” by “Anonymous Girly-Girl”

Include Tailored Room Description by Emily Short.
Include Complex Listing by Emily Short.

The Locker Room is a room.

Ownership relates a person (called the owner) to a thing. The verb to own means the ownership relation.

A cheerleader is a kind of woman.

Betsy, Dana, Carla and Alice are cheerleaders in the locker room.

A cheer locker is a kind of fixed in place container.
A cheer locker is usually openable and closed. [and locked, but for demo purposes not so much]
Every cheerleader owns a cheer locker (called her locker) which is within the locker room.
Rule for printing the name of a cheer locker: say “[owner]'s Locker”.
Understand “locker for [something related by reversed ownership]” as a cheer locker.

[Room Description Control stuff goes here.]

Definition: A cheer locker is deeply dull: No.

A ranking rule for a cheer locker (called the item):
increase the description-rank of the item by 5.

Rule for writing a paragraph about a cheer locker:
let total-lockers be the number of cheer lockers in the location;
let open-lockers be the number of open cheer lockers in the location;
if open-lockers is greater than 0:
prepare a list of cheerleaders who own open cheer lockers;
say “There are [total-lockers in words] lockers here, out of which [open-lockers in words] [regarding open cheer lockers in the location][are] open (belonging to [prepared list]).[paragraph break]”;
otherwise:
say “There are [total-lockers] lockers here.[paragraph break]”;
now all cheer lockers in the location are mentioned.

test me with “open locker for alice / look”
[/code]

One thing to keep in mind with room description control is that if something is mentioned programmatically, it will also gain the “mentioned” property that means it won’t show up in later room descriptions; this is because it’s presumed that if something is brought up in one such paragraph, it was already listed explicitly as being in the location, in the paragraph for describing something else. To avoid this, we might give the cheerleaders some rules of their own that will stop them from being less interesting than their locker, so they’re listed first:

A ranking rule for a cheerleader (called the character):
	increase the description-rank of the character by 10.

Rule for writing a paragraph about a cheerleader:
	prepare a list of cheerleaders who are marked for listing;
	say "[The prepared list] are here, [if exactly one cheerleader is marked for listing]alone[otherwise]chatting excitedly[end if].[paragraph break]".

That isn’t quite what I wanted, but it’s better than what the default was giving.

What I really want is something more like “There are four lockers here labeled: ‘Alice’ (open), Betsy, ‘Carla’, etc.”, but I thought this example was more minimal.

I haven’t played around with the tailored room descriptions or complex listing. It looks like Tailored Room Descriptions doesn’t work with 6L38 though.

the group x together as y syntax works any time something is listed with “list of all xs” not just while looking so it’s potentially more generic.

I’m pretty sure Tailored Room Descriptions (from the public library) is working with 6L38; I used it in Terminator Chaser which was built with 6L38.

Anyway, you can achieve what you want with something similar to:

Rule for writing a paragraph about a cheer locker:
  let N be the number of cheer lockers which are marked for listing;
  prepare a list of cheer lockers which are marked for listing;
  say "There are [N in words] lockers here, labeled: [prepared list].".

Rule for printing the name of a cheer locker (called the target) while looking:
  say "[owner of target][if target is open] (open)[end if]".

(This will still require the previous code to mention cheerleaders before their respective lockers).

If you think the second rule in this example is too broad (Because for instance it might clobber the printing of the name of the locker in some other paragraph about a thing, such as when disclosing the exterior of something held inside a locker) you can create a new activity called “listing miscellaneous lockers” and wrap that logic in there.