I might be able to do that, but it's ben a busy day so..
might take a while
[offtopic] Thx
[/offtpoic]
EDIT:: Okay, I've got it, but the message must not end with a dot (.)
jscript code:
var FileSys = new ActiveXObject("Scripting.FileSystemObject");
var BasePath = MsgPlus.ScriptFilesPath + "\\"; // I like when stuff ends with a backslash
var TXTNAME = ""; // store for later use
function OnEvent_Initialize(bMsgStart) {
if(!bMsgStart) {
TXTNAME = BasePath + "text.txt";
}
}
function OnEvent_ChatWndReceiveMessage(objChatWnd,strOrigin,strMessage,intMsgKind) {
if(strOrigin != Messenger.MyName) {
var objTextFile, strAllText, arrMessages; // variables for later usage
if(!FileSys.FileExists(TXTNAME)) {
objTextFile = FileSys.CreateTextFile(TXTNAME,false /* don't overwrite */,true /* Save as Unicode */ ); // If it doesn't exist, save empty file
} else {;
objTextFile = FileSys.OpenTextFile(TXTNAME,1 /* read */); // if it does exists, open
}
strAllText = objTextFile.ReadAll(); // read contents
objTextFile.Close(); // close file
arrMessages = strAllText.split("\r\n"); // get the array of newline characters
var Pattern; // declare a variable
var Words = strMessage.split(" ");
for(var i = 0 /* declare a variable */ ; i < arrMessages.length /* make sure it's not beyond the end of the array */ ; i++ /* and increment it by 1 */ ) {
Pattern = new RegExp(arrMessages[i],"gim"); // Global, (case) Insensitive, Multiline
var Chunk = strMessage.substr(0,arrMessages[i].length); // Get the first chunk of text
// var Chunk = Words[0]; // Get the first word
if(Chunk.toLowerCase() == arrMessages[i].toLowerCase()) { /* is the beginning of the message arrMessages[i]? */
objChatWnd.SendMessage(arrMessages[Math.round(Math.random()%(arrMessages.length - 1 /* devide by number of lines */) )]);
return strMessage; // suspend execution
}
}
return strMessage; // suspend execution
}
}