[Solved] problems with a status checker script... - 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: [Solved] problems with a status checker script... (/showthread.php?tid=88614)
[Solved] problems with a status checker script... by blessedguy on 01-21-2009 at 06:17 PM
Ok, this is my first script =X
As first function, I want it to display a toast showing my current status, when I change it.
For example. I'm appearing offline, then I change my status to online, want the script to display a toast saying; "Status: Online"
I've already discovered how to do it... but the problem is the it always shows my PREVIOUS status, not the current one.
This is what happens: I'm appearing offline, if I set my status to online, it shows "Status: Appearing Offline". After it, if i change my status again, this time to away, for example, it will display "Status: Online".
Any tips? =/
i'm using this code:
code: function OnEvent_MyStatusChange(NewStatus)
{
if(Messenger.MyStatus == "2")
{
var Message = "Status: Appearing Offline";
MsgPlus.DisplayToast("", Message);
}
if(Messenger.MyStatus == "3")
{
var Message = "Status: Online";
MsgPlus.DisplayToast("", Message);
}
if(Messenger.MyStatus == "4")
{
var Message = "Status: Busy";
MsgPlus.DisplayToast("", Message);
}
if(Messenger.MyStatus == "5")
{
var Message = "Status: Be Right Back";
MsgPlus.DisplayToast("", Message);
}
if(Messenger.MyStatus == "6")
{
var Message = "Status: Idle";
MsgPlus.DisplayToast("", Message);
}
if(Messenger.MyStatus == "7")
{
var Message = "Status: Away";
MsgPlus.DisplayToast("", Message);
}
if(Messenger.MyStatus == "8")
{
var Message = "Status: In a Call";
MsgPlus.DisplayToast("", Message);
}
if(Messenger.MyStatus == "9")
{
var Message = "Status: Out to Lunch";
MsgPlus.DisplayToast("", Message);
}
}
(by the way, if someone wants to know, I'm doing this script to avoid selecting the wrong status. For example, setting status to Online when I want to change it to busy... also to confirm status has changed when using a skin with "Quick status Change" [as i call it]/ "Status Shortcuts" [as guena calls it])
RE: [Help] problems with a status checker script... by matty on 01-21-2009 at 06:30 PM
Messenger.MyStatus will show you the current status. OnEvent_MyStatusChange is called before the status is changed that is why the Parameter NewStatus is there. If you replace Messenger.MyStatus with just NewStatus it will be fine .
Also a few points to note. NewStatus and Messenger.MyStatus are integers not strings... do not put quotes around the values or else it will take more computing cycles to convert it to the proper type.
Also your code could be cleaned up... a lot:
js code: function OnEvent_MyStatusChange(NewStatus) {
var oStatus = {
2 : 'Appearing Offline',
3 : 'Online',
4 : 'Busy',
5 : 'Be Right Back',
6 : 'Idle',
7 : 'Away',
8 : 'In a Call',
9 : 'Out to Lunch'
}
MsgPlus.DisplayToast('', 'Status: '+oStatus[NewStatus]);
}
RE: [Help] problems with a status checker script... by blessedguy on 01-21-2009 at 06:35 PM
quote: Originally posted by matty
Messenger.MyStatus will show you the current status. OnEvent_MyStatusChange is called before the status is changed that is why the Parameter NewStatus is there. If you replace Messenger.MyStatus with just NewStatus it will be fine .
Also a few points to note. NewStatus and Messenger.MyStatus are integers not strings... do not put quotes around the values or else it will take more computing cycles to convert it to the proper type.
phase one: understand what you said =P
phase two: apply changes
thanks matty =D
update:
Ok... i'll do what you suggested.
update 2:
it works =D
thnaks a lot
RE: [Help] problems with a status checker script... by matty on 01-21-2009 at 06:37 PM
quote: Originally posted by blessedguy
phase one: understand what you said =P
What part confused you and I will explain it.
RE: [Help] problems with a status checker script... by blessedguy on 01-21-2009 at 06:39 PM
it wasn't confusing... It's because i'm not used to scripting yet, so I still have to think a lot before figure out what is what
By the way, if I want to add an interface window that lets the user control what text will be show in the toast (for example, changing the default appear offline string to "Aparecer Offline") i'd use PlusWnd.GetControlText ?
RE: [Solved] problems with a status checker script... by matty on 01-21-2009 at 07:44 PM
quote: Originally posted by blessedguy
it wasn't confusing... It's because i'm not used to scripting yet, so I still have to think a lot before figure out what is what
By the way, if I want to add an interface window that lets the user control what text will be show in the toast (for example, changing the default appear offline string to "Aparecer Offline") i'd use PlusWnd.GetControlText ?
Yup
|