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.

Read-only variables

The following special variables can be examined, but not set:
#
The number of words in a macro's argument text.

?
The integer return value of the most recently executed command 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 dependant on your system or configuration.
HOME
Your home directory, used by /cd and filename expansion. This is usually inherited from the environment when tf starts.

LANG
If your system supports locales, TF will set the LC_ALL locale according to the value of %{LANG} (which should usually be set in the environment before TF starts). Valid values for %{LANG} and their meanings depend on your system; for details, see your system's documentation for setlocale(3). Locale affects the set of allowed characters, the date and time format, and more. If unset, TF will use the default "C" locale, which allows the ASCII character set. See also: %istrip.

MAIL
If %{maildelay} is nonzero, TF will tell you there is new mail when the file named by %{MAIL} has been modified but not yet read. If %{MAIL} is undefined, TF will try to define it as the file with your login name in the mail directory.

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. This is usually inherited from the environment when tf starts.

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

TZ
On most systems, the timezone used to display formatted times. 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.

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

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.

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=12-hour
If set to "12-hour" or "24-hour", the current time will be displayed on the status line in visual mode. If "off", time will not be displayed.

connect=nonblocking
Set to "blocking" or "nonblocking" to determine how connections are made. Default is "nonblocking" on platforms that support it. Nonblocking allows you to continue doing other things while tf tries to establish a new connection. A few platforms claim to support nonblocking connect, but then give "resource temporarily unavailable" errors when connecting; if this happens, set %connect to "blocking". See also %gethostbyname.

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 (see %LANG). Valid values 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 attribute (color) 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 attributes.
debug:
converts nonprinting characters to a printable form. See also: %telopt.
See also: %tabsize, 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 gag attribute in triggers. (See: /gag, /nogag)

gethostbyname
Set to "blocking" or "nonblocking" to determine how hostname resolution is done. 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 underline, reverse, flash, dim, hilite, and bold attributes in triggers. (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. Otherwise, all characters allowed by the locale will be accepted as input; characters not allowed by the locale have their high bits converted to an ESC character, allowing M-x and ^[x to invoke the same keybinding. See also: %LANG.

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

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

login=on
(flag) Enable automatic login hook. (See: 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.

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)

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 worlds defined with /addworld -p. (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.

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, 1996, 1997 Ken Keys