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).

1,2...
L1,L2...
*
R
Positional parameters. See "substitution".

Pn
PL
PR
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.
COLUMNS
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().

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

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

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

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

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

LINES
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().

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

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

TERM
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.

TFHELP=%{TFLIBDIR}/tf-help
The name of the file used by /help.

TFLIBDIR
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.

TFLIBRARY=%{TFLIBDIR}/stdlib.tf
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.

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

TFPATH=
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.

TZ
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.

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

background=on
(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}).

backslash=on
(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.

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

bg_output=on
(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.)

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

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

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

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

clock
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()).

connect=nonblocking
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.

e=2.718281828
Euler's number.

emulation=ansi_attr
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:
raw:
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.
print:
Tabs expanded; backspaces interpreted; lines wrapped; nonprintable characters removed.
ansi_strip:
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.
ansi_attr:
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.
debug:
converts nonprinting characters to a printable form. See also: %telopt.
See also: %istrip, %meta_esc, %tabsize, locale, attributes

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

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

gethostbyname
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.

gpri=0
Priority of subsequent /gags. (See: /gag)

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

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

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

histsize=1000
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)

hpri=0
Priority of subsequent /hilites.

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

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

istrip=off
(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.

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

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

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

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

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

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

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

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

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

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

mecho=off
"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.

meta_esc=on
(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.

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

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

oldslash=on
(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)

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

pedantic=off
(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.

prompt_sec=0
prompt_usec=250000
These two variables control the delay used to recognize unterminated prompts. (See: prompts).

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

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

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

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

quiet=off
(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.

quitdone=off
(flag) Quit upon disconnection from last socket.

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

refreshtime=250000
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).

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

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

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

sockmload=off
(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).

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

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

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

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

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

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

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

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

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

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

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

wordpunct=_
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).

wrap=on
(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".

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

wrapsize=79
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().

wrapspace=0
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