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.
Help for those learning Tcl or writing their own scripts.
ap
Halfop
Posts: 44 Joined: Fri Jun 09, 2006 12:20 am
Post
by ap » Sat Jun 09, 2007 5:55 pm
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
}
}
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Sat Jun 09, 2007 6:36 pm
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
ap
Halfop
Posts: 44 Joined: Fri Jun 09, 2006 12:20 am
Post
by ap » Sat Jun 09, 2007 6:44 pm
ahhhh thank you so much