Shoutbox

[HELP]Auto respond on a specific message - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [HELP]Auto respond on a specific message (/showthread.php?tid=86723)

[HELP]Auto respond on a specific message by Jonte135 on 10-18-2008 at 07:41 PM

Well I'm going to try to make my first ever script, which will be an easy bot that I will upgrade more and more the more I learn. So what I want now is a code that "searches" through the message that someone gives me and look for a word like "hello". If it matches "hello" then it will reply randomly messages that I have in a file and the messages will simply be separated with enter. Also the thing it will search for will also be in a file that is separated with enter.

It should be fairly easy for experienced coders, but I don't know much about coding in MSN+ so ya thanks :P

EDIT: My friend forced me to post this, he made it for me, perhaps it can help :)

code:
int curWord = 0;

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
    if(Origin != Messenger.MyName) {
    var parts = sMessage.split(" ");
        while(1) {
        if(parts[curWord] == "hello" || parts[curWord] == "Hello" parts[curWord] == "HELLO") {
            ChatWnd.SendMessage("Hello.");
            break;
        }
        if(parts[curWord] == NULL) {
            break;
        }
        if(curWord >= 200) {
            break;
        }
        curWord += 1;
    }
    }
}

RE: [HELP]Auto respond on a specific message by prashker on 10-18-2008 at 08:01 PM

This does what you want, maybe you can learn from it?

http://www.msgpluslive.net/scripts/view/119-Answering-Machine-Plus/


RE: RE: [HELP]Auto respond on a specific message by Jonte135 on 10-18-2008 at 08:32 PM

quote:
Originally posted by SonicSam
This does what you want, maybe you can learn from it?

http://www.msgpluslive.net/scripts/view/119-Answering-Machine-Plus/
Thanks for your help, unfortunately it seems too be a little to complicated for me at the moment :(
RE: [HELP]Auto respond on a specific message by SmokingCookie on 10-20-2008 at 08:41 AM

quote:
Originally posted by Jonte135

code:
int curWord = 0;



Well, you're doing it a little bit complicated.

If you're planning to use "int" for integer numbers, "float" for floating point numbers, and so on, you'll have to either look at some reference for a thousand times, or "study" all those data types and their keyword (e.g. "int" for integer).

What's easier to use, is the "var" keyword. You can use it for most (if not all) data types:

code:
var VariableNumberOne = "Hello there"; // String
var ThisOnesUndefined; // do not use the "assign" ( "=" ) operator
var ThirdOne = 9999; // Number
var FourthIsFloat = 1.01; // also a Number
var myObject = new Object(); // don't bother yet

var Nothing = null; // never mind either


RE: RE: [HELP]Auto respond on a specific message by Jonte135 on 10-20-2008 at 06:09 PM

quote:
Originally posted by SmokingCookie
quote:
Originally posted by Jonte135

code:
int curWord = 0;



Well, you're doing it a little bit complicated.

If you're planning to use "int" for integer numbers, "float" for floating point numbers, and so on, you'll have to either look at some reference for a thousand times, or "study" all those data types and their keyword (e.g. "int" for integer).

What's easier to use, is the "var" keyword. You can use it for most (if not all) data types:

code:
var VariableNumberOne = "Hello there"; // String
var ThisOnesUndefined; // do not use the "assign" ( "=" ) operator
var ThirdOne = 9999; // Number
var FourthIsFloat = 1.01; // also a Number
var myObject = new Object(); // don't bother yet

var Nothing = null; // never mind either


Ya that guy that made the script for me changed it just after I posted it :D