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

Double counting?
Author: Message:
hpzone
New Member
*


Posts: 4
Joined: Jun 2006
O.P. Double counting?
Very strange,


code:
var Verzonden = 0;
var Ontvangen = 0;

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
Verzonden++;
Messenger.MyPersonalMessage = "Aantal verzonden berichten in deze sessie: " + Verzonden + " Aantal ontvangen berichten: " + Ontvangen;
}

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{

Ontvangen++;
Messenger.MyPersonalMessage = "Aantal verzonden berichten in deze sessie: " + Verzonden + " Aantal ontvangen berichten: " + Ontvangen;
   
}


When Verzonden is upgraded by one, it automaticly upgrades the Ontvangen variable, so the statics of the counter are really unreliable :) How to fix, or what to fix? :)
06-27-2006 11:27 AM
Profile E-Mail PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: Double counting?
OnEvent_ChatWndReceiveMessage

also sees the messages you send, so you have to check the origin with your address to not count the messages you send.
[Image: 1-0.png]
             
06-27-2006 11:49 AM
Profile PM Web Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: Double counting?
There is no need for "fix" because you misunderstand the mechanism of OnEvent_ChatWndReceiveMessage; the event is triggered when you send a message too.
What the script documentation says in OnEvent_ChatWndReceiveMessage:
quote:
The OnEvent_ChatWndReceiveMessage event is fired when a new message is received in a chat window. The event is generated for any message added to the history control which includes the messages sent by the current user. It can be used to modify the message before it is displayed to the user.

So I think you should modify this line:
code:
Messenger.MyPersonalMessage = "Aantal verzonden berichten in deze sessie: " + Verzonden + " Aantal ontvangen berichten: " + Ontvangen
to
code:
Messenger.MyPersonalMessage = "Aantal verzonden berichten in deze sessie: " + Verzonden + " Aantal ontvangen berichten: " + (Ontvangen - Verzonden)

Hope this helps :)


Edit: er, ezra beats me to it :p

This post was edited on 06-27-2006 at 11:54 AM by Mnjul.
06-27-2006 11:54 AM
Profile PM Web Find Quote Report
hpzone
New Member
*


Posts: 4
Joined: Jun 2006
O.P. RE: Double counting?
MnJul, you're right, It's working perfectly atm :) Thanks!
06-27-2006 12:06 PM
Profile E-Mail PM 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