Function usage:
eval(text [, level])
Command usage:
/EVAL [-slevel] text
/NOT [-slevel] text
Text is evaluated as a macro body: it goes through substitution, and is executed in a new scope. The return value of eval() and /eval is that of the last command in text; the return value of /not is the logical negation of return value of the last command in text.
Positional parameters (%1, etc) are inherited from the caller.
Options and arguments:
Note: calling /eval with arguments from a trigger could be dangerous. If not written carefully, such a trigger could allow anyone with access to the server to gain access to your tf or shell account (if they have not been /restricted).
Example:
command: /def showvar =
/eval
/echo
%{1} is
%%{%{1}}.
command: /showvar borg
output: borg is on.
"/Eval -s0" can be useful when the
argument is generated by an expansion. For example, if you defined
"/def do =
%{*}
, and then called
"/do /echo test
", it would send "/echo test" to the server
instead of executing it as a tf command. But if you defined
"/def do =
/eval -s0
%{*}
", then
"/do /echo test
" would execute "/echo test" as a tf command.
Note: Instead of /not, you should normally use the "/!command" syntax to execute "/command" and negate its result. /not evaluates its arguments, which may be undesirable.
See: evaluation