Skip to main content

The "vngen_text_replace_ext" Function

Syntax#

vngen_text_replace_ext(id, name, text, xorig, yorig, scaling, linebreak, font, color, duration, ease, [lang]);
ArgumentTypeDescription
idreal/stringThe ID of the text to replace
namestringThe character name to associate with the text
textstringThe new text string to display
xorigreal/macroThe horizontal texture offset, or origin point, relative to the top-left corner
yorigreal/macroThe vertical texture offset, or origin point, relative to the top-left corner
scalinginteger/macroSets the automatic scaling mode for the text
linebreakrealThe width in pixels before text is wrapped into a new line
fontfont/macroThe font to draw text in, where fnt_default is default (or keyword previous for no change, or keyword inherit for saved style)
colorcolor/macroThe color to draw text in, where c_white is default (or keyword previous for no change, or keyword inherit for saved style)
durationrealSets the duration of the fade transition, in seconds
easeinteger/macroSets the ease mode to perform the transition in
[lang]real/stringOptional: Sets the language flag for the text

Description#

Replaces the input entity ID with a new string of text and fades the old text to the new one over the input duration.

As with other types of modifications, replacements made with this script are permanent and will persist until another replacement is performed. This script cannot be performed simultaneously with other replacement actions operating on the same entity ID.

Note that text elements are displayed as a surface, or texture, and the exact dimensions of this texture may not be known. As a result, functions like xorig, yorig, and scaling may not behave as expected. It is important to test your text actions and design your fonts and linebreaks to a standard which results in predictable texture dimensions.

Replaced text will be automatically added to the backlog.

See Macros & Keywords for a list of available style modes. See Language Functions for details on multi-language support. See Inline Markup for available markup tags.

Example#

vngen_event() {
vngen_text_replace("text", "Jane Doe", "Hello, world!", orig_left, orig_top, scale_none, 1500, previous, inherit, 3, ease_sin_out);
vngen_text_replace("text", "", "Jane Doe||Hello, world!", orig_left, orig_top, scale_none, 1500, fnt_Arial, c_white, 3, ease_sin_out, "en-US");
}