What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Contact PSM change

Contact PSM change
Author: Message:
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. Happy  Contact PSM change
Hey folks,
I've got a bit of an odd one here.  I want a script to copy another contacts PSM, if and when they change it.  However, in this particular situation, the PSM event doesnt fire for this contact.  I'm wondering if theres another way to check for a contact changing PSM,  without using timers if at all possible?

I'm also struggling to figure out how to check if a contact is online at signin, for the same script.  Basically, just to copy their PSM then.

Anyone have any suggestions?
Cheers
Leroux
[Image: adsig.jpg]
10-28-2008 06:28 AM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
29 / Male / Flag
Joined: Jul 2007
RE: Contact PSM change
code:
var Contacts = new Array();

function LoadContacts() {
      for(var e = new Enumerator(Messenger.MyContacts); !e.atEnd(); e.moveNext()) {
            Contacts[e.item().Email] = e.item(); // Convert Messenger.MyContacts to an array
      }
}

function OnEvent_ContactSignin(Email) {
      if(Contacts[Email].Status == STATUS_ONLINE /* Assume you have MsgPlus 4.23 or higher? */ ) {
            [do what you want to here]
      }
}


Call LoadContacts() somewhere in the very beginning of your script, recommend OnEvent_SigninReady();

If a change occurs in your contact list, Messenger Plus! will update the Contacts array, as well as Messenger.MyContacts and ChatWnd.Contacts.

A PSM change --> should <-- call OnEvent_ContactPsmChange() (unless you change your own psm). An extra safety option for ContactSignin would be:

code:
function OnEvent_ContactSignin(Email) {
      if(Email in Contacts) {
            if(Contacts[Email].Status == STATUS_ONLINE /* Assume you have MsgPlus 4.23 or higher? */ ) {
                  [do what you want to here]
            }
      }
}


Also, if OnEvent_ContactPsmChange() occurs, the Contacts array (by which I mean our array declared in the global scope at the top, not MsgPlus' Contact(s) object) is updated.

This post was edited on 10-28-2008 at 03:35 PM by SmokingCookie.
10-28-2008 03:32 PM
Profile PM Find Quote Report
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. RE: Contact PSM change
Cheers SmokingCookie, I'd completely forgotten how to do enumerators.  Need to stop leaving scripting for so long.  I've got work unfortunately, but after I'm back I'll give it a try and sort everything out.

Regarding the PSM, its a problem becuase I'm trying to get it from a 360.  I know people have made scripts before, but they never work for me.  Its possible to ge the PSM, but the event doesnt fire when the 360 PSM changes.  I have my suspicions regarding why, but in the end it doesnt change anything.  I was gonna use Xniff to get it, but tbh, I think I'll go for the timer.  It'll crash much less, and don't think I care if my name shows they're playing a game for a little longer
[Image: adsig.jpg]
10-28-2008 06:29 PM
Profile E-Mail PM Web Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Contact PSM change
Why do you need to collect all Contact objects first, when you can do:
code:
function OnEvent_ContactSignin(Email) {
      var Contact = Messenger.MyContacts.GetContact(Email);
      if(Contact.Status == STATUS_ONLINE /* Assume you have MsgPlus 4.23 or higher? */ ) {
            [do what you want to here]
      }
}
Try not to make things more complicated than necessary. Plus! Live scripting is already hard enough! :P
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
10-28-2008 06:35 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
29 / Male / Flag
Joined: Jul 2007
RE: Contact PSM change
You can use enumerators using the for() loop, as I'd described in my previous post. There may be alternatives, like a while() loop, but this one's what I got used to and prefer to use.

Cheerio ;)

@ Matti:

Cause I think such an array is easier to access, also throughout the script. If you have a load of oops, you'll use lots of memory (and perhaps CPU usage), which you might have wanted to use for other things.

This post was edited on 10-28-2008 at 06:40 PM by SmokingCookie.
10-28-2008 06:37 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Contact PSM change
quote:
Originally posted by SmokingCookie
@ Matti:

Cause I think such an array is easier to access, also throughout the script. If you have a load of oops, you'll use lots of memory (and perhaps CPU usage), which you might have wanted to use for other things.
Which will fail if a new contact is added they will not be in the list.

If at all possible use GetContact.
10-28-2008 06:42 PM
Profile E-Mail PM Find Quote Report
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. RE: Contact PSM change
I have it working with the GetContact now.  The enumerator worked fine, but I will only need it for a single contact, so the array just gets wasted.

- Looks like its all four naught anyway.  Plus doesnt return the personal message for that account either.  Very odd, since I'm relatively sure that it did yesterday, but nevermind.  I'm just gonna have to use Xniff instead.

This post was edited on 10-28-2008 at 11:43 PM by ArkaneArkade.
[Image: adsig.jpg]
10-28-2008 10:32 PM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: Contact PSM change
quote:
Originally posted by Leroux
I'm just gonna have to use Xniff instead

I have a feeling that the messages you'll need to look for will be formatted differently or used in a slightly different context (thus why Plus! doesn't seem to get them from WLM properly... it's like a new field rather than the psm (similar to how MediaPSM isn't the same as PSM, but they occupy the same space.)
<Eljay> "Problems encountered: shit blew up" :zippy:
10-29-2008 04:46 PM
Profile PM Find Quote Report
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. RE: RE: Contact PSM change
I have a feeling that the messages you'll need to look for will be formatted differently or used in a slightly different context (thus why Plus! doesn't seem to get them from WLM properly... it's like a new field rather than the psm (similar to how MediaPSM isn't the same as PSM, but they occupy the same space.)

I have it working... or did, it randomly stopped now.  It is formatted slightly differently, and I think thats whats stopping Plus! detecting it, but it is still a PSM as far as I can tell, efter looking at Xniffs data for xbox and normal accounts.  I just don't understand why I was successfully getting the PSM from it yesterday, but not today.  Although I've just remembered what it was actually doing to give me it, so I'll do some testing.
[Image: adsig.jpg]
10-29-2008 07:01 PM
Profile E-Mail PM Web Find Quote Report
« 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