MapColour
Script function

world.MapColour

DOC_scripting Read about scripting

Type

Method

Summary

Changes the colour mapping - the way colours are displayed

Prototype

void MapColour(long Original, long Replacement);

DOC_data_types View list of data type meanings


Description

You can specify a "map" of an original colour to the colour you want displayed.

The intention here is to let you override the colours sent down by MUDs, particularly using MXP colours, which are not subject to the normal ANSI colour palette.

For example, if a MUD annoys you by using a lot of red letters, you could do this:

MapColour (ColourNameToRGB ("red"), ColourNameToRGB ("green"))

The mapping is done at the last moment, in the output window display routine. The rest of MUSHclient will continue normally as if the colours had not changed.

You can map any number of colours, within reason. Potentially there are 16,777,216 different colours (2 to the power 24) however in practice a particular MUD is likely to only use a handful.

The colour must match *exactly* or the translation will not occur.

The arguments to the function are RGB colours (that is, numbers in the range 0 to 16,777,215) however you can use the function ColourNameToRGB as shown above if you want to use colour names.

The colour number is really made up of three bytes:

Red (low-order byte), ie. 0 to 255
Green (middle byte), ie. 0 to 255 multiplied by 256
Blue (higher-order byte), ie. 0 to 255 multiplied by 65536

To find the colour of a particular piece of text in the output window (so you can know the "from" colour) you can select it (eg. double-click) and then use the Display menu -> Text Attributes.

This will show you the Text and Background RGB colours (in HTML format). You can use those colours in the function ColourNameToRGB to translate them to numbers. eg.

x = ColourNameToRGB ("#FF00FF")

You can find the current mapping of a colour with GetMapColour, and a list of all mapped colours with MapColourList.

To make the new colours take effect immediately, call Redraw. This would only be necessary if you are changing colours "on the fly". If you are just customising colours at world startup this would not be necessary.



VBscript example

MapColour ColourNameToRGB ("red"), ColourNameToRGB ("green")



Jscript example

MapColour (ColourNameToRGB ("red"), ColourNameToRGB ("green"))



Lua example

MapColour (ColourNameToRGB ("red"), ColourNameToRGB ("green"))



Return value

None.




See Also ...

Topics

DOC_colours Colour management
DOC_defaults Default triggers/aliases/timers/macros/colours

Functions

FNC_AdjustColour AdjustColour (Adjust an RGB colour)
FNC_ANSI ANSI (Generates an ANSI colour sequence)
FNC_BoldColour BoldColour (Gets/sets the RGB colour for one of the 8 ANSI bold colours)
FNC_ColourNameToRGB ColourNameToRGB (Converts a named colour to a RGB colour code.)
FNC_ColourNote ColourNote (Sends a message to the output window in specified colours)
FNC_ColourTell ColourTell (Sends a message to the output window in specified colours - not terminated by a newline)
FNC_CustomColourBackground CustomColourBackground (Sets the RGB value for the background of a custom colour)
FNC_CustomColourText CustomColourText (Sets the RGB value for the text of a custom colour)
FNC_GetCustomColourName GetCustomColourName (Gets the name of a custom colour)
FNC_GetMapColour GetMapColour (Returns the mapping for how a particular colour will be displayed)
FNC_MapColourList MapColourList (Returns an array of all the mapped colours)
FNC_NormalColour NormalColour (Gets/sets the RGB colour for one of the 8 ANSI normal colours)
FNC_NoteColour NoteColour (Chooses which custom colour will be used for world notes.)
FNC_NoteColourBack NoteColourBack (Chooses which RGB colour will be used for world notes - background colour)
FNC_NoteColourFore NoteColourFore (Chooses which RGB colour will be used for world notes - text colour)
FNC_NoteColourName NoteColourName (Chooses which RGB colour name will be used for world notes - text and background)
FNC_NoteColourRGB NoteColourRGB (Chooses which RGB colour will be used for world notes - text and background)
FNC_PickColour PickColour (Invokes the MUSHclient colour picker dialog)
FNC_Redraw Redraw (Redraws all windows for this world)
FNC_RGBColourToName RGBColourToName (Converts an RGB colour code to its equivalent name)
FNC_SetCustomColourName SetCustomColourName (Sets the name of a custom colour)

(Help topic: function=MapColour)

DOC_contents Documentation contents page