Difference between revisions of "Object-oriented functions"
m (→Function Lists) |
(→Property Types) |
||
Line 41: | Line 41: | ||
The function .Children(Objects,On) will filter the contents of the group to return only those which are objects and which are on top of the parent object. | The function .Children(Objects,On) will filter the contents of the group to return only those which are objects and which are on top of the parent object. | ||
+ | |||
+ | [[File:IconGroup.jpg]] <b>Group filters</b> | ||
+ | |||
+ | Any selection-only property can be used to filter a group property so that only the items with that property selected will remain. | ||
+ | |||
+ | The function "%object%.Contents(Characters).Known" will take the list of characters that are inside the given object and filter them with the "known" property so that only characters inside the object which are known to the player will be in the returned list. | ||
[[File:IconDynamicObject.jpg]] <b>Object properties</b> | [[File:IconDynamicObject.jpg]] <b>Object properties</b> |
Revision as of 00:45, 21 November 2012
The object-oriented function syntax uses a dot character ("." the Full-Stop) between an item key and one or more property keys, to allow direct access to the value of a property in text or an expression without having to use the more cumbersome %PropertyValue[]% function to access each one.
Adrift recognises an object-oriented function by the presence of a dot joining two words with no space between them. Therefore you dont need to use the % or <# delimiters to separate them from normal text.
- "Object2.Name" is a property, "Object2." is just the full-stop at the end of a sentence, and "42.56" is a number.
- The first word must be a recognised key with the first letter capitalised to activate the list of properties and functions when you press the "."
- Typing "Player." will activate the list, but "player." will not.
- The item key can come from a function (eg. %Player%.ProperName) or a reference (eg. %character%.ProperName)
- These functions are quite powerful because you can keep adding property names to the end of the function to get more complex information.
- For example: "Character2.CharacterAtLocation.Exits.Count" can be used to display the number of accessable exits from the current location of character 2.
Property Types
These properties return the key of a location. These would not normally be displayed to the player, but can be used to access properties of the location by adding another dot followed by the name of a property that locations can have.
These properties return the key of a character.
Returns text that can be displayed or stored in a text variable
Returns a number that can be displayed, stored in an integer variable, or used in an expression.
These are basically a list of key names which are displayed with a pipe symbol "|" between each one.
eg. %Player%.CharacterAtLocation.Exits is displayed as "North|East|South"
Group properties themselves have two properties, ".List" to list the members of the group, and ".Count" to return the number of group members as an integer value, and some may also have container properties.
Some group properties can also be used as functions which use parameters to filter the results.
For example the "Children" group can contain both Objects and Characters, and these can be either on or inside the parent object.
The function .Children(Objects,On) will filter the contents of the group to return only those which are objects and which are on top of the parent object.
Any selection-only property can be used to filter a group property so that only the items with that property selected will remain.
The function "%object%.Contents(Characters).Known" will take the list of characters that are inside the given object and filter them with the "known" property so that only characters inside the object which are known to the player will be in the returned list.
Returns the key of an object
Returns the key of an item (can be either a Character, an Object, or a Location)
Function Lists
<<< Key | Main Page | Expressions >>> |