Key

From ADRIFT 5 Manual Wiki
Revision as of 08:15, 30 August 2012 by Saabie (Talk | contribs) (Using Keys)

Jump to: navigation, search

Every location, object, task, character, event, variable, group, property, text override, hint and folder in ADRIFT has a unique KEY.

A key is just a name that can consist of letters, numbers, and the underline character "_", but it cannot contain any spaces.

ADRIFT uses the key to identify each item so that, when you change the name of an item, every reference to it from other parts of the game will still point to the same item.

When you choose the name of an item from one of the drop-down lists, ADRIFT actually stores the key instead of the name. If you change the name of the item and then look at a restriction or action that uses it, you will see the new name of the item because ADRIFT used the stored key to find the item and then displayed its current name.

To display the key of every item on its title bar, open the Settings dialog box (from the main memu) and tick the box marked "Show keys on edit forms".

You can see the keys of every item in a folder by clicking on the funnel icon next to the close button at the top of the folder window:

FolderDetailsMenu.jpg

  • The funnel icon will not be there if you have changed the "View" of the window - you will need to change it back to "Details" view first.

Select the "Key" option to display the item keys in a separate column.

Here is a folder window with all 5 of the optional columns selected:

PropertyListDetails.jpg

The keys shown here are the name of the item with the spaces removed, which is typical of the standard library, but items you create yourself will normally consist of the type of item followed by a number, eg. Character2, Object4, Location426 etc.

  • If you have set a Key Prefix in the advanced options then it will be prepended to the key of items created after setting it.

Using Keys

Keys are most often used with Functions, either in a text box or an expression.

If you use the object-oriented_functions then ADRIFT will popup a list with the names of all of the relevant properties to choose from, but note that it is the KEY of the selected property that is then written into the text box.

If you need to use the %Functions% then you can either lookup the keys yourself and type them in, or use the following technique:

  1. Open the edit form you wish to place a function on.
  2. Move the mouse to the folder window containing the item you wish to use in the function.
  3. Position the mouse over the item and hold down the left button and "Drag" it to the text box.
  4. If the edit window disapears (which it usually does if its on top of the ADRIFT main window) then just:
    1. Drag the item down to the button on the windows taskbar that represents the edit window.
      • If the edit window does NOT have a taskbar button, then open the Settings form and tick the "Show all open windows in taskbar" option.
    2. Wait a moment until the edit window appears again (keeping the mouse button held down).
    3. Continue dragging the item to the edit window.
  5. Drag the item to the position in the text that you want to insert the function.
  6. Release the mouse button.


If we drag a character to a text box, five choices will be shown in a menu:

DragCharacter.jpg

  • Character Name - inserts: %CharacterName[Character1]%
  • Character description - inserts: %DisplayCharacter[Character1]%
  • List objects held by - inserts: %ListHeld[Character1]%
  • List objects worn by - inserts: %ListWorn[Character1]%
  • Location of - inserts: %LocationOf[Character1]%


If we drag an object to a text box, six choices will be shown in the menu:

DragObject.jpg

  • Object name - inserts: %TheObject[Object1]%
  • Object Description - inserts: %DisplayObject[Object1]%
  • List objects on - inserts: %ListObjectsOn[Object1]%
  • List objects in - inserts: %ListObjectsIn[Object1]%
  • List objects on and in - inserts: %ListObjectsOnAndIn[Object1]%
  • Parent of object - inserts: %ParentOf[Object1]%


If we drag a location to a text box, four choices will be shown in the menu:

DragLocation.jpg

  • Location name - inserts: %LocationName[Location1]%
  • Display Location - inserts: %DisplayLocation[Location1]%
  • Exits from Location - inserts: %ListExits[Location1]%
  • Objects at Location - inserts: %ListObjectsAtLocation[Location1]%