bans

Help for those learning Tcl or writing their own scripts.
Post Reply
a
ap
Halfop
Posts: 44
Joined: Fri Jun 09, 2006 12:20 am

bans

Post by ap »

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: Select all

foreach b [banlist] { 
    if {[isbansticky [lindex $b 0]]} {
        set x [open $::stickylog "w"]
        puts $x "[lindex $b 0]"
        close $x
    }
  }
n
nml375
Revered One
Posts: 2861
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
a
ap
Halfop
Posts: 44
Joined: Fri Jun 09, 2006 12:20 am

Post by ap »

ahhhh thank you so much
Post Reply