What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Need Help with my First Script

Pages: (2): « First [ 1 ] 2 » Last »
Need Help with my First Script
Author: Message:
SamV522
New Member
*


Posts: 10
Joined: Nov 2009
O.P. Need Help with my First Script
Okay, so this is my first time creating a Messenger Plus! script though I do have quite a bit of a programming/scripting background.

Anyway, I'm trying to write an AI, or more so an autoresponder that uses an xml list of responses for personal use and I've got it just about all set up, I just need to add a few things here and there.

The problem is, when I log into MSN, MSN crashes... I'm not sure what I've done wrong, but I think it's "ActiveXObject("Microsoft.XMLDOM")" on line 8.  Though I'm not sure what to replace this with, can anyone help me with this?
Here is the full source: http://msnplus.pastebin.com/ma78e704
11-24-2009 04:54 PM
Profile E-Mail PM Find Quote Report
SourSpud
Junior Member
**

Avatar
spud, spud, spud, spoon.

Posts: 58
35 / Male / Flag
Joined: Nov 2009
RE: Need Help with my First Script
I'm still learning myself but why do you have an empty function?

jscript code:
function OnEvent_Uninitialize(MessengerExit)
{
}

also try signing in as 'away' see if it still crashes.

This post was edited on 11-24-2009 at 05:00 PM by SourSpud.
11-24-2009 04:58 PM
Profile E-Mail PM Find Quote Report
SamV522
New Member
*


Posts: 10
Joined: Nov 2009
O.P. RE: Need Help with my First Script
It was put there by default when I started a new script.  I hadn't gotten around to deleteing it yet, I was searching for a way to fix my problem.
11-24-2009 05:00 PM
Profile E-Mail PM Find Quote Report
SourSpud
Junior Member
**

Avatar
spud, spud, spud, spoon.

Posts: 58
35 / Male / Flag
Joined: Nov 2009
RE: Need Help with my First Script
try signing in as Away still if msn still crashes.
11-24-2009 05:02 PM
Profile E-Mail PM Find Quote Report
SamV522
New Member
*


Posts: 10
Joined: Nov 2009
O.P. RE: Need Help with my First Script
It's not crashing when I sign in anymore, but it's crashing whenever I recieve a message that needs to be responded to.
11-24-2009 05:12 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Need Help with my First Script
I don't have much time to debug it, but here are a few things which I can say about good practice:

1) Your status doesn't have anything to do with it.

2) Don't use the OnEvent_Initialize() function to read in the XML. As you can read in the scripting documentation, the OnEvent_Initialize() function should return as quickly as possible and is not a good place to do process intensive tasks.

Instead use the OnEvent_SigninReady() function to do that. It also makes more sense because if you are never going to sign in, it is useless to read in the XML and set things up.

3) Before using ChatWnd.SendMessage you should always check if you can actually send a message by using ChatWnd::EditChangeAllowed. Again, see official scripting documentation.

Now, the above pointers don't realy fix anything. But they will prevent possible problems in the long run.

4) There is probably something wrong with the ActiveX object you use. Try to get some documentation about it and study it carefully.

This post was edited on 11-24-2009 at 05:18 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
11-24-2009 05:14 PM
Profile PM Find Quote Report
SamV522
New Member
*


Posts: 10
Joined: Nov 2009
O.P. RE: Need Help with my First Script
Okay, I did what you said CookieRevised, and it seem's to be working ok now.  I just need to get the responses working now.

Thanks for all your help! :)
11-24-2009 05:43 PM
Profile E-Mail PM Find Quote Report
SamV522
New Member
*


Posts: 10
Joined: Nov 2009
O.P. RE: Need Help with my First Script
Ok. So I've tried quite a few different things with sending a response, but it crashes whenever I try and send a message...
What am I doing wrong?
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Origin, Message, MessageKind){
    if (Message.substr(0,6).toLowerCase() == "/AwayI"){
        var param = Message.substr(7);
        switch(param){
            case "enable":
                AI.State = true;
                break;
            case "disable":
                AI.State = false;
                break;
            case "commands":
                alert("Enable\nDisable\nCommands");
                break;
            /*default:
                alert("Invalid Command! Type \"/AwayI Commands\" to see a list of valid commands");
                break;
                */
        }
    }
}

11-24-2009 06:10 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Need Help with my First Script
Alert cannot be used the scripting engine.
11-24-2009 06:20 PM
Profile E-Mail PM Find Quote Report
SamV522
New Member
*


Posts: 10
Joined: Nov 2009
O.P. RE: Need Help with my First Script
Is that the only thing?

Edit:
I guess not because it's still crashing.

This post was edited on 11-24-2009 at 06:26 PM by SamV522.
11-24-2009 06:24 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