Functions
There are quite a few functions that can be added to any text within ADRIFT 5. Functions must always be within percent (%) symbols. Any arguments must be provided in square brackets. If multiple arguments are required, these should be comma separated.
Many of these functions can automatically be generated by dragging the appropriate item the text area you wish the function to appear in.
Contents
- 1 CharacterDescriptor Function
- 2 CharacterName Function
- 3 CharacterProper Function
- 4 ConvCharacter Function
- 5 DisplayCharacter Function
- 6 DisplayLocation Function
- 7 DisplayObject Function
- 8 LCase Function
- 9 ListHeld Function
- 10 ListExits Function
- 11 ListObjectsAtLocation Function
- 12 ListWorn Function
- 13 ListObjectsOn Function
- 14 ListObjectsIn Function
- 15 ListObjectsOnAndIn Function
- 16 LocationName Function
- 17 LocationOf Function
- 18 NumberAsText Function
- 19 ParentOf Function
- 20 PCase Function
- 21 Player Function
- 22 PopUpChoice
- 23 PopUpInput
- 24 PropertyValue Function
- 25 Rand Function
- 26 TheObject/TheObjects Function
- 27 UCase Function
CharacterDescriptor Function
Returns the full descriptor (including article and prefix) of the character. ADRIFT will need to determine whether the article should be replaced with "the". A "Bad Function" error will occur in Runner if this function is used on a character that does not have a descriptor. If the point of view of the player character is switched to another character which does not have a descriptor then this function will return "me" or "myself", but only if they are unaltered in the descriptor field of the character with the blue icon named "Player".
NB. Available from version 5.0.17.
Syntax
%CharacterDescriptor[key]%
Parameters
- key - The key of the character you wish to display the name of.
CharacterName Function
If the character is known (this will depend on the Known property, if it exists), or the character descripter field is blank, this function returns the proper name of a particular character. If the proper name field is blank this function will return "Anonymous". However, if the character is not known and the character descripter field is NOT blank, it will return the character descriptor instead.
For the player character this function will return "I" in first-person mode, "you" in second-person mode, and the proper name in third-person mode (which defaults to "Anonymous" for the default player character).
Syntax
%CharacterName[key]%
Parameters
- key - The key of the character you wish to display the name of.
CharacterProper Function
Returns the proper name of a particular character. For the default player character, and any character with a blank proper name field, it will return "Anonymous".
NB. Available from version 5.0.17.
Syntax
%CharacterProper[key]%
Parameters
- key - The key of the character you wish to display the name of.
ConvCharacter Function
Returns the key of the character the player is currently in conversation with.
Syntax
%ConvCharacter%
Parameters
- none
DisplayCharacter Function
Displays the description of a particular character
Syntax
%DisplayCharacter[key]%
Parameters
- key - The key of the character you wish to display the description for.
DisplayLocation Function
Displays the description of a particular character.
Syntax
%DisplayLocation[key]%
Parameters
- key - The key of the location you wish to display the description for.
DisplayObject Function
Displays the description of a particular object.
Syntax
%DisplayObject[key]%
Parameters
- key - The key of the object you wish to display the description for.
LCase Function
Returns a string that has been converted to lower case.
Syntax
%LCase[string]%
Parameters
- string - The text string you wish to convert to lower case.
ListHeld Function
Lists all the objects held by a particular character.
Syntax
%ListHeld[key]%
Parameters
- key - The key of the character you wish to list the held objects of.
ListExits Function
Lists all the exits available to a particular character.
Syntax
%ListExits[key]%
Parameters
- key - The key of the character you wish to list the exits for.
ListObjectsAtLocation Function
Displays a list of all the objects at a particular location. This will include dynamic objects directly at the location (i.e. not inside or on another object) and static objects which have been marked as explicitly list.
Syntax
%ListObjectsAtLocation[key]%
Parameters
- key - The key of the location you wish to list the objects at.
ListWorn Function
Lists all the objects worn by a particular character.
Syntax
%ListWorn[key]%
Parameters
- key - The key of the character you wish to list the worn objects of.
ListObjectsOn Function
Lists all the objects on a particular object.
Syntax
%ListObjectsOn[key]%
Parameters
- key - The key of the object you wish to list the objects that are on.
ListObjectsIn Function
Lists all the objects inside a particular object.
Syntax
%ListObjectsIn[key]%
Parameters
- key - The key of the object you wish to list the objects that are in.
ListObjectsOnAndIn Function
Lists all the objects on and inside a particular object. This is basically the same as ListObjectOn and ListObjectsIn, but it gives the response in a nicer syntax when there are objects both on and in the object.
Syntax
%ListObjectsInAndIn[key]%
Parameters
- key - The key of the object you wish to list the objects that are on and in.
LocationName Function
Returns the short description of a particular location.
Syntax
%LocationName[key]%
Parameters
- key - The key of the location you wish to return the short description for.
LocationOf Function
Returns the key of the location of a particular character.
Syntax
%LocationOf[key]%
Parameters
- key - The key of the character you wish to find the location of.
NumberAsText Function
Returns a number written out as text.
Syntax
%NumberAsText[number]%
Parameters
- number - Any non-negative integer value
ParentOf Function
Returns the parent key of an object. So for example, if an object is inside another object, or an object is part of a character, the function will return the key of the container object or character. If the function returns more than one parent (for example, the key supplied is a multiple object reference), the keys will be listed in a pipe separated list.
Syntax
%ParentOf[key]%
Parameters
- key - The key of the object you wish to find the parent of. This can also be a reference, for example %objects%.
PCase Function
Returns a string that has been converted to proper case (i.e. the first letter will be capitalised, and all other letters will be converted to lower case).
Syntax
%PCase[string]%
Parameters
- string - The text string you wish to convert to proper case.
Player Function
This function returns the key of the player character. This will normally always be known at design time, but if you switch characters during the game, it may be necessary.
Syntax
%Player%
Parameters
- none
PopUpChoice
Causes an input box to popup on the screen, displaying a short message prompt and two choices. The player chooses one of the two options and this becomes the value returned by the function. This could be used in an action to allow the player to choose which of two text strings is written to a variable, or in a restriction to determine if a task is executed. eg. It could be used to change the gender of the player character by optionally executing a task that changes the gender property from the default.
Syntax
%PopUpChoice[prompt, choice1, choice2]%
Parameters
- prompt - An expression (typically a quoted string) to display as a message in the inputbox.
- choice1 - An expression returned in the function if the user selects this option.
- choice2 - An expression returned in the function if the user selects this option.
PopUpInput
Causes an input box to popup on the screen, displaying a short message prompt and a single-line text entry field. The player can accept the default text or enter a new line of text, then press OK. This could be used to allow the player to enter their own name, which is then used in the game. If the player presses cancel then this function will return a zero-length string.
Syntax
%PopUpInput[prompt, default]%
Parameters
- prompt - An expression (typically a quoted string) to display as a message in the inputbox.
- default - Optional. An expression (typically a quoted string) to display in the text field of the inputbox.
PropertyValue Function
Returns the current value of a property of an object or character.
Syntax
%PropertyValue[key, propertykey]%
Parameters
- key - The key of the location, object or character you wish to obtain the property value of.
- propertykey - The key of the property you wish to obtain the value of.
Rand Function
The Rand function returns a random value between two integers.
Syntax
RAND(value1, value2)
Parameters
- value1 - The lowest possible value you wish the function to return.
- value2 - The highest possible value you wish the function to return.
TheObject/TheObjects Function
These two functions are identical. However, they are interchangeable to facilitate clearer readability, depending on your task output. These functions will display the full name of an object, replacing any indefinite articles with definite ones, i.e. the word “the”. If the function returns more than one object (for example, the key supplied is a multiple object reference), the objects will be listed in a comma separated list.
Syntax
%TheObject[key]%
Parameters
- key - The key of the object you wish. This can also be a reference, for example %objects%.
UCase Function
Returns a string that has been converted to upper case
Syntax
%UCase[string]%
Parameters
- string - The text string you wish to convert to upper case.