Difference between revisions of "Object-oriented functions"

From ADRIFT 5 Manual Wiki
Jump to: navigation, search
m (Property Types)
(OO -> item)
Line 1: Line 1:
The object-oriented function syntax uses a dot character ("." the Full-Stop or decimal point) 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.
 
 
== Intellisense Menu's ==
 
If you type a reference, item key or %Function% that returns a key, then press the full stop "." key, ADRIFT will popup a menu of functions which are applicable to that type of item:
 
 
[[File:Intellisense.jpg]]
 
 
* If you now press the down-arrow key ADRIFT will show a description of the first function next to the menu.
 
: Pressing down-arrow again will move down the list showing the description of each function in turn.
 
: Press ENTER to insert the selected function after the "."
 
* You can also select a function by clicking on it with the mouse or typing part of its name to bring it to the top of the list.
 
* If you want to stop the intellisense popup or include text that looks like an object-oriented function, just insert an empty html tag like %character%<>. or Player<>.Held
 
 
== Property Types ==
 
 
[[File:IconLocation.jpg]] <b>Location properties</b>
 
 
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.
 
 
[[File:IconCharacters.jpg]] <b>Character properties</b>
 
 
These properties return the key of a character.
 
 
[[File:IconText.jpg]] <b>Text properties</b>
 
 
Returns text that can be displayed or stored in a text variable
 
 
[[File:IconInteger.jpg]] <b>Integer properties</b>
 
 
Returns a number that can be displayed, stored in an integer variable, or used in an expression.
 
 
[[File:IconGroup.jpg]] <b>Group properties</b>
 
 
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"
 
 
There are two special [[List Functions]] that can be appended to a group property, ".List" to list the members of the group, and ".Count" to return the number of group members as an integer value.
 
 
Some group properties are 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:Filter.png]] <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>
 
 
Returns the key of an object
 
 
[[File:IconStaticObject.jpg]] <b>Item properties</b>
 
 
Returns the key of an item (can be either a Character, an Object, or a Location)
 
 
==Function Lists==
 
[[Character Functions]]
 
 
[[Object Functions]]
 
 
[[Location Functions]]
 
 
[[List Functions]]
 
 
[[List of Object-oriented functions|Alphabetically sorted list]]
 
 
 
<TABLE ALIGN=CENTER BORDER=1 WIDTH="50%"><TD WIDTH="33%" ALIGN=CENTER>[[Key|<<< Key]]</TD><TD WIDTH="34%" ALIGN=CENTER>[[Main Page#Functions and Expressions|Main Page]]</TD><TD ALIGN=CENTER>[[Character Functions|Character Functions >>>]]</TD></TABLE>
 
[[Category:Functions]]
 

Revision as of 04:59, 4 March 2013