/eval

Usage:

/EVAL [-slevel] command
/NOT [-slevel] command


Macro body expansion is performed on command, and command is executed. The return value of /eval is that of command; the return value of /not is the logical negation of the return value of command.

Positional parameters (%1, etc) are inherited from the caller.

Options:

-slevel
Expands the command as if %{sub} were set to level. By default, /eval expands the command as if %{sub} were "full", and echoes it if %{mecho} is not "off".

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


Back to index
Back to tf home page
Copyright © 1995, 1996, 1997 Ken Keys