For example, suppose the output window contained the following text:
Related preference settings are are grouped into different categories.
You can access different categories in the editor by selecting a
category from the menu-button at the top of the preferences editor
window.
Line mode is required if you wish to make use of line mode
protocols like MCP/2.1 or XMCP/1.1. MOO servers are usually
line-mode in nature. Cold servers can be either line mode or
character mode.
To force your connection to a cold server to
be in line mode you need to use a command like
When no Connection Script is given the typical MUD login string
'connect %u %p' is assummed.
When a Connection Script is given it is assumed to contain
*all* the information required to connect to a site as well as
additional commands which are sent after the connection is
made. This means that so long as there are other lines in the
script then the first line should read 'connect %u %p'. For
example, here's a suitable connection script for a MOO, that
logs you in and then displays the latest news items:
You can define fonts by hand, using for example an X-font definition:
The client supports several different Out of Band protocols, and
these may be controlled individually by using the following settings.
XMCP/1.1 applications require the XMCP/1.1 Authentication Key
to be sent before they can cooperate with the client. The
simplest way to send the key is to place a command like:
You can find out more about MacMOOSE here:
The client's Tools->Edit Triggers menu option
opens the client's editor on the
The gag command is a special form of the trigger
command which does nothing, and prevents matching lines of input
from appearing on the client's main window. Gags are used to clean
up your client's input, filtering out information that you don't
want to see. All defined gags are processed before any defined
triggers are processed.
The gag command is defined like as follows. Optional command flags
are shown inside square brackets '[', ']'. The '\' character is
used to break lines of text up and to make the definitions more
readable.
The trigger command is defined as follows. Optional
command flags are shown inside square brackets '[', ']'. The '\'
character is used to break lines of text up and to make the
definitions more readable.
All your triggers, gags and macros are stored in a special file named
Several procedures are predefined to allow the triggers to interract
with the client's internal routines. Here's a list of the available
commands:
You can use this command and it's companion
The following example shows a pair of tags being defined,
one which colours text blue, the other which renders text
in a bold font. Tags can be combined, as here, to render
text with several different characteristics.
Valid colour names are: red, orange, yellow, green, darkblue,
lightgreen, lightblue, blue, darkblue, black, grey, white,
pink.
The following example shows a tag's foreground colour being
defined. Any text displayed with the tag will be printed
in blue.
Valid font names are: fixedwidth, plain, bold, header, italic.
The following example shows a tag's font style being defined.
Any text displayed with the tag will be printed in bold.
The implementation of exec is different for each platform
and is not currently available on Macintosh computers.
For more details consult a reference for the Tcl programming
language.
The
The
The
If Janet were to say something:
You don't need to use the values in
Any settings in the preferences editor will override matching
settings in the resource file.
The client looks for your resources file in the following places depending on which platform you're using:
January, February, March, April, May, Janet, Mary...
If you type the word 'Jan
' into the Input window and
then press the TAB key then the letters 'uary
' are
appended, to form the complete word 'January
'. Typing
TAB again changes the completed word to 'Janet
'.
Accessing Search engines
The client lets you perform searches on many of the popular internet
search engines. When you type '?' into the client's input window
and follow it with a search term the client will open a webbrowser
onto a search engine. By default the Google engine is chosen. For
example, you should get a list of stuff about cars by typing:
?honda automobiles
This searching behaviour is controlled by the 'Use Search Engines'
checkbox under the Special Forces category of the Preferences
Editor. Uncheck to stop the '?' from causing searches. Or pick
another search engine from the 'Preferred search-engine' list.
Accessing the Server home page
The client can display the server's Home Page or Help Page, if
these exist. Just select the Help->'Server Home Page' menu option.
If the server has defined a home-page then it will be displayed by
using your machine's web-browser. To define a home-page, the server
needs to support the dns-com-awns-serverinfo
package.
The Preferences Editor
The versatile Preferences Editor is used to control the many settings
which allow you to customise your client. The client can be set
up to use different fonts and colours and text-formatting styles
for each world in your list of connections.
General Settings
The following settings control the client's behaviour when
connecting to or disconnecting from a world.
%u
in the Connection Script
setting are replaced by this value.
%p
in the Connection Script setting
are replaced by this value. The password you enter will be
displayed as '********'.
line
mode
the client expects an end-of-line character, one of CR
,
LF
, or CRLF
to terminate each line
of input from the server.
@set
terminated-tell=no
to set your connection's output
characteristics.
%u
and %p
are replaced by the values of the User name and
Password settings respectively.
connect %u %p
news new
Colours and Fonts
You're able to define the background and foreground text colours
of the main window. The colours you choose can be different for
each world, which can help when you have several client windows open
at the same time.
-*-times-medium-r-*-*-14-*-*-*-*-*-*-*
Or you can select the Choose button which opens a
font-chooser dialog.
Out of Band
Many features of the client rely on coded information sent from
the server. This information is sent across the same connection
as regular chat text, but only the client is able to see it. We
call such information 'out of band'.
@xmcp_challenge
in the client's Connection Script.
Paragraph Layout
You can control the position of text on the client's main window.
Settings allow you to control left and right margin indentation, as
well as the amount of whitespace used between lines.
Statusbar Settings
The client's statusbars appear at the bottom of the client's main window.
The client looks for the worlds.tkm file in each of the following locations:
./worlds.tkm
$HOME/.tkMOO-lite/worlds.tkm
$tkmooLibrary/worlds.tkm
Because the worlds.tkm files contains your valuable passwords you
should keep the file hidden. On UNIX systems you can do this by
using the
chmod
command to restrict read-access to
the file to only yourself.
Triggers and Gags
In tkMOO-light version 0.2.51 support for user-programmable
triggers and gags was introduced.
The current implementation is very simple but will be improved in
future releases of the client.
triggers.tkm
file.
The triggers file is stored in the following locations depending
on which platform you are using.
Platform Location
UNIX $HOME/.tkMOO-lite/triggers.tkm
MAC triggers.tkm, in your Preferences Folder
WINDOWS $HOME\tkmoo\triggers.tkm
gag -regexp {some regular expression} \
[ -world {world name} ] \
[ -type {world type} ]
Here's an example of the gag
command which suppresses
a MOO server's *** Connected ***
message, normally
received each time you connect to a MOO:
gag -regexp {^\*\*\* .* \*\*\*$}
trigger -regexp {some regular expression} \
-command {some tcl procedure} \
[ -world {world name} ] \
[ -type {world type} ] \
[ -priority <priority> ] \
[ -continue ]
A trigger is a small program which runs each time the server sends
the client a line of text that the user has decided is interesting.
Each time a line of text arrives from the server a list is created
of all the triggers that match the line. Each trigger defined is
processed to see if it will be activated by the line. When all
the activated triggers have been identified they are sorted according
to their priority and processed so that matching
triggers with a higher priority are processed before those with a
lower priority. Each time a trigger is processed it's
command is executed and then, if the
-continue flag is present, the next matching
trigger is processed until either all the available triggers have
been processed. If a trigger that did not define the
-continue flag is processed then further processing
of triggers stops.
The macro command is defined as follows. Optional
command flags are shown inside square brackets '[', ']'. The '\'
character is used to break lines of text up and to make the
definitions more readable.
World:
of the worlds.tkm file. If the regular
expression does not match against the currently connected world
then the trigger is not activated. If no -world
command flag is present then the trigger is processed as if
the flag was present and matched successfully.
Type:
field of the worlds.tkm file. If the regular
expression does not match against the currently connected
world's type then the trigger is not activated. If no
-type
command flag is present then the trigger is
processed as if the flag was present and matched successfully.
macro -regexp {some regular expression} \
-command {come Tcl command} \
[ -world {regexp} ] \
[ -type {regexp} ]
The macro command behaves like 'trigger' but operates on outgoing
data typed into the client's input window. Macro commands have
access to the same range of Tcl commands that triggers do.
triggers.tkm
. The file can be editied using ordinary
editing tools or by using the client's built-in editor. When you
save the file using the built in editor the definitions are read
and the client is immediately reconfigured.
string
optional-list-of-tags
string
to the client's output
window, without adding a trailing newline character. Apply
each tag in optional-list-of-tags
to the
string.
window.displayCR
to diaplay text on the client's
main window. The following example displays the string
"Hello World" on one line adding a newline. 'Hello' is
written in blue, 'World' is written in red.
window.display "Hello" T_Blue
window.display " "
window.displayCR "World" T_Red
If several tags are to be applied they should be quoted. For example:
window.displayCR "$warning_message" "T_Red T_Blink"
string
optional-list-of-tags
string
to the client's output
window, adding a trailing newline character. Apply
each tag in optional-list-of-tags
to the
string.
string
string
to the server, adding a
trailing newline to string
, as if it was a
command typed into the client's input window. string
is first subject to processing by the client's supported
modules before it is finally transmitted. The Logging
module, if active, will write string
to the
current log file. If Local Echo mode is selected then
string
will be written to the client's main
window in highlighted text. The following example transmits
the string "emote waves." to the server. On most MUDs this
makes it appear that you are waving to other users connected
to the MUD.
client.outgoing "emote waves."
string
string
to the server, adding a
trailing newline to string
, as if it was a
command typed into the client's input window. string
is sent to the server immediately without further processing
by the client. The following example transmits the string
"@who" to the server. On most MUDs this causes the server
to display a listing of the connected users.
io.outgoing "@who"
string
code
to
the end. This routine can be used to generate unique names
for tags. The following example sets the tcl variable
my_tag
.
set my_tag [util.unique "foo"]
window.display
or
window.displayCR
commands as T_Blue.
tag configure Blue -foreground [colour.get blue]
tag configure Bold -font [fonts.get bold]
window.displayCR "Blue text..." T_Blue
window.displayCR "Bold text..." T_Bold
window.displayCR "Bold and Blue text..." "T_Bold T_Blue"
string
tag configure Blue -foreground [colour.get blue]
...
window.display "Hello" T_Blue
string
tag configure Bold -font [fonts.get bold]
...
window.display "Hello" T_Bold
command
arg1
arg2 ...
-remote
command-line switch. The trailing &
exec netscape -remote openURL(http://www.yahoo.com/) &
By its very nature the exec command is a dangerous tool.
You should be especially careful when passing matched
strings from regular expressions into the exec command.
Just in case someone sends a valid system command which
might damage local files.
trigger -regexp {^([^ ]*) pages, (.*)$} \
-continue \
-command { bell }
Some Examples
Greet your friends
The following statements define a trigger which greets your friends
if they wave to you:
trigger -regexp {^(.*) waves\.$} \
-continue \
-command {
io.outgoing ":waves to $m1."
}
Using this trigger, if your client sees the following line from
the user 'Networker':
Networker waves.
then your client (you're Andrew) will respond with:
Andrew waves to Networker.
Colour friends' names
Here's a more advanced example that prints information on the
client's screen in different colours. The tag
command
defines a tag Blue
. Any text that gets printed on
the client's output window which is marked with this tag will be
displayed in blue, all other text is displayed in black. The regexp
is similar to the previous example and assigns values to the special
variables $m1
and $m2
. The
window.display
and window.displayCR
commands display text on the client's main window and marks the
text with an optional tag.
tag configure Blue -foreground [colour.get blue]
trigger -regexp {^(Networker|Andrew) (.*)} \
-command {
window.display $m1 T_Blue
window.displayCR " $m2"
}
If your client sees the following message from the server, then
the name 'Networker' is displayed in blue text and the rest of the
line is displayed in black text. This trigger has no
-continue flag, so once it is processed all further
processing of triggers ia stopped:
Networker says, "My name should appear in blue letters..."
You can change the way a line of text is displayed on the client's
output window according to the line's content. MOO usually emits
'Name' Different triggers for different Worlds
This example makes use of the predefined tag T_Blue
.
The trigger is only activated when you're connected to either
SomeMOO
or AnotherMOO
, and when the
message you've received comes from either Janet
or
John
.
trigger -world {SomeMOO|AnotherMOO} \
-regexp {^(Janet|John) (.*)} \
-command {
window.display $m1 T_Blue
window.displayCR " $m2"
}
Look at MOO object numbers
This example makes use of the predefined tag GoTo
which gives text the look of a clickable hyperlink. Output from
a standard MOO contains frequent references to objects, in the form
#123
, #9232
, etc.
GoTo
tag makes these numbers appear in green and
changes the shape of the mouse pointer whenever it's over the
clickable text. If you have a 3-button mouse then clicking on
button 3 will activate the link and send the message 'look
#123
' to the server.
GoTo
tag only defines what the text will look
like. We need to use an additional tag which we create especially
to call client.outgoing
and sent the message to the
server. The predefined routine unique_id
is used to
generate a new tag-name, returning a value of the form
'12345t
'.
tag
command creates a new tag using the new tag-name
and defines a block of code to be executed each time the B3-ButtonRelease
event ocurrs over any text marked with that tag. The GoTo
tag is built-in, it colours text green and causes the mouse cursor
to turn into a pointing finger when it's over the text.
trigger -regexp {(.*)(#[0-9]+)(.*)} -command {
set cmd_tag [unique_id t]
tag bind $cmd_tag <B3-ButtonRelease> "client.outgoing {look $m2}"
window.display $m1
window.display $m2 "GoTo T_$cmd_tag"
window.displayCR $m3
}
Turn URLs into links and control a web browser
The next example displays any text that looks like a URL as a green
clickable hyperlink. On UNIX machines clicking on the URL will
cause tkMOO-light to request a local webbrowser
to fetch the URL. The exec
command is used to call
the webbrowser passing it the URL to be displayed.
trigger -regexp {(ftp|http)://([^\"\'\`\> ]+)} -command {
set cmd_tag [unique_id t]
tag bind $cmd_tag <B3-ButtonRelease> "exec netscape -remote openURL($m2://$m3) &"
window.display $m1
window.display $m2://$m3 "GoTo T_$cmd_tag"
window.displayCR $m4
}
Expand single-letter commands
The next example used a macro to save on typing. The macro expands
the typed letter 'W' to the command '@who' and sends it to the
server.
macro -regexp {^W$} \
-command { io.outgoing "@who" }
Using 'highlights'
New with version 0.2.59 of tkMOO-light, Highlights
allow you to render a portion of a line in a different colour, with
a different font, or with any other Tk 'tag'. Each time the client
sees a new line of input it will check to see if any triggers have
been activated and if any highlights have been set, by the triggers,
for that line. If a highlight has been set then the client will
display the line of input with the hilighting applied. If no
highlights have been set then the client will display the line as
normal. Here are some examples which use the highlight commands
to perform some familiar tasks:
Colour friends' names
In this example the trigger command has preset a special variable
$p1
, which contains the positions of the start and
end characters of the part of the input line that matches the
first bracketed pattern in the regular expression.
Janet says, "Hello!"
then $p1
would be a Tcl list with the value {0 4}
,
where 0
is the index of the first character in the
line.
$p1
if you don't
want to. You can, instead use your own Tcl list containing a pair
of integers.
trigger -world {SomeMOO|AnotherMOO} \
-continue \
-regexp {^(Janet|John) (.*)} \
-command {
highlight T_Blue $p1
}
The Resources File
When the client is started it is able to read from an optional
resources file which contains text entries defining some of the
client's properties, like display colours and fonts. For the time
being only a few colours are definable, but the number of configurable
options will be improved in future versions of the client. The
following entries define the client's default colour scheme:
# off-white background for text screens
*Text.background: #f0f0f0
# pink background for input boxes
*Entry.background: #f00000
# grey desktops
*desktopBackground: #d9d9d9
The same file can contain definitions for the fonts used by the client:
*fontPlain: -*-times-medium-r-*-*-14-*-*-*-*-*-*-*
*fontBold: -*-times-bold-r-*-*-14-*-*-*-*-*-*-*
*fontItalic: -*-times-medium-i-*-*-14-*-*-*-*-*-*-*
*fontHeader: -*-helvetica-medium-o-normal-*-18-*-*-*-*-*-*-*
*fontFixedwidth: 7x14
Platform Location
UNIX $HOME/.tkmoolightrc
MAC tkMOO-light.RC, in your Preferences Folder
WINDOWS $HOME\tkmoo\tkmoo.res