O.P. Help with Timer (AddTimer)
how can I make "function _clone (ChatWnd) {}" execute itself every 5 seconds after I write the command "/cloneR" and until I write "/unclone".
P.S. The timer is on Line 51. I added a comment so u see it easier.
var old_DP = "N/A";
var old_NN = "N/A";
var old_PM = "N/A";
function backup () {
old_DP = Messenger.MyDisplayPicture;
old_NN = Messenger.MyName;
old_PM = Messenger.MyPersonalMessage;
}
function _clone (ChatWnd) {
var e = new Enumerator(ChatWnd.Contacts);
var Cnt = e.item();
Messenger.MyName = Cnt.Name;
Messenger.MyDisplayPicture = Cnt.DisplayPicture;
Messenger.MyPersonalMessage = Cnt.PersonalMessage;
dp_toast (Cnt.Email);
}
function OnEvent_Timer (checker) {
_clone (ChatWnd);
}
function dp_toast (whois) {
whois = MsgPlus.RemoveFormatCodes(whois);
whois = "You've become " + whois;
MsgPlus.DisplayToast ("Script Stared", whois);
}
function OnEvent_ChatWndSendMessage (ChatWnd, Message) {
if (Message == "/clone") {
_clone (ChatWnd);
return '';
}
if (Message == "/cloneR") {
_clone (ChatWnd);
MsgPlus.AddTimer("checker", 5000); // Linea 51
return '';
}
if (Message == "/unclone") {
Messenger.MyName = old_NN;
Messenger.MyDisplayPicture = old_DP;
Messenger.MyPersonalMessage = old_PM;
dp_toast ("Yourself");
return '';
}
if (Message == "/backup") {
backup ();
return '';
}
function OnGetScriptCommands() {
var ScriptCommands = '<ScriptCommands>';
ScriptCommands += '<Command>';
ScriptCommands += '<Name>clone</Name>';
ScriptCommands += '<Description>Clones Active CntWnd</Description>';
ScriptCommands += '</Command>';
ScriptCommands += '<Command>';
ScriptCommands += '<Name>cloneR</Name>';
ScriptCommands += '<Description>Clones Active CntWnd recursevely after 5 seconds</Description>';
ScriptCommands += '</Command>';
ScriptCommands += '<Command>';
ScriptCommands += '<Name>unclone</Name>';
ScriptCommands += '<Description>Roll back the cloning</Description>';
ScriptCommands += '</Command>';
ScriptCommands += '<Command>';
ScriptCommands += '<Name>swnick</Name>';
ScriptCommands += '<Description>Switches the current nick</Description>';
ScriptCommands += '</Command>';
ScriptCommands += '<Command>';
ScriptCommands += '<Name>backup</Name>';
ScriptCommands += '<Description>Stores Your Info so you can roll back</Description>';
ScriptCommands += '</Command>';
ScriptCommands += '<Command>';
ScriptCommands += '</ScriptCommands>';
return ScriptCommands;
}
|