Group Functions

From ADRIFT 5 Manual Wiki
Revision as of 05:05, 10 September 2013 by Saabie (Talk | contribs) (filter functions)

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

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 3 parameters can be added to the "List" function, in any order, to control the formatting of the text output.

Each of these parameters has two settings, and if you type a "(" character immediately after the "List" function, the menu system will display a list of these six 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 ("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

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

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.

IconInteger.jpg Integer properties

  • Count - Counts the number of objects in the group

IconText.jpg Text properties

  • List - Lists the name of all of the items in the group.
    • Group1.List - List of objects in the group, eg "The short sword, the knife, the long sword and the broadsword"
    • %object%.Contents(objects).List - List of objects inside the referenced object.
    • Group1.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"
    • Group1.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.
    • Group1.List(Indefinite) - Instead of using the definite article eg. "The short sword", the indefinite article is used eg "A short sword"
    • Group1.List(Rows) - Each item will be listed on a new line:
The short sword 
The knife
The long sword
The broadsword

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:

IconFilter.jpg 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.

IconInteger.jpg Integer properties

  • Count - Counts the number of locations in the group

IconText.jpg Text properties

  • List - Lists the name of all of the locations in the group.
    • Group1.List - List of locations in the group, eg "The kitchen, the hall, your bedroom and the lounge"
    • Group1.List(Or) - The "Or" parameter changes the word between the last 2 items, eg "The kitchen, the hall, your bedroom or the lounge"
    • Group1.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 >>>