Difference between revisions of "Object-oriented functions"

From ADRIFT 5 Manual Wiki
Jump to: navigation, search
(group properties)
(Functions with parameters such as ".Children(Objects,On)")
Line 33: Line 33:
 
eg. %Player%.CharacterAtLocation.Exits is displayed as "North|East|South"
 
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.
+
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.
  
 
[[File:IconDynamicObject.jpg]] <b>Object properties</b>
 
[[File:IconDynamicObject.jpg]] <b>Object properties</b>

Revision as of 06:49, 24 March 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 and 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 sentance, and "42.56" is a number.

These are quite powerfull 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.

The item key can come from a function (eg. %Player%.ProperName) or a reference (eg. %character%.ProperName)

IconLocation.jpg Location properties

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.

IconCharacters.jpg Character properties

These properties return the key of a character.

IconText.jpg Text properties

Returns text that can be displayed or stored in a text variable

IconInteger.jpg Integer properties

Returns a number that can be displayed, stored in an integer variable, or used in an expression.

IconGroup.jpg Group properties

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.

IconDynamicObject.jpg Object properties

Returns the key of an object

IconStaticObject.jpg Item properties

Returns the key of an item (can be either a Character, an Object, or a Location)

Function Lists

Character Functions

Object Functions

Location Functions