special variables

Many options in TF can be controlled by setting special global variables. Many variables have a limited number of permitted values, with corresponding integer values; these are called enumerated variables. All flags are enumerated variables which can have the values "off" (0) or "on" (1). Numeric variables can have any integer value (within the range allowed by your system). Attempting to unset numeric variable or give it a string value will force its value to 0. A variable's type (enumerated, numeric, or string) affects its behavior in expressions.

Special substitute-only variables

The following special variables may be used only in substitutions, never as a variable reference in an expression.
The number of words in a macro's argument text.

The string return value of the most recently executed command (builtin or macro).

Positional parameters. See "substitution".

The text matched by the nth parenthesized subexpression, or the text to the left or right of the matched text, in the last successful regexp comparison. See %Pn for more details.

Special global variables

The following special global variables can be examined and set. In the following list, a '=' following a variable name indicates its default value. For variables that do not have defaults listed, the default is dependent on your system or configuration.
If this variable is set in the environment when TF starts, TF will use its value instead of the value from the terminal driver. See %LINES, columns().

Your home directory, used by /cd and filename expansion. This is usually inherited from the environment when tf starts.

The current locale. See locale. Automatically exported to the environment when set.

The current locale. See locale. Automatically exported to the environment when set.

The current locale for character classification. See locale. Automatically exported to the environment when set.

The current locale for time formatting. See locale. Automatically exported to the environment when set.

If this variable is set in the environment when TF starts, TF will use its value instead of the value from the terminal driver. See %COLUMNS, lines().

The name of a file which TF may check for mail. See: mail.

Shell used by /sh and /quote !. This is usually inherited from the environment when tf starts.

Terminal type. Changing the value of %TERM at any time will cause TF to re-initialize its display functions to use the new value. The value of %TERM should agree with your actual terminal or emulator. If your emulator supports multiple terminal types, the recommended type to use is vt220, vt100, or ansi (in that order). %TERM is usually inherited from the environment when tf starts. See also: mode.

The name of the file used by /help.

The name of the TF library directory, which should contain the help file (tf-help), the standard library (stdlib.tf), the local library (local.tf), and many useful utility files. The default value of TFLIBDIR is set when TF is installed, but can be overridden by setting it in the environment before starting TF. This directory will be searched by /load if TFPATH is blank or not set. See also: /load.

The name of the library file loaded at startup. This can be set in the environment before starting tf, to load from an alternate library file.

A space-separated list of files which TF may check for mail. See: mail.

A space-separated list of directories that will be searched by /load. If this is set, %{TFLIBDIR} will be ignored by /load, so be sure to include the value of %{TFLIBDIR} in %{TFPATH} if you want to be able to /load files with relative names from the standard library directory. See also: /load.

On most systems, the timezone used to display formatted times. In the United States, the value is usually the local timezone name, followed by the difference in hours from GMT, followed by an optional daylight saving timezone name; for example, "PST8PDT". For details, see your system documentation for tzset(3) or environ(5). This is usually inherited from the environment when tf starts, and is automatically exported to the environment when set.

(flag) If on when the foreground socket disconnects, tf will automatically bring another socket into the foreground.

(flag) If on, text from background worlds is processed and recorded immediately upon receipt. Otherwise, the text is ignored until the socket is brought into the foreground. In either case, the text is not displayed until the socket is brought into the foreground (but see %{bg_output}).

(flag) Enables use of '\' to quote the following character literally during macro expansion. Generally, this should only be turned off if you are having problems with '\' in macros written before version 3.0.

(0): server "portals" are ignored.
(1): Unter-style bamfing is enabled (disconnect).
(2): Old-style bamfing is enabled (no disconnect).
See /bamf.

(flag) If on, output from a background world will be displayed when that world is brought into the foreground. If off, background output will not be displayed, but it will go through all other normal processing, including triggers and history (so it can be accessed with /recall). This flag is ignored if the %{background} flag is off. (The -q option of /fg is a more flexible way to do the same thing.)

Determines what to send as end-of-line marker in TELNET BINARY mode. Valid values are "LF", "CR", and "CRLF". (See: /telnet)

(flag) Enables trigger bodies (attributes are unaffected). (See: triggers)

