Hi makeshift, it's good to hear that people are genuinely interested in
learning how to script something from start to finish.
For a really simple script which does this you first need to use the
OnEvent_ChatWndReceiveMessage event which is documented in the
Scripts Documentation. This "event is fired when a new message is received in a chat window" and provides you with among a variety of other things (see scripting docs), the message which was received:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
//Firstly, this event function is triggered when any message is added to the conversation including ones which we send to others, so we need to make sure that the person who sent this message wasn't us (note that Origin is one of the parameters which was passed to this function and contains the Nickname of the contact which sent the message)
if(Origin != Messenger.MyName) {
//The person who sent the message wasn't me, now you need to check if the message is the message which we are looking for
if(Message == "How are you?") {
//The contact has typed the message we're looking for so we need to reply!
ChatWnd.SendMessage("Alright, you?");
}
}
}