mIRC Homepage
Posted By: SkyD REMOVE nick - 25/06/05 08:35 AM
Hi.. I have a problem..
If nick writes !delete_me bot write his nick in delete_nicks.txt
I need that the bot remove his nick after week at the time when his nick was writed in..

PLEASE, HELP!!
Posted By: DaveC Re: REMOVE nick - 25/06/05 09:47 AM
Question.

(1) can delete_nicks.txt have any other info in it besides just the nickname?
can it be
BOOB 1119692563
BILL 1119692234
FRED 1119645663

the number is $ctime of when they werr added, this way if the bot goes down between adding and removing it can resume the timers on the nicks to be removed.

(2) Does the removing of the nicks have to be exactly correct, ie : added to file at 18th 12:34:56 removed from file at 25th 12:34:56
OR is a removal every 5 minutes of anyone ready to be removed ok?
Posted By: SkyD Re: REMOVE nick - 25/06/05 10:08 AM
in delete_nicks.txt i have that:
BOOB 20.06.2005 9:11
BILL 22.06.2005 11:22
FRED 21.06.2005 10:22

and i need that the bot deletes them afer week.. FOR EXAMPLE:
BOOB 27.06.2005 9:11
BILL 29.06.2005 11:22
FRED 28.06.2005 10:22

Can you help me??
Posted By: SkyD Re: REMOVE nick - 25/06/05 01:57 PM
Help please..!!
Posted By: tidy_trax Re: REMOVE nick - 25/06/05 02:12 PM
Please don't bump threads, it's annoying and it won't get you help any faster.

Try this:

Code:
alias addnick { write delete_nicks.txt $1 }
alias remnick { write -dw $+ $1 delete_nicks.txt }
on *:text:!delete_me:#:{
  addnick $nick
  .timer 1 604800 remnick $nick
}
Posted By: DaveC Re: REMOVE nick - 26/06/05 01:01 AM
I just added to Tidy_Trax's code, to include the delete request date as you speced,
and a ON START, in case the bot shut down, it well sweep the file for any to remove or any to setup timers for to remove.


Code:
alias addnick { write delete_nicks.txt $1 $asctime(dd.mm.yyyy H:nn) }
alias remnick { write -dw" $+ $1 *" delete_nicks.txt }
;
on *:text:!delete_me:#:{
  addnick $nick
  .timer 1 604800 remnick $nick
}
;
on *:start:{
  var %i = $lines(delete_nicks.txt)
  while (%i) {
    var %line = $read(delete_nicks.txt,nt,%i)
    var %nick = $gettok(%line,1,32)
    var %ctime = $calc($ctime($gettok(%line,2-,32)) + 604800
    if (%ctime <= $ctime) { remnick %nick }
    else { .timer 1 $calc(%ctime - $ctime) remnick %nick }
    dec %i
  }
}
Posted By: Sleepyfreak Re: REMOVE nick - 26/06/05 04:21 AM
nice DaveC do you reckon you can take a look at my little problem called lanuage :P
Posted By: SkyD Re: REMOVE nick - 26/06/05 09:14 AM
Thanx DaveC.. but i have one more problem.. My bot doesn't work every day and every night. I quit from chat at night and come back at morning.. And timer doesn't work it is stoped.. Is the way if i come back in chat the timer will continue count the time ???
Posted By: DaveC Re: REMOVE nick - 26/06/05 12:14 PM
That is exactly what the code i wrote is for, if you restart mirc it well restart all the timers (well it actually remakes them all)
Posted By: SkyD Re: REMOVE nick - 26/06/05 02:05 PM
I know it is possible to set the time when timer do something.. EXAMPLE: /timer 12:00 1 2 /msg $chan bla bla.. If it's possible to set the date and time ???
Posted By: RusselB Re: REMOVE nick - 26/06/05 04:11 PM
If it is possible, then I haven't been able to figure out how. Sorry.
Posted By: DaveC Re: REMOVE nick - 26/06/05 10:54 PM
its not
Posted By: Kelder Re: REMOVE nick - 28/06/05 10:47 PM
You can only supply time in hours/minutes in the timer.
You can however do something like this, scripting the date check yourself:

alias timedstuff {
if ($date(yyyymmdd) !isnum 20050630) {
; below test only to not have the timer activated if the date has already passed
if ($v1 > $v2) return
.timer 1 120 .timer $time(HH:nn) 1 1 timedstuff
return
}
;do your stuff
}

Yes, there's 2 timers in there, otherwise you'll be setting a timer every 1 or 2 seconds until it's one minute later.
© mIRC Discussion Forums