What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Answering code (kinda, I suck at titles)

Answering code (kinda, I suck at titles)
Author: Message:
Jonte135
Junior Member
**


Posts: 57
– / – / Flag
Joined: Aug 2007
O.P. Answering code (kinda, I suck at titles)
I'm pretty new to this kind of coding, but could someone explain to me why this won't work:

JScript code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
 
//local variables
var sDetector = " ", sResponse = " ";  /* sDetector is words to detect, sResponse is words to respond with */
var ofr, ofr1, ofr2, ForReading = 1;  /* For reading from file */
 
ofr = new ActiveXObject("Scripting.FileSystemObject");
ofr1 = ofr.OpenTextFile("C:\\Program\\Messenger Plus! Live\\Scripts\\B.O.T._ Being Optimized for Troubleshooting\\text.txt", ForReading); /* Open file "Detecting Words.txt" */
ofr2 = ofr1.ReadAll();  /* Read all file contents */
ofr1.Close();  /* Close the file */
sDetector = ofr2.split("\r\n"); /* Set sDetector to every word, separated by /r/n */
ofr1 = ofr.OpenTextFile("C:\\Program\\Messenger Plus! Live\\Scripts\\B.O.T._ Being Optimized for Troubleshooting\\text.txt", ForReading); /* Open file "Responding Words.txt" */
ofr2 = ofr1.ReadAll(); /* Read all file contents */
ofr1.Close(); /* Close the file */
sResponse = ofr2.split("\r\n"); /* Set sResponse to every word, separated by \r\n */
 
/* 2 */
var sDetector2 = " ", sResponse2 = " ";  /* sDetector is words to detect, sResponse is words to respond with */
var ofr2, ofr12, ofr22, ForReading2 = 1;  /* For reading from file */
 
ofr2 = new ActiveXObject("Scripting.FileSystemObject");
ofr12 = ofr2.OpenTextFile("C:\\Program\\Messenger Plus! Live\\Scripts\\B.O.T._ Being Optimized for Troubleshooting\\moretext.txt", ForReading); /* Open file "Detecting Words.txt" */
ofr22 = ofr12.ReadAll();  /* Read all file contents */
ofr12.Close();  /* Close the file */
sDetector2 = ofr22.split("\r\n"); /* Set sDetector to every word, separated by /r/n */
ofr12 = ofr2.OpenTextFile("C:\\Program\\Messenger Plus! Live\\Scripts\\B.O.T._ Being Optimized for Troubleshooting\\moretext.txt", ForReading); /* Open file "Responding Words.txt" */
ofr22 = ofr12.ReadAll(); /* Read all file contents */
ofr12.Close(); /* Close the file */
sResponse = ofr2.split("\r\n"); /* Set sResponse to every word, separated by \r\n */
   
    /* Respons */
var iCountUp = 0, iCountUpToo = 0;
    if (Origin != Messenger.MyName) {
        var sParts = Message.split(" ");
        while(1) {
            if (iCountUp == 10) {
                break;
            }
            while(1) {
                if (iCountUpToo == 10) {
                    break;
                }
                if (sParts[iCountUp] == sDetector[iCountUpToo] && sParts[iCountUp] == sDetector2[iCountUpToo]) {
                    ChatWnd.SendMessage(sResponse[Math.round(Math.random()%4)]);
                }
                iCountUpToo += 1;
            }
            iCountUp += 1;
        }
    }
 
 

What's I'm/the code is trying to do is that it will first identify a word from a file and see if that's the same as someone sends. If so it will reply. I tried to do so it would reply only if there were two words. Like instead of just "hello" it will reply on "hello mate" etc.

Thank you :)
12-09-2008 08:41 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Answering code (kinda, I suck at titles) - by Jonte135 on 12-09-2008 at 08:41 PM
RE: Answering code (kinda, I suck at titles) - by matty on 12-09-2008 at 09:08 PM
RE: Answering code (kinda, I suck at titles) - by Jonte135 on 12-10-2008 at 07:51 PM
RE: Answering code (kinda, I suck at titles) - by matty on 12-10-2008 at 08:03 PM
RE: Answering code (kinda, I suck at titles) - by Jonte135 on 12-10-2008 at 08:10 PM
RE: Answering code (kinda, I suck at titles) - by roflmao456 on 12-10-2008 at 09:25 PM
RE: Answering code (kinda, I suck at titles) - by Jonte135 on 12-11-2008 at 08:48 PM
RE: Answering code (kinda, I suck at titles) - by matty on 12-12-2008 at 12:41 AM
RE: Answering code (kinda, I suck at titles) - by Jonte135 on 12-13-2008 at 09:41 AM
RE: Answering code (kinda, I suck at titles) - by Jonte135 on 12-19-2008 at 04:13 PM
RE: Answering code (kinda, I suck at titles) - by vaccination on 12-19-2008 at 04:42 PM
RE: Answering code (kinda, I suck at titles) - by matty on 12-19-2008 at 05:07 PM


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