(flag) In visual mode, clear input window rather than scroll when full. Always 1 if terminal can not scroll.

(flag) In visual mode, enables clearing of input window when return is pressed.

This variable is no longer supported. To disable the clock, remove the "@clock" field from the %status_fields variable, or /set status_int_clock=''. To make the clock display in 24-hour format, /set status_int_clock=ftime("%H:%M", time()).

Set to "blocking" or "nonblocking" to determine how /connect works. Default is "nonblocking" on platforms that support it. Nonblocking allows you to continue doing other things while tf tries to establish a new connection. See also %gethostbyname.

Euler's number.

Determines how special codes sent by the server should be interpreted by tf. The set of printable characters is determined by the current locale. Valid values for %emulation are:
No processing done; lines not wrapped; all nonprintable characters are displayed, and their effect is undefined (depending mainly on your terminal). TF's input display is not guaranteed correct; use at your own risk. This mode allows the server to have most of the control over the screen, but is not guaranteed to give the desired effect. For best results, %visual should be "off", and tf attributes should not be used.
Tabs expanded; backspaces interpreted; lines wrapped; nonprintable characters removed.
Like "print", but ansi-like display codes (i.e., a sequence consisting of ESC, '[', 0 or more digits and ';'s, and a letter) are also removed.
Like "ansi_strip", but ansi-like display attribute codes (i.e., ansi codes ending with 'm') will be converted to tf's internal format and displayed correctly (on any terminal). Other ansi-like codes (e.g., cursor motion) will be removed. Recommended for servers that send vt100/ansi display attribute codes.
converts nonprinting characters to a printable form. See also: %telopt.
See also: %istrip, %meta_esc, %tabsize, locale, attributes

The code that should be sent to your terminal to return to normal color after a %{start_color_name} code. See: color.

(flag) Enable the gag attribute. (See: /gag, /nogag)

Set to "blocking" or "nonblocking" to determine how /connect does hostname resolution. On OS/2, default is "nonblocking". On UNIX, default is "blocking", because nonblocking is usually slower unless you have a fast machine and slow name service. See also %connect.

Priority of subsequent /gags. (See: /gag)

(flag) Enable hooks. (See: hooks, /hook) Note that autologin and automatic %{lp} setting will not work if %{hook} is 0.

(flag) Enable display attributes, whether from a trigger, the server, or whatever. (See: /hilite, /nohilite)

Defines the attributes used by hilites. Can be any combination of attributes, including color names. (See: attributes, /hilite)

When a new world history is created, it will have space for %{histsize} lines. A world history is created the first time text is sent to it. (See also: /histsize)

Priority of subsequent /hilites.

(flag) If on, keyboard input is inserted; if off, input overstrikes existing text.

Size of input window in visual mode. See also: lines().

(flag) If on, the high bit will be stripped from all input characters. Note that this will prevent %meta_esc and locales with 8-bit characters from working correctly.

(flag) Re-echoing of keyboard input, preceded by %{kprefix}. See also: /localecho.

Prefix for echoed keyboard text, if %{kecho} is on.

<-- "login" is a separate topic -->

(flag) Enable automatic login hook. (See: automatic login, hooks, /world)

(flag) Displays partial lines as prompts, after a short timeout. Useful for LP and Diku MUDs. (See: prompts)

(flag) If on, waits for LP prompt for /quote and /repeat, instead of operating on a timed basis. (See: processes, /quote, /repeat)

Delay in seconds between mail checks. Setting this to 0 disables mail checking. The file to be checked is named by the %{MAIL} variable.

Determines the default pattern matching style.
straightforward string comparison.
shell-like matching (as before version 3.2).
regular expression.
See also: patterns, regmatch(), %Pn.

Maximum number of iterations in a /while loop. A value of 0 will allow unlimited iterations.

Maximum depth of recursive macro calls or triggers. A value of 0 will allow unlimited recursion.

"off" (0):
do not echo macro expansions.
"on" (1):
echo expansions of non-invisible macros.
"all" (2):
echo expansions of all macros.
%{mprefix} will be prepended once for each recursion level when macro expansion echoing is enabled.

