De interface van VDS Renaissance is in meerdere talen beschikbaar. De officiële documentatie wordt in het Engels onderhouden om één consistente en altijd actuele referentie te garanderen.

@EVAL

Windows Linux macOS

[VDS7]

Syntax

@EVAL(<string>)

Description

Evaluates <string> as a DialogScript expression and returns the result. The string may contain variable references (%name) and function calls (@func(...), nested calls included); they are resolved when @EVAL runs, using the script's current values — exactly as an ordinary line is expanded. As elsewhere in DialogScript, expansion is a single pass (the result of a function is not itself re-evaluated).

@EVAL is useful when the expression is not known when the script is written — a rule read from a configuration file, a formula typed by the user, or a template returned by the AI.

To build a string that contains a literal @ (so the function is not expanded at assignment time, but later by @EVAL), use @chr(64)@chr(64)upper(x) produces the text @upper(x).

Unknown function names are left unchanged. Avoid an endlessly self-referential @eval(@eval(...)), just like a gosub that never returns.

OK

Unchanged.

Example

%name = world
REM build the expression  @upper(%name)  at run time
%expr = @chr(64)upper(%name)
%r = @eval(%expr)
info %r

This displays WORLD. An expression read from a file or returned by the AI is evaluated the same way, with any %variables it contains taking the script's current values.

See also