egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Custom log file sort of

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ShavdApe
Halfop


Joined: 15 Dec 2003
Posts: 46

PostPosted: Sun Dec 21, 2008 6:05 pm    Post subject: Custom log file sort of Reply with quote

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
_________________
Driving lessons bolton
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 21, 2008 6:18 pm    Post subject: Reply with quote

To clear a file you can use this code
Code:
set f [open <file> w]
close $f

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
ShavdApe
Halfop


Joined: 15 Dec 2003
Posts: 46

PostPosted: Sun Dec 21, 2008 6:19 pm    Post subject: Reply with quote

cool thanks that will do Smile
_________________
Driving lessons bolton
Back to top
View user's profile Send private message
ShavdApe
Halfop


Joined: 15 Dec 2003
Posts: 46

PostPosted: Mon Dec 22, 2008 12:34 pm    Post subject: Reply with quote

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.
_________________
Driving lessons bolton
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Dec 22, 2008 2:26 pm    Post subject: Reply with quote

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:
proc clear args {
 global db
 set f [open $db w]
 close $f
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber