What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » WLM Plus! General » Why does Plus! parse sent messages twice?

Why does Plus! parse sent messages twice?
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. Why does Plus! parse sent messages twice?
It appears that Plus! parses messages twice. How come?

For instance if you have this code:

code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage){
    Debug.Trace(sMessage);
}

If the sent message is (!VER) command we all know that Plus! will convert that the the version information.

However if you have this code:

code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage){
    Debug.Trace(sMessage);
    return oChatWnd.EditText.replace(/\(!VER\)/g, '(!VER)\nthis is a test');
}

You would expect that the returned message should be
(!VER)
this is a test

However it isn't Plus! will parse the message again after that function is complete.

Plus! should, in all reality, only parse the message after each script has completed that function if it exists. This will save CPU cycles.

I know it isn't visible to the naked eye or can't appear to be taking any more time to parse twice but it makes the poor CPU work that much harder.

This post was edited on 07-08-2007 at 09:29 PM by matty.
07-08-2007 09:18 PM
Profile E-Mail PM Find Quote Report
Patchou
Messenger Plus! Creator
*****

Avatar

Posts: 8607
Reputation: 201
43 / Male / Flag
Joined: Apr 2002
RE: Why does Plus! parse sent messages twice?
the message is parsed again if modified so that script developers can use commands and tags like (!VER). I doubt it makes any difference to anybody's computer :).
[Image: signature2.gif]
07-08-2007 11:37 PM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: Why does Plus! parse sent messages twice?
Ok well why parse it a first time? Why not only parse it once? sMessage should be the unparsed string you shouldn't have to read the EditText to get the unparsed string.

This post was edited on 07-08-2007 at 11:50 PM by matty.
07-08-2007 11:49 PM
Profile E-Mail PM Find Quote Report
Patchou
Messenger Plus! Creator
*****

Avatar

Posts: 8607
Reputation: 201
43 / Male / Flag
Joined: Apr 2002
RE: Why does Plus! parse sent messages twice?
this is by design and it's meant to work like that. As you said, you can already get the unparsed text from the edit text value.
[Image: signature2.gif]
07-09-2007 04:18 AM
Profile PM Web Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: Why does Plus! parse sent messages twice?
I think the unparsed text is VERY useful to the user and if anything should be what is there rather than what the script puts out as that is what the user typed to make it work, just like a command.

I realise there is the (!T) thing, but lets make an example as if a script did this instead.

User types:
code:
The current time here is (!T)

Output sent:
code:
The current time here is 11:54:32 PM

The second line is already redundant as (!T) is dynamic against the time and it has already past (unless you were to repeat yourself in an exact multiple of 24hours from that time afterwards).  The first line however is very critical to make it easier to show again and is more useful to both parties as it is the current and not the past.

This related to anything that is subject to time (in any form) or has some in built mechanism to not repeat itself.  This also has consequences in the likes of Message Customizer! Live because of the compounding colours (which would just build up again an again).  Therefore, for the ease of the user, I really think the script output should be removed completely as this is not the text they wrote or the command they executed.
[Image: markee.png]
07-09-2007 01:59 PM
Profile PM Find Quote Report
Volv
Skinning Contest Winner
*****

Avatar

Posts: 1233
Reputation: 31
34 / Male / Flag
Joined: Oct 2004
RE: Why does Plus! parse sent messages twice?
markee, that's not true. It's a bit like the principle which was brought up before where when you type /nick (!T) you want it to show the time at which you typed the command rather than the time at which you look at your nickname... I believe that all of MsgPlus's default commands should override anything which scripts do, especially tags like (!T) which are placed into the message to indicate the current time.

As Patchou already said, if you really want to "you can already get the unparsed text from the edit text value."

This post was edited on 07-09-2007 at 02:18 PM by Volv.
07-09-2007 02:16 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Why does Plus! parse sent messages twice?
Texts need to be parsed again. Remember that your script isn't the only script which is running (probably)...

Your script can output something which another script on its turn needs to change or parse or whatever.

Hence, when your script outputs something differently, it is only logical that it is again send to all the scripts again.

That you might end up with a buildup of tags is the fault of the script developper (to say it in a crude way). It is the responsebility of the programmer to make his script parsing and changing messages in a proper way.

imho
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-10-2007 12:20 AM
Profile 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