Shoutbox

Displaying my name in 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: Displaying my name in colour? (/showthread.php?tid=73210)

Displaying my name in colour? by Ashylay on 04-01-2007 at 05:06 PM

What I want to do is when I send a message (/myname) a toast appears with my name on it IN COLOUR.

Alls I can do is remove the format codes, which I dont want to do and display the format codes which I dont want to do. Any help?

code:
var myName = Messenger.MyName

function OnGetScriptCommands(){
    var commands = "<ScriptCommands>";
    commands += " <Command>"
    commands += " <Name>myname</Name>"
    commands += " <Description>Displays your msn name in a toast</Description>"
    commands += "</ScriptCommands>"
    return commands;
}


function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if(Message=="/myname") {
        myName = MsgPlus.RemoveFormatCodes(myName);
        MsgPlus.DisplayToast("Boo", myName);
    }
}

RE: Displaying my name in colour? by markee on 04-02-2007 at 11:48 AM

quote:
Originally posted by Ashylay
What I want to do is when I send a message (/myname) a toast appears with my name on it IN COLOUR.

Alls I can do is remove the format codes, which I dont want to do and display the format codes which I dont want to do. Any help?

code:
var myName = Messenger.MyName

function OnGetScriptCommands(){
    var commands = "<ScriptCommands>";
    commands += " <Command>"
    commands += " <Name>myname</Name>"
    commands += " <Description>Displays your msn name in a toast</Description>"
    commands += "</ScriptCommands>"
    return commands;
}


function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if(Message=="/myname") {
        myName = MsgPlus.RemoveFormatCodes(myName);
        MsgPlus.DisplayToast("Boo", myName);
    }
}

First of all you don't want your nickname to be a global variable like that because it won't wont work unless you restart the script manually after signing in and even then it will not update it if you choose a different name.  Secondly to get the colour in the name you have to use MsgPlus.DisplayToastContact rather than the one you used as the first parameter after the title (where you have your nick name) is displayed in colour, but you have to remember to add an empty string (the "") for a third variable, unless you want to add something else there.  The only problem is that only one line can be displayed in colour, but you do have the other lines that can be plain text if you wish to use them.  I have fixed the code up for you a little.  Keep working on it, I'm sure you will get a handle of it all soon enough.
code:
function OnGetScriptCommands(){
    var commands = "<ScriptCommands>";
    commands += " <Command>"
    commands += " <Name>myname</Name>"
    commands += " <Description>Displays your msn name in a toast</Description>"
    commands += "</ScriptCommands>"
    return commands;
}


function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    if(Message=="/myname") {
        MsgPlus.DisplayToastContact("Boo",Messenger.MyName,"");
    }
}

RE: Displaying my name in colour? by Ashylay on 04-02-2007 at 12:01 PM

Cheers ill fiddle about with that script now.


RE: Displaying my name in colour? by matty on 04-02-2007 at 12:26 PM

You want to use DisplayToastContact instead of DisplayToast.

This will display colour in the toast.