Difference between revisions of "Text Boxes"

From ADRIFT 5 Manual Wiki
Jump to: navigation, search
(Special Characters)
m (Fixed problem where IE refuses to recognised the proper spelling of Colour)
Line 102: Line 102:
 
The color is specified as three 2-digit hexadecimal numbers in the order red-green-blue.<br>
 
The color is specified as three 2-digit hexadecimal numbers in the order red-green-blue.<br>
 
&lt;font color="#000000"&gt; is black<br>
 
&lt;font color="#000000"&gt; is black<br>
&lt;font colour="#FF0000"&gt; is <font colour="#FF0000">bright red</font><br>
+
&lt;font colour="#FF0000"&gt; is <font color="#FF0000">bright red</font><br>
 
&lt;font color="#00FF00"&gt; is <font color="#00FF00">bright green</font><br>
 
&lt;font color="#00FF00"&gt; is <font color="#00FF00">bright green</font><br>
&lt;font colour="#0000FF"&gt; is <font colour="#0000FF">bright blue</font><br>
+
&lt;font colour="#0000FF"&gt; is <font color="#0000FF">bright blue</font><br>
 
&lt;font color="#C0C000"&gt; is <font color="#C0C000"><b>GOLD</b></font><br>
 
&lt;font color="#C0C000"&gt; is <font color="#C0C000"><b>GOLD</b></font><br>
 
The size N can either be specified as an absolute font size, or relative to the current font size.<br>
 
The size N can either be specified as an absolute font size, or relative to the current font size.<br>

Revision as of 02:48, 4 April 2012

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. Alternate Descriptions can be used to append extra text, or completely change the displayed message, based on Restrictions.

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 what you wish to display from:

Character Name
Character Description
List objects held by
List objects worn by
Location of

By selecting one of these entries, the corresponding function for your selection will be inserted into the textbox.

Similar menus are offered for the other item types.

Preview

This section has still to be completed. I am hoping that it will provide a preview of the text as it would be displayed in Runner. It may also be possible to apply formatting directly to the text.

Graphics

You can insert graphics into a piece of text by selecting the Graphics tab on the right hand side. This provides a handy preview and URL. You can enter a filename, or a URL from the Internet here. Internet images will be downloaded on the fly, which can minimize the size of your adventure. By default, this will display the graphic at the start of the section of text.

It is also possible to insert multiple images in any piece of text by using <img> tags. The format is <img src="filename or url">. Using the <img> tags also allows you to customise exactly where in the text it will appear. This is useful if, for example, you have <waitkey> or <wait X> tags in your text. Also, you may want different images to appear for different alternate descriptions

Sound

As with Graphics, you can insert an audio clip by selecting the Audio tab on the right hand side. This provides three main buttons, a channel selector, and a loop checkbox.

To play a sound, click the Play button. This will bring up the file dialog box, where you can select a WAV, MP3 or MID file. There are plans to allow OGG files in a later release. Once selected, you can preview the sound by right-clicking on the Play button. You can have the audio loop indefinitely by selecting the Loop checkbox.

ADRIFT has 8 sound channels. This means you can have background music on a particular channel, and overlay different audio clips on other channels. By default, everything will be on channel 1.

To pause a sound file (for example, you might want to pause a piece of music when a particular piece of text is displayed), select the Pause button. This will pause any piece of audio on the selected channel. When you next select to play sound on this channel, assuming it is the same audio clip then it will resume where it left off.

To stop a sound file, select the Stop button. If this piece of music is played again, it will start from the beginning.

As with the Play button, you can right-click on the pause/stop buttons to stop a piece of audio from being previewed.

As with graphics, you can control exactly when the sound will be played using tags. This is useful in case you want to play multiple sound effects in the same text box, or wish to play the sound after a wait command. The syntax is:

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

So for example: <audio play src="myfile.mp3" channel=2 loop=Y> or <audio pause channel=2>

Special Characters

The following symbol characters are used for special purposes, so cant be used freely in text.

< Less than This is used for HTML markup tags and to insert comments in the text. The tag finishes at the next > character.

To include a < character in text, use the code &LT; and for > use &GT;
Comments are placed between less-than/exclamation/minus/minus and minus/minus/greater-than, as shown below:

<!-- This is a comment -->

<# and #> mark the beginning and end of embedded expressions. This allows you to add logic within text windows. For example:

You have <# IF(Player.Held.Count > 1, "more than one", "zero or one") #> items.
% Percent Two of these are used as delimiters around variable names, functions and references that are embedded in the text and evaluated immediately prior to the text being output. Note that nested % symbols may be placed inside the brackets of a function. The equation finishes and normal text resumes at the next % symbol that is not enclosed by brackets.


The following special symbols are used inside embedded functions delimited by % symbols:

( ) Parentheses Used to delimit the parameter lists of math and string functions that can be used to calculate parameters for the % function.
[ ] Square brackets When used after a function name these are used to delimit the parameters for the function, [ ] is also used to indicate the index value when used with an array variable.
, comma Separates parameters in a parameter list.
< > Less than, greater thanMust be used in pairs inside of other brackets as Adrift does not currently nest different types of delimiter correctly.
To include a < character in text, use the code &LT; and for > use &GT;

HTML markup tags

Many standard HTML markup tags, and some unique Adrift tags, can be inserted into the text to control the formatting of the output.

<br> (break) Start a new line.
<img src="filename or url"> Insert an image into the text (see also the graphics section above).
<cls> Clear the screen.
<b>boldface</b> Write in boldface.
<u>underline</u> underline the text.
<i>italics</i> Write in italics.

<centre>Centralise text</centre>

or <center>Centralise text</center>
Centralise text
<right>right justify text</right> right justify text
&LT;Displays the < character
&GT;Displays the > character

<font colour="#RRGGBB">text</font>
(Note: "colour" can also be spelt "color")
or
<font size=N>text</font>
or
<font face="fontname">text</font>
or in any combination, eg:
<font colour="#RRGGBB" size=N face="fontname">text</font>

Allows the text color, font or point size to be changed.

The color is specified as three 2-digit hexadecimal numbers in the order red-green-blue.
<font color="#000000"> is black
<font colour="#FF0000"> is bright red
<font color="#00FF00"> is bright green
<font colour="#0000FF"> is bright blue
<font color="#C0C000"> is GOLD
The size N can either be specified as an absolute font size, or relative to the current font size.
<font size=10>text</font> creates text slightly smaller than the default.
<font size=+10>text</font> creates text 10 points larger than the default.
<font face="times new roman">text</font> changes the current font to "times new roman".
</font> Reverts back to the previous font size, color and face.

<wait N> (Where N is a number) Wait for N seconds before continuing. ie. <wait 5> pauses the text output to the screen for 5 seconds.
Press any key<waitkey> Pauses the text output until player presses a key. Note that you need to provide your own "Press a key to continue" message BEFORE the <waitkey> tag.