addworld()

Function usage:

ADDWORLD(name, type, [host, port [, char, pass [, file [, flags [, srchost]]]]])

Command usage:

/ADDWORLD [-pxe] [-Ttype] [-ssrchost] name [char pass] host port [file]
/ADDWORLD [-Ttype] [-ssrchost] name
/ADDWORLD [-Ttype] DEFAULT [char pass [file]]


Defines a new world or redefines an existing world with the name name. Name may not contain spaces; addtionally, when defining a new world, name may not begin with "(".

Host is a server's internet hostname, IPv4 address, or (if your platform supports it) IPv6 address. Port is the number or name of a TCP port on the host. If host and port are blank, then "connecting" to the world will only create a tf window for the world, it will not open an actual network connection; this is called a "connectionless" socket.

There may be a special world named "default" which does not have a host or port. If a normal world is defined without a character, pass, type, or mfile, then that world will use the corresponding field of the "default" world if there is one. If the "default" world is redefined, worlds with omitted fields will use the new default values.

In function form, flags is a string of 0 or more letters that modify the behavior of the function. For compatability with older versions of TF, an "f" or "0" in flags has the same effect as "p", and an "n" or "1" in flags has no effect.

Options:

command: -p
function: flags contains "p"
%{proxy_host} will be ignored, and all connections to the world will be direct. By default, worlds use %{proxy_host} if it is set.
command: -x
function: flags contains "x"
TF will use the SSL protocol to make connections to this world.
command: -e
function: flags contains "e"
all text sent to the world will be echoed right back as if it were received from the world (in addition to being sent to the server). This is most useful with connectionless sockets.
command: -ssrchost
function: srchost
defines the host name or IP address to use for the local (tf) side of the connection. This is useful if the host has multiple network interfaces and you need to override the default choice of the OS.
command: -Ttype
function: type
The optional type is used in hooks and triggers, and for automatic login and flag setting. (See below.)

The library pre-defines WORLD and LOGIN hooks for types that match these glob patterns:

(none)
TinyMud login format ("connect char pass"), the value of lp is not changed.

tiny, tiny.*
TinyMud login format ("connect char pass"), lp=off.

lp, lp.*
diku, diku.*
aber, aber.*
LP/Diku login format (sends char and pass on separate lines), lp=on. For servers that send unterminated prompts.

lpp, lpp.*
LP/Diku login format, lp=off. For muds that use GOAHEAD or EOR prompt protocol.

telnet, telnet.*
Telnet login format (sends char and pass when "login:" and "password:" prompts are received), lp=on, /localecho on. For any line-by-line telnet service.

You can define your own world types for use in other triggers or hooks. If you use names that match the glob patterns above, the standard library hooks will still work. For example, if you did:

  /test addworld("Cave", "tiny.muck.",     "cave.tcp.com", 2283, char, pass)
  /test addworld("Foo",  "tiny.muck.msp.", "foo.com",      9999, char, pass)
  /test addworld("Cow",  "tiny.moo.",      "cow.com",      8267, char, pass)
  /test addworld("Buzz", "tiny.moo.msp.",  "buzz.org",     8267, char, pass)
then tiny-style autologin would still work (using the library hooks), and you could also define your own triggers and hooks specific to TinyMUCKs or TinyMOOs (e.g., "/def -Ttiny.muck.*") or to worlds that support MSP regardless of their server type (e.g., "/def -T*.msp.*"), etc. Note the trailing period on the world type defintions, which make it easier to write matching triggers.

Any type is valid, but is only useful if it is matched by a "-Ttype" option of a hook or trigger.

If addworld() with a password is executed from a file that has permissions making it readable by others, it will produce a warning. You should change the file permissions to prevent other people from reading your password.

See: worlds, /connect, /fg, /unworld, /edworld, /telnet


Back to index
Back to tf home page
Copyright © 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys