I've just started working on an "Instant Response" script, that can send a message or a /command after someone says something to you. But I have a few problems since I am
very new to this:
1) I don't know how to make an enable/disable option (for chat windows and the contact list) in the script option menu.
2) I don't know how to make an options screen, to change the delay and message, either!
If anyone can give me the basic code for it, I would really appreciate it.
I have attached the script file in the message below, and as an attachment (in script format - ".js").
jscript code:
var SettingMessage;
var SettingTimer;
function OnEvent_Initialize(MessengerStart)
{
SettingMessage = "/nudge";
SettingTimer = 100;
}
function OnEvent_Timer(TimerID)
{
Debug.Trace("Timer launched");
Messenger.OpenChat(TimerID).SendMessage(SettingMessage);
}
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
if (Origin != Messenger.MyName) {
Debug.Trace("Message received");
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts);
for(; !e.atEnd(); e.moveNext()) {
var Contact = e.item();
Debug.Trace(" " + Contact.Email);
}
if (Message != SettingMessage)
{
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts);
var NoContacts = 0;
for(; !e.atEnd(); e.moveNext()) {
var Contact = e.item();
Debug.Trace(" " + Contact.Email);
NoContacts = NoContacts + 1;
}
Debug.Trace(NoContacts);
if (NoContacts == 1) {
MsgPlus.AddTimer(Contact.Email, SettingTimer);
Debug.Trace("Timer started");
}
}
}
}