Difference between revisions of "Group Functions"
m (removed too-technical term "intellisense") |
m (simplified some terminology) |
||
Line 31: | Line 31: | ||
== Count == | == Count == | ||
− | This function simply counts the number of item keys in the | + | 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 [[Expressions|expression]] | This number can then be printed or used in an [[Expressions|expression]] | ||
== List == | == List == | ||
− | The list function is used to format a | + | 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. | 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 | + | 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: |
[[File:ooListParams.jpg]] | [[File:ooListParams.jpg]] | ||
Line 47: | Line 47: | ||
=== True/False === | === True/False === | ||
− | This parameter indicates whether the list should include the contents of each item | + | 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: | The default value is True, so the text "You are carrying %player%.Held.List" might print: |
Revision as of 09:08, 3 September 2013
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.
Filter functions
The options with the icon are selection-only properties that can be used to filter the list.
For a list of objects these will be object properties, and for a list of characters these will be character properties.
Any number of these can be appended to the function to filter the list so it only includes the items with those properties selected.
The function "%character%.Worn.Edible.Readable.List" will take the list 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.
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:
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
<<< Event Functions | Item functions | List of Item functions >>> |