mIRC Home    About    Download    Register    News    Help

Topic Options
#123602 - 25/06/05 09:35 AM REMOVE nick
SkyD Offline
Babel fish

Registered: 04/02/05
Posts: 74
Loc: Latvia
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!!
_________________________
[color:red]m[color:blue]IRC[color:green] for EvEr


Top
#123603 - 25/06/05 10:47 AM Re: REMOVE nick
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
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?

Top
#123604 - 25/06/05 11:08 AM Re: REMOVE nick
SkyD Offline
Babel fish

Registered: 04/02/05
Posts: 74
Loc: Latvia
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??
_________________________
[color:red]m[color:blue]IRC[color:green] for EvEr


Top
#123605 - 25/06/05 02:57 PM Re: REMOVE nick
SkyD Offline
Babel fish

Registered: 04/02/05
Posts: 74
Loc: Latvia
Help please..!!
_________________________
[color:red]m[color:blue]IRC[color:green] for EvEr


Top
#123606 - 25/06/05 03:12 PM Re: REMOVE nick
tidy_trax Offline
Hoopy frood

Registered: 02/11/03
Posts: 2327
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
}
_________________________
New username: hixxy

Top
#123607 - 26/06/05 02:01 AM Re: REMOVE nick
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
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
  }
}

Top
#123608 - 26/06/05 05:21 AM Re: REMOVE nick
Sleepyfreak Offline
Vogon poet

Registered: 16/05/05
Posts: 106
Loc: Adelaide
nice DaveC do you reckon you can take a look at my little problem called lanuage :P


Edited by Sleepyfreak (26/06/05 05:23 AM)
_________________________
and thats the way the scout leader burns

Top
#123609 - 26/06/05 10:14 AM Re: REMOVE nick
SkyD Offline
Babel fish

Registered: 04/02/05
Posts: 74
Loc: Latvia
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 ???
_________________________
[color:red]m[color:blue]IRC[color:green] for EvEr


Top
#123610 - 26/06/05 01:14 PM Re: REMOVE nick
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
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)

Top
#123611 - 26/06/05 03:05 PM Re: REMOVE nick
SkyD Offline
Babel fish

Registered: 04/02/05
Posts: 74
Loc: Latvia
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 ???
_________________________
[color:red]m[color:blue]IRC[color:green] for EvEr


Top
#123612 - 26/06/05 05:11 PM Re: REMOVE nick
RusselB Offline
Planetary brain

Registered: 03/08/04
Posts: 7252
Loc: Ontario, Canada
If it is possible, then I haven't been able to figure out how. Sorry.

Top
#123613 - 26/06/05 11:54 PM Re: REMOVE nick
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
its not

Top
#123614 - 28/06/05 11:47 PM Re: REMOVE nick
Kelder Offline
Hoopy frood

Registered: 12/04/03
Posts: 701
Loc: Leuven, Belgium
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.

Top