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 

bans

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


Joined: 09 Jun 2006
Posts: 44

PostPosted: Sat Jun 09, 2007 5:55 pm    Post subject: bans Reply with quote

Hi, i'm trying to write sticky bans to the file but somehow the following snippet writes just one line. I'll appreciate for your help - thx

Code:
foreach b [banlist] {
    if {[isbansticky [lindex $b 0]]} {
        set x [open $::stickylog "w"]
        puts $x "[lindex $b 0]"
        close $x
    }
  }
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jun 09, 2007 6:36 pm    Post subject: Reply with quote

Well, the problem is that you open the file (which currently clears it's contents), write one line, close the file, iterate to the next ban, open the file again (clearing it again), and so forth...

Move the open and close commands outside the loop, and it should work like a charm...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
ap
Halfop


Joined: 09 Jun 2006
Posts: 44

PostPosted: Sat Jun 09, 2007 6:44 pm    Post subject: Reply with quote

ahhhh thank you so much
Back to top
View user's profile Send private message
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