Difference between revisions of "Text"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 23: Line 23:
 
If you don't have any audio file linked to a text, you may want to adjust the engine's calculation. You can use the [[Action Parts#Set_speed_for_text_output|"Set speed for text output"]] action part, if you want to change the speed globally. But you can also set the duration for each text individually. Especially short texts tend to get hidden again too fast.
 
If you don't have any audio file linked to a text, you may want to adjust the engine's calculation. You can use the [[Action Parts#Set_speed_for_text_output|"Set speed for text output"]] action part, if you want to change the speed globally. But you can also set the duration for each text individually. Especially short texts tend to get hidden again too fast.
  
Add a pause after the text content to define the display duration: (integer values only)<br/>
+
Add a pause after the text content to define the display duration, for example: <syntaxhighlight lang="text" inline>Hello World!<p2000ms></syntaxhighlight> (integer values only)<br/>
 
◻️ <syntaxhighlight lang="text" inline><p2></syntaxhighlight> or <syntaxhighlight lang="text" inline><p2s></syntaxhighlight> display text for 2 seconds<br/>
 
◻️ <syntaxhighlight lang="text" inline><p2></syntaxhighlight> or <syntaxhighlight lang="text" inline><p2s></syntaxhighlight> display text for 2 seconds<br/>
◻️ <syntaxhighlight lang="text" inline><p2000ms></syntaxhighlight> display text for 2500 milliseconds (2.5 seconds)<br/>
+
◻️ <syntaxhighlight lang="text" inline><p2500ms></syntaxhighlight> display text for 2500 milliseconds (2.5 seconds)<br/>
 
◻️ <syntaxhighlight lang="text" inline><pt></syntaxhighlight> allow engine to automatically calculate duration based on text length (default @ 100% speed is 130ms x length of text)<br/>
 
◻️ <syntaxhighlight lang="text" inline><pt></syntaxhighlight> allow engine to automatically calculate duration based on text length (default @ 100% speed is 130ms x length of text)<br/>
 
◻️ <syntaxhighlight lang="text" inline><pa></syntaxhighlight> display text for duration of linked audio file<br/>
 
◻️ <syntaxhighlight lang="text" inline><pa></syntaxhighlight> display text for duration of linked audio file<br/>

Revision as of 18:36, 9 October 2022

Character and narration text

The most common type of text displayed on-screen is character text – text spoken by a character. You implement character text by using the "Display text" action part or in the course of a dialog. The text will be displayed over the character's head and aligned according to the global alignment setting in the game properties. The font is defined in the character's properties.

If the character's current outfit includes a talking animation, it is automatically played. If an audio file has been added to the text, it is automatically played. The cursor is hidden while the text is displayed, thus preventing the user from performing any interaction. They may however skip the text by clicking the left mouse button. Any action parts added after "Display text" will not be executed until the text has finished displaying.

The second type of text is narration text – text not spoken by a character. It is implemented by using the "Display narration text" action part, in which you have to define its font and position. The alignment is again set globally in the game properties (but independently from the character text alignment).

Like for character text, a linked audio file is played automatically. The cursor is hidden while narration text is displayed, and the user may skip it by clicking the left mouse button.


Background text

Both character and narration texts can be displayed as background text. This changes the default behaviour described above. Flagging a text as background text kind of "takes it out of the regular flow", as its display does not block anything else from happening in the game. Action parts added after the "Display (narration) text" action part are immediately executed and don't wait for the text display to finish. The cursor does not get hidden, so the user may continue interacting with the environment. Consequently, background texts cannot be skipped.

Use background text to implement conversations by people in the background. Or you may want the user to be able to do something while a non-playable character is talking and thus distracted.


Duration/Pause

By default, character and narration texts are displayed for a certain amount of time and then hidden again. If you don't specify anything else, the duration is either automatically calculated from the length of the text, or – in case an audio file is linked – the display stops when the audio has finished playing.

If you don't have any audio file linked to a text, you may want to adjust the engine's calculation. You can use the "Set speed for text output" action part, if you want to change the speed globally. But you can also set the duration for each text individually. Especially short texts tend to get hidden again too fast.

Add a pause after the text content to define the display duration, for example: Hello World!<p2000ms> (integer values only)
◻️ <p2> or <p2s> display text for 2 seconds
◻️ <p2500ms> display text for 2500 milliseconds (2.5 seconds)
◻️ <pt> allow engine to automatically calculate duration based on text length (default @ 100% speed is 130ms x length of text)
◻️ <pa> display text for duration of linked audio file
◻️ <pa2000ms> display text for duration of linked audio file, with a fallback pause of a 2000 milliseconds in case the audio file is missing or corrupted
◻️ <p> forces the player to have to manually progress texts via left click


Since <pt> and <pa> are the defaults, there is usually no need to use these. But you can add pauses not only at the end of a text but also inside it. The pause will only affect the preceding text, so initially only that first part is displayed. After the time set in the pause is over, the next part of the text is shown. Usually it's more convenient to work with two separate "Display (narration) text" action parts though.


Object text

A third type of text is object text. This is a static text meant to show up more or less indefinitely. Consider it to be like an object image, just that you don't have to create a graphic file, and that it can easily be translated. You could use it to label menu or interface buttons for example.

As the name indicates, object texts are bound to scene objects (or interface buttons). You add them by using the "Display object text" action part. It basically doesn't matter which scene object you choose, because object and object text don't have to show up at the same position on the screen. You are free to place the text anywhere you like. What does matter: if you disable the object, the object text will disappear, too. You cannot bind more than one object text to an object.

Use the "Hide object text" action part to hide an object text without having to hide the whole object.


Display values

You may print out values as part of a text, both integer and string type values. Use the following markup:
◻️ Integers: <v=value_name>
◻️ Strings: <vs=value_name>


Read the Conditions and Values page for some examples.


Languages/Localisation

If your game supports more than one language, you can switch between the different language text fields by clicking the flag icon. Flags are only shown, if the engine recognizes the language names you used when adding the languages though. Unknown languages show a grey placeholder instead of a country flag (but the flag is for convenience only anyway).

Game languages are added in the "Game info" section.