Shoutbox

"Variable" in toast - 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: "Variable" in toast (/showthread.php?tid=78725)

"Variable" in toast by Addenorw on 11-04-2007 at 11:41 AM

I've got a little question. I want to make the toast use different words in the text. For example:
Person has just arrived in his/hers car

And I want the car-word to be many diffrent things. What will i need to write in then?

And one more question:
In the script, I have wrote this for the toast:
function OnEvent_ContactSignin(Email){
var contacmail = Email;
signedincontact = Messenger.MyContacts.GetContact(contactemail);
      if(signedincontact.Blocked!=true){
{
        var Message = signedincontact.Name+ "has just arrived in is/hers car"+.;
        Message = MsgPlus.RemoveFormatCodes(Message);
        MsgPlus.DisplayToast("", Message);
}

But it says that it is wrong in the var message thin. What is wrong?

Thanks in advance:)


RE: "Variable" in toast by Spunky on 11-04-2007 at 12:21 PM

code:
var Words = new Array("Car","something", "etc");

function OnEvent_ContactSignin(contactemail){
    signedincontact = Messenger.MyContacts.getContact(contactemail)
    if(signedincontact.Blocked===false){
        var Message = MsgPlus.RevoveFormatCodes(signedincontact.Name+" has just arrived in his/her "+RandomWord())
        MsgPlus.DisplayToast("",Message);
    }
}

function RandomWord(){
    var x = Math.floor(Math.random()*Words.length)
    return Words[x];
}


RE: "Variable" in toast by Matti on 11-04-2007 at 03:53 PM

The bit where it went wrong is that you placed a period outside the quotes:

code:
var Message = signedincontact.Name+ "has just arrived in is/hers car"+.;
You should place it between the quotes, and thus there's no need for the plus operator. Oh, and maybe you want a space before "has"? :)
code:
var Message = signedincontact.Name+ " has just arrived in is/hers car.";

Of course, if you simply use Spunky's code, you have everything you need. :P