Difference between revisions of "Object-oriented functions"
(key from function or reference) |
|||
Line 8: | Line 8: | ||
For example: "Character2.CharacterAtLocation.Exits.Count" can be used to display the number of accessable exits from the current location of character 2. | 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) | ||
[[File:IconLocation.jpg]] <b>Location properties</b> | [[File:IconLocation.jpg]] <b>Location properties</b> |
Revision as of 08:15, 23 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)
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.
%Player%.CharacterAtLocation.Exits is displayed as "North|East|South"
Returns the key of an object
Returns the key of an item (can be either a Character, an Object, or a Location)