On text

From Scriptwiki
Revision as of 15:56, 5 October 2005 by Doomie (talk | contribs)

Jump to: navigation, search

The on TEXT event triggers when you receive private and/or channel messages.

on <level>:TEXT:<matchtext>:<*><?><#[,#]>:<commands>

The matchtext can be a wildcard match or even a regular expression. To use regular expressions as matchtext, you need the $-Prefix.

Read access levels to get more info about the <level> field.

The location where this event occurrs can be either a channel (#), a query (?) or both (*).

You can also use variables as matchtext and location parameter. See below for an example.

Note that you can't test out these events by typing text to yourself. To test them, use another connection, that you can establish via /server.

Example

On *:Text:*moo*:#: { echo -a $nick just said moo in $chan $+ . }

This will echo "<nick> just said moo in <channel>", when someone has said a sentence with "moo" in it.

On *:Text:*:?: { echo -a $nick just said in query: $1- }

This will echo everything someone said to you in query in your active window, as $1- refers to the entire text that was said to you.

On *:Text:%mymatchtext:%mychannels: { beep }

The value of %mymatchtext will be matched against whatever text the user sends, and the value of %mychannels will be matched against the channel to which the message was sent. If both matched, it will beep.

See Also

To make more restrictions, you have to use if-statements.

To trigger your own text, you need to use the On Input event.