Group Functions
Contents
Using the group functions
The group functions operate on several item keys at once.
There are four types of groups, those containing Characters, Objects, Locations, or any Items.
A group of item keys are separated by the pipe "|" symbol, and looks like these if printed:
Object2|Object5|Object7 Character2|Character3|Character5|Player
The group functions are appended to a reference or function that generates more than one key, and is used to format it for output or to count the number of items in the list.
Item groups can be generated from:
- A group (Which come in three types: Object groups, Character groups and Location goups)
- The multi-item references %characters% and %objects%
- Functions which return the keys of items worn by or held by a character.
- Functions which return the keys of items contained inside or placed on top of an object.
- Functions which return the keys of Characters or Objects at a Location.
If you enter any of these followed by a full stop ".", a menu will popup which contains the "Count" and "List" functions plus several filter functions.
Count
This function simply counts the number of item keys in the group and returns the number of items as an integer number.
This number can then be printed or used in an expression
List
The list function is used to format a group of items for output. It reads the name of each item and prints them in a comma-delimited list with "and" or "or" inserted between the last two items.
Up to 4 parameters can be added to the "List" function, in any order, to control the formatting of the text output.
Three of these parameters have two settings, and if you type a "(" character immediately after the "List" function, the menu system will display a list of these seven options:
Three of these options ("True", "Definite" and "And") are default values, so the function "Player.Worn.list" means the same as "Player.Worn.list(True, Definite, And)"
True/False
This parameter indicates whether the list should include the contents of each item as well as the items themselves.
The default value is True, so the text "You are carrying %player%.Held.List" might print:
You are carrying a fountain pen, a large sword and a leather pouch. Inside the leather pouch is a gold coin
If instead you enter "You are carrying %player%.Held.List(False)" you will only get:
You are carrying the fountain pen, the large sword and the leather pouch
Definite/Indefinite
This parameter controls whether each item is printed with the definite ("the box") or indefinite ("a box") article.
The default is Definite, so "You pick up %player%.Held.List" will print:
You pick up the fountain pen, the large sword and the leather pouch
while "You can see %player%.Held.List(Indefinite) the other side of the portal" will print:
You can see a fountain pen, a large sword and a leather pouch the other side of the portal
And/Or
This parameter chooses the word that is placed between the last two items in the list.
"You pick up %player%.Held.List" will print:
You pick up the fountain pen, the large sword and the leather pouch
but if you want to use a negative sentence, it would be better to write "You can't pick up %player%.Held.List(or)" which will substitute the word "or" in place of the word "and":
You can't pick up the fountain pen, the large sword or the leather pouch
Rows
- Group1.List(Rows) - Each item will be listed on a new line:
The short sword The knife The long sword The broadsword
Filter functions
The options with the icon are selection-only properties that can be used to filter the group.
For a group of objects these will be object properties, and for a group of characters these will be character properties.
Any number of these can be appended to the function to filter the group so it only includes the items with those properties selected.
The function "%character%.Worn.Edible.Readable.List" will take the group of objects currently being worn by the referenced character, select only those that are both edible and readable, then print them in a comma delimited list.
Character Group Functions
If you enter the key of a character group, or use one of the group property functions that return a list of characters, then entering a dot "." after it will popup this list of character group functions:
Object Group Functions
If you enter the key of an object group, or use one of the group property functions that return a list of objects, then entering a dot "." after it will popup this list of object group functions:
These functions filter a list of objects to only include those with the property selected.
- Characters can go inside this object (CharactersCanGoInOb)
- Characters cam lie on this object (Lieable)
- Characters can sit on this object (Sittable)
- Characters can stand on this object (Standable)
- Object can be locked (Lockable)
- Object can be opened and closed (Openable)
- Object is a container (Container)
- Object is a supporter (Surface)
- Object is drinkable (Drinkable)
- Object is edible (Edible)
- Object is readable (Readable)
- Object is Wearable (Wearable)
- Specifically exclude object from location descriptions (dynamic objects) (ExplicitlyExclude)
- Specifically list object in location descriptions (static objects) (ExplicitlyList)
Location Group Functions
If you enter the key of a location group, then entering a dot "." after it will popup this list of location group functions:
These functions filter a list of locations to only include those with the property selected.
Locations initially have no properties, so you will not see any of these listed unless you create your own selection-only properties for locations.
Examples
- LightSources.List - List of objects in the "Light Sources" group, eg "The flaming torch, the lantern and the candle"
- %object%.Contents(objects).List - List of objects inside the referenced object.
- Weapons.List(Or) - The "Or" parameter changes the word between the last 2 items, eg "The short sword, the knife, the long sword or the broadsword"
- LightSources.List(False) - Normally this function will recursively list the items inside of the items in the group as well as the group itself. If you specify the "False" parameter then only the items in the group will be listed.
- Weapons.List(Indefinite) - Instead of using the definite article eg. "The short sword", the indefinite article is used eg "A short sword"
- DarkLocations.List - List of locations in the "Dark Locations" location group, eg "The kitchen, the hall, your bedroom and the lounge"
- DarkLocations.List(Rows) - Each location will be listed on a new line:
The kitchen The hall Your bedroom The lounge
<<< Event Functions | Item functions | List of Item functions >>> |