Aliases allow you to define shortcuts for simple commands. For
example, you can define df
to be an alias to
drink from fountain
, and then you can type only
df
in the command line, and drink
from fountain
will be sent to the mud.
However, in KildClient aliases can do much more. They allow you
to rewrite part of the input line. In the example above, what happened
is that df
was replaced by drink
from fountain
. Aliases such as these replace the entire
short command you type by a longer command, but you can also replace
part of the line. If a mob has a really long name, such as
Ingeloakastimizilian, you can define an alias "ing" that is replaced
by "Ingeloakastimizilian", and whenever you type
ing
, even in the middle of another command, it
will be replaced by the full name.
Aliases are implemented as a substitution, just like the "Search
and Replace" option found in several programs. They consist of two
parts: a pattern
and
a substitution
. Each line you type is
matched against the pattern
and if it
matches, the matched part is replaced by
the substitution
.
For those who know Perl, aliases work just like Perl's
s///
operator. As a matter of fact, they
are implemented with s///
.
This is more or less how the alias processing is done:
$line =~ s/$pattern/$substitution/;
Supposing $line
holds the entered command,
$pattern
the pattern and
$substitution
the substitution. Then
$line
is sent to the World, possibly having been
modified.
If you are having trouble with aliases and want to be informed whenver an alias matches, enable the
→ menu. When this is enabled, information about each matched alias will be printed to stderr. (This means you must start KildClient from a terminal to see the output.)