This isn't actually that simple;
What about when there is multiple conversations? You would need some way of working out which conversation to send the correct smarterchild response back to.
I'll help with the receiving a message and then sending it to smarterchild part. But you or someone else will have to think of a way to code the sending the replys back part.
I'll write some code and an explanation for it, and put it in this post when I'm done
EDIT:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind)
{
var Contacts = Messenger.MyContacts;
var sc = Contacts.GetContact('smarterchild@hotmail.com');
if (Origin == sc.Name)
{
break;
}
if(MessageKind == 1)
{
var window = Messenger.OpenChat('smarterchild@hotmail.com');
window.SendMessage(Message);
}
}
}
Okay and now for the explanation:
code:
var Contacts = Messenger.MyContacts;
var sc = Contacts.GetContact('smarterchild@hotmail.com');
if (Origin == sc.Name)
{
break;
}
1)We get the contact list using
Messenger.MyContacts and store it in a variable called
Contacts
2)Then we find smarterchild in this list and store it in
sc
3)The if statement gets smarterchilds name from the
sc we stored earlier and checks that the message wasn't from smarterchild. If it is we use break, which ends the currently running function. Therefore no more code is run and the message isn't sent.
code:
if(MessageKind == 1)
{
var window = Messenger.OpenChat('smarterchild@hotmail.com');
window.SendMessage(Message);
}
1) MessageKind equals
1 when the message that has been recieved is text. Others can be winks, voice clips, searches etc... We won't be able to send those onto smarterchild so we simply ignore them by only accepting text messages by making sure
MessageKind is
1.
2)We open a window with smarterchild and store it in
window. If there is already a conversation open with smarterchild then the already open one is stored in
window
3)Then we simply use
window to send the message that we recieved.