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

Help with code
Author: Message:
Jonte135
Junior Member
**


Posts: 57
– / – / Flag
Joined: Aug 2007
O.P. Help with code
Me, with help of my friend, made this code (mainly my friend :P) and I want it to react on words that I have in a file. The problem is that it responds to anything now. In the file I have:
quote:
hi
hello
hey
howdy

My friend also told me that I should but the code in functions, I know what functions are and how they work but I don't really understand how I should do it. Help please? :D

JScript code:
var curWord = 0;
 
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
    if(Origin != Messenger.MyName) {
    var parts = Message.split(" ");
    curWord = 0;
        while(1) {
       
         var ofr, ofr1, ofr2, a1, f1, txt; //ofr = open file read
            var ForReading = 1;
            ofr = new ActiveXObject("Scripting.FileSystemObject");
            ofr1 = ofr.OpenTextFile("C:\\Program\\Messenger Plus! Live\\Scripts\\B.O.T._ Being Optimized for Troubleshooting\\text.txt",ForReading);
            ofr2 = ofr1.ReadAll();
            ofr1.Close();
            var i;
            var Message = " ";
            while (i<10) {
        Message = ofr2.split("\r\n");
            }
        if(parts[curWord] == Message[i]){
     
        var ofa, ofa1, ofa2, a1, f1, txt; //ofa = open file answer
            var ForReading = 1;
            ofa = new ActiveXObject("Scripting.FileSystemObject");
            ofa1 = ofa.OpenTextFile("C:\\Program\\Messenger Plus! Live\\Scripts\\B.O.T._ Being Optimized for Troubleshooting\\text.txt",ForReading);
            ofa2 = ofa1.ReadAll();
            ofa1.Close();
           
            var sendMessage = " ";
        sendMessage = ofa2.split("\r\n");
           ChatWnd.SendMessage(sendMessage[Math.round(Math.random()%4)]);
        ofa2 = 0;
            break;
        }
       
        if(curWord == 150) {
            break;
        }
        curWord += 1;
    }
    }
} //function OnEvent

11-04-2008 07:38 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Help with code - by Jonte135 on 11-04-2008 at 07:38 PM
RE: Help with code - by SmokingCookie on 11-04-2008 at 07:43 PM
RE: Help with code - by Jonte135 on 11-05-2008 at 06:33 PM
RE: Help with code - by SmokingCookie on 11-05-2008 at 06:50 PM
RE: Help with code - by roflmao456 on 11-05-2008 at 06:57 PM
RE: Help with code - by Jonte135 on 11-05-2008 at 07:00 PM
RE: Help with code - by SmokingCookie on 11-05-2008 at 07:30 PM
RE: Help with code - by Jonte135 on 11-06-2008 at 07:20 PM
RE: Help with code - by SmokingCookie on 11-06-2008 at 07:42 PM
RE: Help with code - by Jonte135 on 11-06-2008 at 07:49 PM
RE: Help with code - by SmokingCookie on 11-06-2008 at 08:16 PM
RE: Help with code - by Jonte135 on 11-06-2008 at 08:53 PM
RE: Help with code - by SmokingCookie on 11-06-2008 at 08:59 PM
RE: Help with code - by Jonte135 on 11-06-2008 at 09:02 PM
RE: Help with code - by Jonte135 on 11-07-2008 at 04:04 PM
RE: Help with code - by SmokingCookie on 11-07-2008 at 05:27 PM
RE: RE: Help with code - by Jonte135 on 11-07-2008 at 11:53 PM
RE: Help with code - by matty on 11-07-2008 at 06:52 PM
RE: Help with code - by SmokingCookie on 11-08-2008 at 02:40 PM
RE: Help with code - by Jonte135 on 11-08-2008 at 07:30 PM
RE: Help with code - by SmokingCookie on 11-08-2008 at 07:51 PM
RE: Help with code - by Jonte135 on 11-08-2008 at 07:56 PM
RE: Help with code - by SmokingCookie on 11-08-2008 at 07:58 PM
RE: Help with code - by Jonte135 on 11-08-2008 at 08:03 PM
RE: Help with code - by SmokingCookie on 11-08-2008 at 08:07 PM
RE: Help with code - by Jonte135 on 11-08-2008 at 08:14 PM
RE: Help with code - by SmokingCookie on 11-08-2008 at 08:15 PM
RE: Help with code - by Jonte135 on 11-08-2008 at 08:18 PM
RE: Help with code - by SmokingCookie on 11-08-2008 at 08:35 PM
RE: RE: Help with code - by Jonte135 on 11-08-2008 at 09:10 PM
RE: Help with code - by SmokingCookie on 11-08-2008 at 09:13 PM
RE: RE: Help with code - by Jonte135 on 11-08-2008 at 09:15 PM
RE: Help with code - by Jonte135 on 11-16-2008 at 06:41 PM
RE: Help with code - by SmokingCookie on 11-23-2008 at 10:14 AM
RE: RE: Help with code - by Jonte135 on 11-23-2008 at 11:21 AM


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