[Home] [Downloads] [Search] [Help/forum]

MUSHclient scripting

Description of MUSHclient world function: world.ChatNote

Name ChatNote
Type Method
Summary Does a note using ANSI codes for the chat system
Prototype void ChatNote(short NoteType, BSTR Message);

View list of data type meanings


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.

Note: Available in version 3.37 onwards.

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.
Returns Nothing.
Introduced in version 3.37

See also ...

Function Description
ANSI Generates an ANSI colour sequence
AnsiNote Make a note in the output window from text with ANSI colour codes imbedded
ColourNote Sends a message to the output window in specified colours
GetOption Gets value of a named world option
Note Sends a note to the output window
SetOption Sets value of a named world option

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.

Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes

Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes

View all functions


Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]