What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Display Picture switches back

Display Picture switches back
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Display Picture switches back
Is the the complete code? If so, some potential problems will arise. This is because you're using timers. And with timers you need to be extra carefull... always. And cope with a lot more situations than just the obvious ones.

For starters, you don't cancel the timer when some other user logs in to Messenger. It isn't even cancelled when you log out. This will produce errors and at the least unexpected behaviour when such events occur. Remember that timers are not user specific and that scripts start to run the second you start Messenger. So they are running even before you log in and continue to run until you completely quit the Messenger application; they don't stop running when you simply log out. So this is also true for timers. All this is way too often forgotten in extremely many scripts (including many in the official script DB), making them all not work properly!!

Second, whenever a message is send before the timer delay has passed, you will get the exact behaviour as you described as being the problem. This is because the second time the ChatWndSendMessage event is fired the 'original' DP in the array (at index 0) is overwritten with the temporary one from the previous event.

So, what you must do:
1) add the event for when the user signs out. In that event, cancel the timer which might still be running.

2) Add a check to see if the global array contains an 'original' DP at index 0. if so, do not write the current display picture to index 0. This because when this occurs, the current showing DP is not the user's original one but a temporary one from a previous 'word to DP' event.

3) In the timer event, after the original DP is set back, you also need to clear out index 0 of the global array to accomodate proper workings of point 2.


Note: there are limits in how often you can change your DP in a certain timespan. This means that scripts like this will always have some potential problems and limits and might not always work properly; there will always be times and situations when your original DP can not be set back.


Note for point 1: you can make it a bit more complicated in such a way that the timer isn't cancelled but continues to run when a user logs out. But, in that case you need to make the timer user specific (the name can contain the user ID to make it user specific) and check if the same user is still logged in before setting the DP back. This makes that the script will support multiple users and that it can cope with sudden unexpected disconnections and reconnections of Messenger. Ofcourse, you would also need an array per user, or in other words a two dimensional array containing the user's ID and the corresponding original DP, (and the index of the 'Word'-DP for that user).

;)

This post was edited on 02-02-2009 at 03:12 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
02-02-2009 02:59 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Display Picture switches back - by Genesis Genome on 02-02-2009 at 12:56 AM
RE: Display Picture switches back - by matty on 02-02-2009 at 02:42 AM
RE: Display Picture switches back - by Genesis Genome on 02-02-2009 at 10:25 AM
RE: Display Picture switches back - by CookieRevised on 02-02-2009 at 02:59 PM
RE: Display Picture switches back - by Genesis Genome on 02-02-2009 at 03:51 PM
RE: RE: Display Picture switches back - by CookieRevised on 02-02-2009 at 04:29 PM
RE: Display Picture switches back - by Matti on 02-02-2009 at 04:03 PM
RE: Display Picture switches back - by Genesis Genome on 02-02-2009 at 04:10 PM
RE: Display Picture switches back - by Matti on 02-02-2009 at 04:14 PM
RE: Display Picture switches back - by Genesis Genome on 02-02-2009 at 05:17 PM
RE: RE: Display Picture switches back - by CookieRevised on 02-02-2009 at 05:43 PM


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