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,"");
}
}