Shoutbox

[Request]: Send message on conversation start, repeat message on timer. - 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: [Request]: Send message on conversation start, repeat message on timer. (/showthread.php?tid=81668)

[Request]: Send message on conversation start, repeat message on timer. by Eiron on 02-14-2008 at 07:37 PM

Right. Normally I don't like to ask, but I've tried a search without luck. There are several features I use in Live Plus! but I want:

1) a script (a /command) to be started automatically on opening a conversation window, and/or
2) a message to be on an automatic repeat timer - so every half-hour or whatever I can run the same command without having to type it in.

Anything exist for these two little needs?


RE: [Request]: Send message on conversation start, repeat message on timer. by roflmao456 on 02-18-2008 at 08:29 AM

try this out:

code:
var cmd = "/some command"; // your own command here (with slash)
var cwnd;
var delay = 60; // delay when to repeat message (in seconds)
function OnEvent_ChatWndCreated(ChatWnd){
ChatWnd.SendMessage(cmd);
cwnd = ChatWnd;
MsgPlus.CancelTimer("sendmsg");
MsgPlus.AddTimer("sendmsg", parseInt(delay) * 1000);
}

function OnEvent_Timer(i){
if(i == "sendmsg"){
cwnd.SendMessage(cmd);
}
}


RE: [Request]: Send message on conversation start, repeat message on timer. by matty on 02-18-2008 at 02:22 PM

Probably better like this:

code:
var objChatWnd = {};
var sCommand = '/somecommand';
var iDelayInMinutes = 2;

function OnEvent_ChatWndCreated(oChatWnd){
    objChatWnd[oChatWnd.Handle] = {};
    objChatWnd[oChatWnd.Handle].oChatWnd = oChatWnd;
    oChatWnd.SendMessage = sCommand;
    MsgPlus.AddTimer(oChatWnd.Handle, iDelayInMinutes*60000);
}

function OnEvent_ChatWndDestroyed(oChatWnd) {
    delete objChatWnd[oChatWnd.Handle];
    MsgPlus.CancelTimer(oChatWnd.Handle);
}

function OnEvent_Timer(iHandle) {
    objChatWnd[iHandle].oChatWnd.SendMessage(sCommand);
    MsgPlus.AddTimer(iHandle, iDelayInMinutes*60000);   
}