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

Help With Scripting Please!
Author: Message:
Malekith
Junior Member
**


Posts: 30
– / Male / Flag
Joined: Feb 2007
O.P. Help With Scripting Please!
I need some help with some scripting, before i explain heres part of my code:

code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, Type) {
    var Contacts = ChatWnd.Contacts;
    var e = new Enumerator(Contacts);
    var Contact = e.item();

    var command = Message.substr(0,7);
    var strMessage = Message.substr(8);
   
    if (ChatOpen != true) {
        if (command == "!secure") {
            var ContactEmail = Contact.Email;
            var Wnd = MsgPlus.CreateWnd("Interface.xml", "WndMain");
            var ChatWindowID = ChatWnd;
            Wnd.SetControlText("lblChatting",ContactEmail)
            ChatOpen = true;
        }
    }
   
    if (Contact.Email != Messenger.MyEmail) {
        var strCurrentChat = Wnd.GetControlText("txtChat");
        Wnd.SetControlText("txtChat","<" + Contact.Email + "> " + Message + "\r\n");
    }
   
    return Message;
}

What i want to do is make Wnd a constant/global variable so i can always access it because i need to keep using it everytime a message is recieved. So what im asking is if there is a way to make global variables OR if i can iterate through the windows and find the one with the id of WndMain. I really need help with this, thanks.

/-- Malekith
02-02-2007 12:49 AM
Profile E-Mail PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: Help With Scripting Please!
just make a global variable, not hard!

put the variable Wnd outsite of the function and its global.
[quote]
Ultimatess6
: What a noob mod
02-02-2007 12:51 AM
Profile PM Web Find Quote Report
Malekith
Junior Member
**


Posts: 30
– / Male / Flag
Joined: Feb 2007
O.P. RE: Help With Scripting Please!
Sorry, i havtn done any coding in a while? so if i do var Wnd; outside the function and then just do Wnd = XXX; inside the function, it should make it global?
02-02-2007 12:57 AM
Profile E-Mail PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: Help With Scripting Please!
quote:
Originally posted by Malekith
Sorry, i havtn done any coding in a while? so if i do var Wnd; outside the function and then just do Wnd = XXX; inside the function, it should make it global?
yeah, just move var Wnd thts all then you can treat it as if it were a local one. (except for when you close it)
[quote]
Ultimatess6
: What a noob mod
02-02-2007 12:59 AM
Profile PM Web Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: Help With Scripting Please!
yes thats how you make a global variable also if you do this:

code:
function ... {
//stuff
Wnd = "123";
//stuff
}
that makes a global variable as well ;)

This post was edited on 02-02-2007 at 01:01 AM by NanaFreak.
02-02-2007 01:00 AM
Profile PM Find Quote Report
Malekith
Junior Member
**


Posts: 30
– / Male / Flag
Joined: Feb 2007
O.P. RE: Help With Scripting Please!
Sorry, for my noobness :(
02-02-2007 01:07 AM
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