What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Displaying my name in colour?

Displaying my name in colour?
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: Displaying my name in colour?
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,"");
    }
}
[Image: markee.png]
04-02-2007 11:48 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Displaying my name in colour? - by Ashylay on 04-01-2007 at 05:06 PM
RE: Displaying my name in colour? - by markee on 04-02-2007 at 11:48 AM
RE: Displaying my name in colour? - by Ashylay on 04-02-2007 at 12:01 PM
RE: Displaying my name in colour? - by matty on 04-02-2007 at 12:26 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On