Double counting? - 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: Double counting? (/showthread.php?tid=61729)
Double counting? by hpzone on 06-27-2006 at 11:27 AM
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?
RE: Double counting? by Ezra on 06-27-2006 at 11:49 AM
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.
RE: Double counting? by Mnjul on 06-27-2006 at 11:54 AM
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
RE: Double counting? by hpzone on 06-27-2006 at 12:06 PM
MnJul, you're right, It's working perfectly atm Thanks!
|