Shoutbox

certain character colour - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: certain character colour (/showthread.php?tid=92010)

certain character colour by thehealey on 08-26-2009 at 02:43 PM

Hi, i have a little bit of knowledge in javascript and such and I'm just wondering if it would be possible to have an add on that can change the font colour of certain characters. So for instance every time I type a "e" it would be in an orange font where as all the other letters would be my normal blue.

I think it would be cool if like all the numbers and symbols were in the different colour and that by editing the script i could add/remove what characters are in the different colour and what the hexcode of the colour is.

I've searched round the forum a bit and there doesn't seem to be much on this and I'm just wondering if its possible? Thankyou for your time.


RE: certain character colour by thehealey on 08-27-2009 at 01:48 PM

So I've been learning a bit of scripting to help me do this and I've come to the conclusion I should use the ChatWndEditKeyDown event.  and i've got as far as this:

code:
function OnEvent_ChatWndEditKeyDown( ChatWnd, vkKey, bCtrl, bShift ) {
    if ((vkKey == 0x4D /* VK_RETURN */) && (bCtrl == false) && (bShift == false))
            {

It's just now I don't know how to change the colour of the character, I've identified the character is the letter "m" but how can I change the colour of the letter?

I'm not sure if I'm using the right event, maybe i should be using the ChatWndSendMessage event instead to read through every character and replace the "m"s with the different coloured "m" characters, i just figured that would be slower than using the ChatWndEditKeyDown method and also means the colour affect would only appear in the converssation itself and not the box i enter text into on msn. Please please please help, this is starting to go over my head.
RE: certain character colour by matty on 08-27-2009 at 02:44 PM

It would be easier to do it this way

js code:
function OnEvent_ChatWndSendMessage ( pChatWnd , sMessage ) {
    return sMessage.replace ( /m/g , '[c=2]m[/c]' );
}