Valid HTML 4.0! [previous - Environment]  [Contents]  [next - Files] 


EXTENSIONS

Curfloo provides for user-defined chat commands. These commands and their definitions are stored in your home directory in the .curfloo/commands file. This file may be changed while online; Curfloo auto-refreshes the command set from this file.

The format used to define the command in this file determines how text is displayed when the command is executed.

Format in .curfloo/commands

command:definition

The definition may begin with : to cause the output to appear as an emote action (see Example 2). It may also begin with ! to exec a shell command that outputs to chat, or !! to output only on your local screen, or / to exec a Curfloo command, whether internal or user-defined.

Command parsing is recursive. The first word of the definition is treated as if it were a command as Curfloo iterates through its internal commands and your .curfloo/commands list again to check for matches. This means that you can alias *any* of Curfloo's commands or make your own that behave as uniquely as you like.

See the examples.

Optional parameters

Each command may have an unlimited number of parameters, but only the first 9 are defined in variables for you, starting with $1 and ending in $9.

command:definition $1 $2 $3 ... $9

These will be replaced with the variables you specify when you execute the command, or stripped away if that parameter was not specifed.

In addition to those parameters, $0 is always defined as the command name, $* and represents all arguments (excluding $0).

Recursion

As previously stated, user-defined commands in Curfloo may use recursion. That is, a command may include another command or itself within the definition, which may include another command, etc. Up to 256 levels of recursion will be processed.

Restrictions

The command name must not include any spaces or tabs. Use only alphanumeric characters. No newlines may appear within a command or its definition.

Usage

In chat, invoke your defined command as


/command 

or, if defined with optional parameters, use

/command $1 $2 ... $9.

Examples

Example 1:

Defined in .curfloo/commands:
smack:puts the smack down on $1

In chat:
/smack Hiro_Protagonist_II

will display, as normal chat:
<your alias>: puts the smack down on Hiro_Protagonist_II

Example 2:

Defined in .curfloo/commands:
smack::puts the smack down on $1

In chat:
/smack Hiro_Protagonist_II

will display, as an emote action:
<your alias> puts the smack down on Hiro_Protagonist_II

Example 3:

Defined in .curfloo/commands:

foo:/bar
bar:baz
In chat:
/foo

will display, as normal chat:
<your alias>: baz

Example 4:

Defined in .curfloo/commands:
repeat:/$0 $* $*

In chat:
/repeat this text will reiterate

will display, as normal chat:
<your alias>: /repeat this text will reiterate this text will reiterate this text will reiterate... [through 512 bytes]