Text Boxes

Parent Previous Next

Text Boxes

All multi-line text boxes within ADRIFT are completely flexible as to how and what they display.  They are designed to look simple at first glance, with the user typing in basic descriptions.  They all support Syntax Highlighting to show functions, references, keys, comments and variables.  Alternative Descriptions can be used to append extra text, or completely change the displayed message, based upon Restrictions.

Preview

The Preview section has yet to be completed.  When done, this will allow you to see the text as it would appear in Runner.  It will also allow formatting to be applied in a WYSIWYG display.


If you wish to hide this tab (since it does nothing at the moment), you can do this in Settings, removing the tick against Enable Preview.

Graphics

See Graphics sub-section.

Audio

See Sound sub-section.

Drag and Drop

As well as being able to drag and drop pieces of text into the text boxes, you can also drag items from the main ADRIFT window into the boxes too.  This provides a quick way of creating functions.  So for example, if you drag a character from a list into a text window it will pop up a menu asking which property of the character you wish to display.  By selecting one of these entries, the corresponding function for your selection will be inserted into the text box at the cursor location.


  1. Open the edit form you wish to place a function on.  (If the edit window does NOT have a button on the windows taskbar, and you tend to run Developer in full screen, you may wish to add it by opening Settings and tick the Show all open windows in taskbar option.)
  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" the item to the edit window you wish to add the item to.  (If the window is not visible you can drag the item down to the button on the windows taskbar that represents the edit window.  Wait a moment until the edit window appears again, keeping the mouse button held down, then continue dragging the item to the edit window.)
  4. Drag the item to the position in the text that you want to insert the function.
  5. Release the mouse button.


If we drag an item to a text box, one of the following menus will be displayed.  These will create the following functions in the text box:


Locations

Location.Name

Location

Location.Description

Location.Exits.List

Location.Objects.List

Objects

Object.Name

Object

Object.Description

Object.Children(On).List

Object.Contents.List

Object.Children.List

Object.Parent

Tasks

Task

%TaskCompleted[Task]%

Characters

Character.Name

Character

Character.Description

Character.Held.List

Character.Worn.List

Character.Location

Character.Parent

Events

Event.Length

Event.Position

Event

Properties

<Item Key>.Property

Property

Variables

%<Variable Name>%

Variable

HTML Mark-up

ADRIFT supports a number of HTML mark-up codes, allowing the formatting of text to be enhanced.  Mark-up codes are tags that can be entered in the source code that denote the start or end of a style, such as bold or italics.


The supported codes are as follows:


Start Tag

End Tag

Description

<audio [play src="filename"/pause/stop] {channel=X} {loop=[Y/N]}>


Play, pause or stop an audio track on a particular channel.

<b>

</b>

Display the text between the tags in bold.

<br>


(Break).  Start a new line.

<c>

</c>

Use alternate (i.e. the same as the input text) colour.

<center>

</center>

Centralise the text between the tags.

<cls>


Clear the screen.

<del>


Delete the previous character.  Useful for tweaking formatting.

<font {size={+/-}number}{face=font_family} {color=#RRGGBB} >

</font>

Change the current font.


size: Sets the font size to number px.  This can be an absolute number, or it can be an adjustment to the existing font size.  E.g. <font size=18> will set the font size to 18px, whereas <font size=+2> will simply increase the font size by 2px.


face: Sets the font to font_family.  E.g. <font face="Courier">


color: Sets the font colour to hexadecimal code #RRGGBB.  In addition, the following named colours are supported: black, blue, cyan, gray, green, lime, magenta, maroon, navy, olive, orange, pink, purple, red, silver, teal, white and yellow.

<i>

</i>

Display the text between the tags in italics.

<img src="filename">


Displays an image.  Filename can also be a URL.

<left>

</left>

Justify the text between the tags to the left side of the screen.

<right>

</right>

Justify the text between the tags to the right side of the screen.

<u>

</u>

Display the text between the tags in underline.

<wait X>


Wait for X seconds.  This supports the use of decimal places, e.g. <wait 0.5>.

<waitkey>


Suspend text from outputting until the user presses a key.


Because tags in ADRIFT are replaced, if you actually want to display <> symbols in text, or display the name of a variable/function including the percentage symbols, you need to encode these.  The following encodings are supported in ADRIFT:


Code

Output

&gt;

>

&lt;

<

&perc;

%

&quot;

"


The following codes are also supported:


Code

Meaning

<!-- comment -->

A comment.  This will not be output in the final text, so is a useful way of adding comments into text boxes.

<# expression #>

See embedded expressions for more details.

Functions

A text box can just contain simple text, but to add variety to the text being output you can insert variables, functions, references and expressions anywhere in the text.


Variables are delimited by % symbols, so to display the contents of the "Score" variable you must insert %Score% into the text.


Item functions are used to display the values of the properties of an item (character, object or location).  If you enter the key of an item followed by a full-stop, ADRIFT will display a list of all of the properties of that item from which you can select the one that you want.  NOTE: Keys are case sensitive, so you must match the key exactly as it is defined.


General functions can be used to get the keys of the current player character (%Player%), the only other character in the same room (%AloneWithChar%) and the NPC that the player is talking to (%ConvCharacter%).  There are also useful functions to change the case of some text, capitalise the first character, or display a random number.


References are only available during the execution of a task.  If a task uses an object reference (i.e. %object% is used in the general tasks command template) then you can use %object% to provide the key for the functions above.


Expressions are for more complex equations than can be done with nested functions.  They can be used to calculate a mathematical equation, perform text manipulation, or choose between different text to display using an IF statement.  An expression inserted into text must be between the symbols <# and #>.


When the contents of the text box is displayed on the screen, ADRIFT makes several passes through the text to substitute variables and references with their contents, and the functions and expressions with the result of evaluating them.  This means that if a text variable contains an expression, ADRIFT will replace the variable with its contents in the first pass, then in the second pass it will recognise the inserted expression and execute it.


Substitution occurs in the following order:

  1. General Functions (recursively, including variable substitution)
  2. Item functions (recursively)
  3. Expressions (also includes function evaluation)
  4. Text Overrides
  5. Auto-capitalisation