What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Question about "MyStatus"

Pages: (2): « First « 1 [ 2 ] Last »
Question about "MyStatus"
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Question about "MyStatus"
quote:
Originally posted by matty
:dodgy:...
I prefer to use the enumeration for status
Of course, but that would break backwards compatibility. And it'll save you a few bytes.


...

Okay perhaps it's not so much of a big deal. Choose whatever you think is best. :P

This post was edited on 01-19-2010 at 04:55 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-19-2010 04:55 PM
Profile E-Mail PM Web Find Quote Report
5n4k3
Junior Member
**


Posts: 18
Reputation: 1
30 / Male / Flag
Joined: Jan 2010
O.P. RE: Question about "MyStatus"
Mmm... so is stoshrocket's solution to my auto-message problem the best way?

And if so what's the line:

javascript code:
if(automsg == -1)


do?

~ 5n4k3
01-19-2010 05:20 PM
Profile E-Mail PM Find Quote Report
stoshrocket
Senior Member
****

Avatar
formerly methos

Posts: 748
Reputation: 31
34 / Male / Flag
Joined: Aug 2005
RE: Question about "MyStatus"
quote:
Originally posted by 5n4k3

And if so what's the line:
javascript code:
if(automsg == -1)

do?
The variable automsg is the return value for "Message.search("AutoMessage :")".

search() returns the position what is searched for, or -1 if it can't be found.

Therefore, that line checks if "AutoMessage :" is in the message sent, if it is then it's (probably) an automessage and won't change your status. Of course, this will trip up if your message sent contains the string "AutoMessage :".

This post was edited on 01-19-2010 at 07:54 PM by stoshrocket.
formerly methos
01-19-2010 07:52 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Question about "MyStatus"
shorter and slithly faster:
js code:
function OnEvent_ChatWndSendMessage( ChatWnd, Message )
{
    // Check if it is not an automessage and if we're not busy yet
    if (!/^AutoMessage :/.test(Message) && Messenger.MyStatus !== 4 ) {
        // Set to busy
        Messenger.MyStatus = 4;
    }
    // Return the unmodified message
    // Never forget to return something for ChatWndSendMessage!
    return Message;
}

! means NOT (The boolean True becomes False, and False becomes True)
/blahblah/ is a special syntax used for regular expressions
^  at the beginning of a regular expression means start comparing it from the beginning (aka: don't do a (slower) search).
test(blahblah) is a method of the regular expression object which test the occurance of the regular expression (in the above case '^AutoMessage :') in the string (in the above case the Message variable)
&& performs a logical conjunction (=AND) on two expressions (both expressions must be True for the result to be True)

If Message begins with the string 'AutoMessage :' then /^AutoMessage :/.test(Message) will return True. Otherwise it will return False. Hence the use of ! (=NOT) to change the result of the test to the opposite...

This post was edited on 01-19-2010 at 08:45 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
01-19-2010 08:35 PM
Profile PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: Question about "MyStatus"
there is no space before the colon - only after.

it should be searching for "AutoMessage: "
:P

your full script:
JScript code:
var szStatus = {
    2 : "appear offline",
    3 : "online",
    4 : "busy",
    7 : "away",
    6 : "idle",
   
    // maybe it can happen
    0 : "unknown",
   
    // WLM 8.5
    5 : "brb",
    8 : "in a call",
    9 : "out to lunch"
    };

function OnEvent_ChatWndCreated(ChatWnd){
    MsgPlus.DisplayToast("", "Your Messenger Status: " + szStatus[Messenger.MyStatus]);
    }

function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    if(Messenger.MyStatus !== STATUS_BUSY && !/^AutoMessage: /.test(Message))
        Messenger.MyStatus = STATUS_BUSY;
    }

@cookiematty: that enumeration for status code you posted returns undefined if like variable[MyStatus]. using it like variable.STATUS_ONLINE will work, however.

This post was edited on 01-20-2010 at 02:47 AM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
01-19-2010 10:58 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Question about "MyStatus"
quote:
Originally posted by roflmao456
@cookie: that enumeration for status code you posted returns undefined if like variable[MyStatus]. using it like variable.STATUS_ONLINE will work, however.
blame matty, he posted it, not me ;)
.-= A 'frrrrrrrituurrr' for Wacky =-.
01-19-2010 11:39 PM
Profile PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: Question about "MyStatus"
quote:
Originally posted by CookieRevised
quote:
Originally posted by roflmao456
@cookie: that enumeration for status code you posted returns undefined if like variable[MyStatus]. using it like variable.STATUS_ONLINE will work, however.
blame matty, he posted it, not me ;)

[Image: facepalm.jpg]
perhaps i should start looking at names rather than "OFFICIAL TESTER" :P

This post was edited on 01-20-2010 at 02:55 AM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
01-20-2010 02:47 AM
Profile PM Web Find Quote Report
5n4k3
Junior Member
**


Posts: 18
Reputation: 1
30 / Male / Flag
Joined: Jan 2010
O.P. RE: Question about "MyStatus"
Thanks guys, it works great.

~ 5n4k3
01-20-2010 11:20 AM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Question about "MyStatus"
quote:
Originally posted by CookieRevised
quote:
Originally posted by roflmao456
@cookie: that enumeration for status code you posted returns undefined if like variable[MyStatus]. using it like variable.STATUS_ONLINE will work, however.
blame matty, he posted it, not me ;)

Ah yes, you can't use the value of a variable or expression as identifier for a property when you're defining an object literal. "STATUS_ONLINE" is interpreted as a string identifier for the property, it does not take the value of STATUS_ONLINE to use as identifier.

Here are some example snippets, for those interested in what went wrong here:
js code:
var key = "123";
var obj = {
    key : "abc"
};
// obj.key or obj["key"] equals "abc"
// obj[key] is undefined

var obj = {
    "key" : "abc"
};
// same object as above

var i = 0;
var obj = {
    (i++) : "first",
    (i++) : "second"
};
// gives a syntax error
// property identifier must be a constant number or string

var i = 0;
var obj = {};
obj[i++] = "first";
obj[i++] = "second";
// this will work though, the square brackets can take both constant or variable values
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-20-2010 12:27 PM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« Next Oldest Return to Top Next Newest »


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