What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » global variable not working

Pages: (2): « First « 1 [ 2 ] Last »
global variable not working
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: global variable not working
quote:
Originally posted by scutterman
Ol, Matty's code seems good but  i did notice that the:

if (MsgPlus.RemoveFormatCodes(Origin) != name) {

inside the ChatWndReceiveMessage function should replace "Origin" with "sOrigin" since that's what it is declared as in the function, is that right?

Thanks again for all of the help
~~Scutterman~~

That is true but there are problems with your code if you end up using some features of StuffPlug or something like that however.... I suggest using the following code instead....
code:
var aSent = new Array();

function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
    aSent[ChatWnd.Handle] = Message;
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
    if (aSent[ChatWnd.Handle] === Message) {
        delete aSent[ChatWnd.Handle];
    } else {
        MsgPlus.PlaySound("i likse the way you moo.mp3",1500) //this sound will be replaced with "type" when i have converted it to mp3
    }
}

Please note that this isn't my code, it is CookieRevised's code and any thanks should go to him.  It is a more failsafe way of going about what you are trying and I HIGHLY recommend that you use it instead.

I also would like to point everyone to the code at the bottom of CookieRevised's reply to [Fix] Problem with OnEvent_ChatWndRecieveMessage's Origin for any issue involving triggering events only when a contact sends a message.
[Image: markee.png]
07-24-2007 01:54 PM
Profile PM Find Quote Report
scutterman
Junior Member
**

Avatar
-- Scutterman avatar from Runescape

Posts: 21
– / Male / Flag
Joined: Jul 2007
O.P. RE: global variable not working
The code looks good but as I said I'm new so I would be realy grateful if someone could talk me through it.

P.S. why are there 3 "=" signs in this part:
if (aSent[ChatWnd.Handle] === Message) {

Thanks alot
~~Scutterman~~

Of course the world doesn't make sense
Its only purpose is to be somewhere that
humans can stand around in complaining
that the world doesn't make sense


07-24-2007 03:17 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: global variable not working
quote:
Originally posted by scutterman
The code looks good but as I said I'm new so I would be realy grateful if someone could talk me through it.

P.S. why are there 3 "=" signs in this part:
if (aSent[ChatWnd.Handle] === Message) {

Thanks alot
~~Scutterman~~

It is a Bitwise comparison. Meaning each byte has to match. if (2 == '2') (will return true) 2=== '2' will return false
07-24-2007 03:55 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« 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