world.ChatNote

MUSHclient script function (Method) — introduced in version 3.37

Does a note using ANSI codes for the chat system

Prototype

void ChatNote(short NoteType, BSTR Message);

Data type meanings

Description

This is used internally by the chat system to put notes on the screen in the current chat colour.

First, it calls the plugin callback routine "OnPluginChatDisplay" for each installed plugin, and passes the NoteType and Message to it. This gives the plugin a chance to do its own thing with the message (for instance, display it in a notepad window).

If any plugin returns False (0) then ChatNote exits without doing anything else (including calling other plugins later down the list).

However if all plugins return true (or don't have a "OnPluginChatDisplay" handler) then ChatNote then does the following:

1. Save the current note colour.
2. Change the note colour to the "chat_foreground_colour" and "chat_background_colour" from the world preferences. If they are both the same, it takes the default chat colour of red on black.
3. Removes a leading newline, if any.
4. Removes a trailing newline, if any.
5. If the world preferences option "ignore_chat_colours" is set, the ANSI codes are stripped from the message.
6. The message is displayed (using AnsiNote).
7. The saved note colour is restored.

The NoteType argument is used to identify "types" of chats to the plugin callback routine. These types are currently defined:

0 Connection attempt
1 Session start, end
2 Name Change
3 Message
4 Incoming Personal
5 Incoming Everybody
6 Incoming roup
7 Outgoing Personal
8 Outgoing Everybody
9 Outgoing Group
10 Peek List
11 Connection List
12 Ping
13 Information
14 File
15 Snoop Data
16 Command

You could use those to send some types of messages (eg. connection attempts) to the main world window, but other types to a notepad window.

VBscript example

ChatNote 3, "<CHAT> My plugin is now installed"

Jscript example

ChatNote (3, "<CHAT> My plugin is now installed");

PerlScript example

ChatNote (3, "<CHAT> My plugin is now installed");

Python example

world.ChatNote (3, "<CHAT> My plugin is now installed")

Lua example

ChatNote (3, "<CHAT> My plugin is now installed")

Lua notes

The message is optional and defaults to the empty string.

Return value

Nothing.

Related topic

Chat system

See also

FunctionDescription
ANSIGenerates an ANSI colour sequence
AnsiNoteMake a note in the output window from text with ANSI colour codes imbedded
ColourNoteSends a message to the output window in specified colours
GetOptionGets value of a named world option
NoteSends a note to the output window
SetOptionSets value of a named world option