(flag) If %istrip is off and %meta_esc is on, any characters that are not printable in the current locale and have their high bit set will have their high bit striped, and will be prefixed with an ESC character. This allows M-x and ^[x to invoke the same keybinding.

(flag) Displays output one screenfull at a time. (See: /more)

Prefix for macro echoing, if %{mecho} is not "off".

(flag) If on, sequences of more than one '/' in a macro body will be compressed by one during macro expansion. This allows macros written before version 3.0 to work properly. With oldslash=off, only slashes at the beginning of a body are handled specially. You are encouraged to turn this off. (See: evaluation)

The ratio of a circle's circumference to its diameter.

(flag) If on, tf will generate warnings about some potential problems in your macro code. Often the warnings indicate code that is technically valid but may not do what you intended.

These two variables control the delay used to recognize unterminated prompts. (See: prompts).

These two variables describe the proxy server used for opening connections. (See: proxy).

Default delay (in seconds) between /quote and /repeat process runs.

(flag) Echoing of /quote text, prefixed by %{qprefix}.

Prefix for /quote echoing, if %{qecho} is on.

(flag) Gag text after login until the mud sends "Use the WHO command", "### end of messages ###", or 25 lines. Note: This will not function correctly on MUDs which don't send those strings or 25 lines in the introductory text.

(flag) Quit upon disconnection from last socket.

(flag) Allows redefinition of existing worlds, keybindings, and named macros.

The delay (in microseconds) for redisplaying your keyboard input after it is overwritten by incoming text in non-visual mode. If you you are on a slow modem, you may wish to increase this delay. On a fast connection, you may wish to decrease it. The default is 250000 (1/4 second).

(flag) In visual mode, scroll output instead of wrapping from bottom to top.

(flag) Wait for a keypress after returning from /sh.

(flag) Don't send empty lines to the server.

(flag) Load macro files when foregrounding a world ("/dokey socketf", "/dokey socketb", or "/fg"). Normally, a world's macro file is loaded only when TF first connects to it. (Note: the WORLD hook is more useful than sockmload).

The code that should be sent to your terminal to produce color name. See: color.

The attributes used to display the status line in visual mode. See: status line.

The list of fields displayed on the status line in visual mode. See: status line.

The padding character used in displaying the status line in visual mode. See: status line.

Tabs will be replaced with spaces to pad to a multiple of %{tabsize}.

(flag) Display telnet option negotiations (for debugging purposes). See also: %emulation=debug.

"off" (0):
input is not expanded.
"on" (1):
input "%;" is expanded to newlines.
"full" (2):
input undergoes full macro expansion.

The format used to display times in /recall and /time. The default displays hours and minutes. See ftime() for a description of the format.

(flag) Divides the screen into an input window and an output window. (See: mode)

(flag) Gag repeated lines. (See: /watchdog)

(flag) Gag overactive players. (See: /watchname)

List of punctuation that will be considered to be part of a word instead of delimiting the ends of a word, by kbwordleft() and kbwordright() (and therefore by /dokey WLEFT, WRIGHT, etc).

(flag) Enable wordwrap on the screen. TF will try to break lines between words to fit them within %{wrapsize} columns. %{wrap} is ignored if %{emulation} is "raw".

(flag) Enable wordwrap in log files. See also: %wrap.

Lines (input and output) extending past this column will be split. Default value is one less than the number of columns on your terminal (typically 80). Output is not wrapped if %{emulation} is "raw". See also: %wrap, %wrapspace, columns().

Wrapped text is indented by this many spaces. See also: %wrap, %wrapsize.

The builtin commands /gag, /hilite, /hook, /nogag, /nohilite, /watchdog, and /watchname set the corresponding variables, and also perform additional functions.

The standard library also defines /background, /bamf, /borg, /clearfull, /cleardone, /gpri, /hpri, /insert, /isize, /login, /lp, /lpquote, /kecho, /mecho, /more, /ptime, /qecho, /quiet, /quitdone, /redef, /shpause, /sockmload, /sub, /visual and /wrapspace macros to set the values of the corresponding variables.

Note: The variables 'L' and 'R' are reserved (see: variables). You should not assign values to them.

See: variables, /set

Back to index
Back to tf home page
Copyright © 1995 - 1999 Ken Keys