Group Functions

From ADRIFT 5 Manual Wiki
Jump to: navigation, search

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.

OoListFunctions.jpg

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

Sum

This function can only be used with integer properties.

It adds together the value of this property for all of the items in the group to give the total.

eg. %Player%.Worn.Weight.Sum would give the total weight of all of the items that the player character is wearing.

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:

OoListParams.jpg

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, which prints the actual article of the object.

The default is Definite, so "You pick up %player%.Held.List" will print:

You pick up the gold coins, the large sword and the leather bag

while "You can see %player%.Held.List(Indefinite) the other side of the portal" will print:

You can see some gold coins, a large sword and sally's leather bag 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 Filter.png 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 IconGroup.jpg group property functions that return a list of characters, then entering a dot "." after it will popup this list of character group functions:

FunctionsCharacterGroup.jpg

IconFilter.jpg These functions filter a group of characters to only include those with the property selected. These are Boolean functions and correspond to selection-only properties. To filter for characters that dont have this property specify False in parentheses after the function name, eg. People.Known(False)

Selected Property Character Group Function
Maximum size of held items MaxBulk
Maximum weight of held items MaxWeight
Show character entering/exiting the location ShowEnterExit
Is this character known to the player Known

IconFilter.jpg These functions filter a group of characters to only include those with the corresponding state property set to a given state. All of the possible states of the property are listed in the parentheses after the function name. Choose one of these to filter the group so that only those characters with the property set to this state will be returned.

State Property Character Group Function States
Character position CharacterPosition(state) (Lying)
(Sitting)
(Standing)
Gender Gender(state) (Female)
(Male)
(Unknown)
Location of the character CharacterLocation(state) (At Location)
(Hidden)
(In Object)
(On Character)
(On Object)

Object Group Functions

If you enter the key of an object group, or use one of the IconGroup.jpg group property functions that return a list of objects, then entering a dot "." after it will popup this list of object group functions:

FunctionsObjectGroup.jpg

IconFilter.jpg These functions filter a list of objects to only include those with the property selected. To filter for objects that dont have this property specify False in parentheses after the property name, eg. %Player%.Held.Lockable(False)

Selected Property Object Group Function
... and the container can hold Capacity
... and the surface can hold SurfaceHold
Characters can go inside this object CharactersCanGoInOb
Characters can 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

IconFilter.jpg These functions filter a list of objects to only include those with the indicated state property set to the state value that is chosen as its parameter. The possible states for each property are listed in parentheses after the function name.

State Property Object Group Function State Parameters
Location of the object StaticLocation(state) (Everywhere)
(Hidden)
(Location Group)
(Part Of Character)
(Part Of Object)
(Single Location)
Location of the object DynamicLocation(state) (Held By Character)
(Hidden)
(In Location)
(Inside Object)
(On Object)
(Worn By Character)
Locked status LockStatus(state) (Locked)

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:

FunctionsLocationGroup.jpg

Locations initially have no properties, so you will not see any filter functions listed unless you create your own selection-only properties or state 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 FunctionsItem functionsList of Item functions >>>