Shoutbox

Ummm, WTF? - 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: Ummm, WTF? (/showthread.php?tid=65929)

Ummm, WTF? by Geodesic_Dragon on 09-07-2006 at 12:12 AM

I am trying to do a script which changes your personal message when you change your status. But this code:

code:
OnEvent_MyStatusChange(
    [enum] NewStatus
);


every time I use the appropriate enum:

2 - Appear Offline
3 - Online
4 - Busy
5 - Be Right Back
6 - Idle
7 - Away
8 - In a Call
9 - Out to Lunch

It doesn't work.

So say I want my personal message to change to "I'll be back in a jiffy!" when my status changes to Be Right Back - what the HELL do I do?

Thanks.
RE: Ummm, WTF? by alexp2_ad on 09-07-2006 at 12:18 AM

quote:
Originally posted by Geodesic_Dragon

So say I want my personal message to change to "I'll be back in a jiffy!" when my status changes to Be Right Back - what the HELL do I do?

Thanks.


code:
function OnEvent_MyStatusChange(nNewStatus){
   if(nNewStatus == 5){
      oldpsm = Messenger.MyPersonalMessage;
      Messenger.MyPersonalMessage = "I'll be back in a jiffy!";
   }
   else if(Messenger.MyStatus == 5){
      Messenger.MyPersonalMessage = oldpsm;
   }
}


That'll change it back afterwards, which I presume you want too.
RE: Ummm, WTF? by Geodesic_Dragon on 09-07-2006 at 12:22 AM

Thanks!

and BTW, it should have been

code:
function OnEvent_MyStatusChange(nNewStatus)

RE: Ummm, WTF? by NanaFreak on 09-07-2006 at 05:33 AM

code:
var oldpsm;
function OnEvent_MyStatusChange(nNewStatus){
   if(nNewStatus == 5){
      oldpsm = Messenger.MyPersonalMessage;
      Messenger.MyPersonalMessage = "I'll be back in a jiffy!";
   }
   else if(nNewStatus != 5 && oldpsm != null){
      Messenger.MyPersonalMessage = oldpsm;
      oldpsm = null;
   }
}
I think this may work a little better and be what you are after.
RE: RE: Ummm, WTF? by alexp2_ad on 09-07-2006 at 08:59 AM

quote:
Originally posted by Jay_Jay
I think this may work a little better and be what you are after.

No it won't... that'll work exactly the same.  :^)
RE: Ummm, WTF? by NanaFreak on 09-07-2006 at 09:09 AM

urs:

code:
OnEvent_MyStatusChange(nNewStatus){
   if(nNewStatus == 5){
      oldpsm = Messenger.MyPersonalMessage;
      Messenger.MyPersonalMessage = "I'll be back in a jiffy!";
   }
   else if(Messenger.MyStatus == 5){
      Messenger.MyPersonalMessage = oldpsm;
   }
}

mine:
code:
var oldpsm;
function
OnEvent_MyStatusChange(nNewStatus){
   if(nNewStatus == 5){
      oldpsm = Messenger.MyPersonalMessage;
      Messenger.MyPersonalMessage = "I'll be back in a jiffy!";
   }
   else if(nNewStatus != 5 && oldpsm != null){
      Messenger.MyPersonalMessage = oldpsm;
      oldpsm = null;
   }
}
the higblighted bits will make it work especially the != not == or it would do it at the same time and wouldnt work and you should make oldpsm a global variable
RE: RE: Ummm, WTF? by alexp2_ad on 09-07-2006 at 09:12 AM

quote:
Originally posted by Jay_Jay
the higblighted bits will make it work especially the != not == or it would do it at the same time and wouldnt work and you should make oldpsm a global variable

1.  OK, yes I missed out the word function, but he already figured that out.
2.  oldpsm IS a global variable.
3.  Have you actually tried my code?  I don't think you understand how it works, please do try it, you'll observe that it works identically to yours. :P
RE: Ummm, WTF? by markee on 09-07-2006 at 09:13 AM

quote:
Originally posted by -!Felu!-
quote:
Originally posted by alexp2_ad
No it won't... that'll work exactly the same.  :^)
Actually His would work and your wouldn't :p

 
quote:
Originally posted by alexp2_ad
code:
OnEvent_MyStatusChange(nNewStatus){
   if(nNewStatus == 5){
      oldpsm = Messenger.MyPersonalMessage;
      Messenger.MyPersonalMessage = "I'll be back in a jiffy!";
   }
else if(Messenger.MyStatus == 5){
      Messenger.MyPersonalMessage = oldpsm;
   }
}


 
 
 
quote:
Originally posted by Jay_Jay
code:
var oldpsm;
function OnEvent_MyStatusChange(nNewStatus){
   if(nNewStatus == 5){
      oldpsm = Messenger.MyPersonalMessage;
      Messenger.MyPersonalMessage = "I'll be back in a jiffy!";
   }
   else if(nNewStatus != 5 && oldpsm != null){
      Messenger.MyPersonalMessage = oldpsm;
      oldpsm = null;
   }
}

See the bold line :p.
I thought the same but I used it and it worked, even without a global variable.  I don't understand how but it works exactly the same.

Edit:
   
quote:
Originally posted by alexp2_ad
1. OK, yes I missed out the word function, but he already figured that out.

It seems to work just how it is :s
RE: Ummm, WTF? by alexp2_ad on 09-07-2006 at 09:30 AM

1.  oldpsm is a global variable, since it isn't declared with var
2.  felu:  How is the bold line a problem?  It checks you are coming out of brb status to change the psm back.
3.  Stop saying it doesn't work before trying it!


RE: Ummm, WTF? by CookieRevised on 09-07-2006 at 09:38 AM

alexp2_ad's script will work and would be my preffered way too, since (as he said also), it will put your psm back to what it was when you come out of BRB.

Remember that the function OnEvent_MyStatusChange is triggered before the actual status has changed. This means:
1)  nNewStatus reflects the new status which will be set when the function finishes
2) Messenger.MyStatus will still reflect the old status at the time the function is triggered.

As you also can read in the scripting documentation.