Forget about events and stuff, just as in VB6, in the scripts the events are triggered automatically. Everything is done right inside the scripts. All you need to do is make some functions to handle your text.
Read and study the
scripting documentation, examples are shown there.
Also, you can find examples in the
scripting database.
eg: Some basic JScript code you need:
code:
function OnEvent_SigninReady(sEmail) {
var oMyBot = new ActiveXObject('Your.ActiveX');
}
function OnEvent_ChatWndReceiveMessage(pChatWnd, sOrigin, sMessage, nMessageKind) {
Debug.Trace('Chat window: ' + pChatWnd);
Debug.Trace('Contact name: ' + sOrigin);
Debug.Trace('Message recieved: ' + sMessage);
Debug.Trace('Message type: ' + nMessageKind);
if (sOrigin != Messenger.MyName) {
var ReplyMessage = oMyBot.ProcedureToHandleText(sMessage);
pChatWnd.SendMessage(ReplyMessage);
}
}
and in your VB6 code all you need is the procedure "ProcedureToHandleText" inside a public class module to handle the text and which will return a string to send back to the convo.
And as you can see, it is actually quite easy to replace
code:
var ReplyMessage = oMyBot.ProcedureToHandleText(sMessage);
with your text manipulating routines in JScript itself. You don't need VB6 at all. JScript isn't that hard...