This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Custom log file sort of

Help for those learning Tcl or writing their own scripts.
Post Reply
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

Custom log file sort of

Post by ShavdApe »

Hi there im looking for help on how i would go about clearing a log file every 24 hours a sort of custom log file i guess based on specific triggers.

Any help appreciated thanks
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

To clear a file you can use this code

Code: Select all

set f [open <file> w]
close $f
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

Post by ShavdApe »

cool thanks that will do :)
S
ShavdApe
Halfop
Posts: 46
Joined: Mon Dec 15, 2003 5:22 pm

Post by ShavdApe »

This doesnt appear to work for me so im confused i tried to do it on a bind time basis and nothing also did it on a trigger and that didnt work either.

bind pub - !clear clear

proc clear {} {
global db
set f [open $db w]
close $f
}

Actually the above code just give an error when i try
Tcl error [clear]: wrong # args: should be "clear"
but as i say ive also tried to do it on a time basis

I tried to add things like
proc clear { nick uhost handle chan arg } {

but still gave simmilar arror to above. so any help appreciated.
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Since clear is triggered by a time-bind, it should take "minute hour day month year" (the names do not matter) as its parameters. You can just use "args" since you're not going to use any of the proc's parameters.

Code: Select all

proc clear args {
 global db
 set f [open $db w]
 close $f
}
Post Reply