bind pub - !ban send_ban
set f [open "test.txt" "w"]
proc send_ban {nick uhost hand chan arg} {
global ban send_ban f
puts $f "IP0=-[lindex $arg 0]"
close $f
}
after that i get this error ?? and instead of IP0 it should count but don't know yet how to do that i figured if i knew how to use this first ...
[04:56] Tcl error [send_ban]: can not find channel named "file10101648"
PS this works only once but after rehashing it works again, but i need to rehash everytime i wana use this .... ? and it over writes the first line it doesn't append ...?
First move the set f [open "test.txt" "w"] inside the proc, second, to append use "a" not "w". That error means he can't close a file that is not opened, or something like this anyway.
Once the game is over, the king and the pawn go back in the same box.
hmm doesn't seem to work and for the counter i found this but that one only counts until one ... it appends but still need to rehash before i can add a second line .. the counter works but only when i append ? so if i would like to over write it it doesn't work .. and when i append it only counts to 2 witch is normal cause it keeps on reading the first line so i suppose it has to close the file before it can write to it or am i wrong .. (tryed but doesn't work either .. ?)
bind pub - !ban send_ban
set fw [open "test.txt" "a+"]
set fc [open "count.txt" "w+"]
proc send_ban {nick uhost hand chan arg} {
global ban send_ban fw fc
set line1 [gets $fc]
set lr1 [expr $line1 + 1]
puts $fc $lr1
puts $fw "IP$lr1=-[lindex $arg 0]"
close $fw
close $fc
}
I know i need to flush channel id but how ?? so my main problem is flussing the channel id witch is $fw $fc i gues, and the counter doesn't count for some reason, i have tryed for the counter a a+ w w+ r r+ and nonew line
i think i need the w cause it needs to overwrite it but with all the other flags it does something different sometimes it adds it vertical somethimes it adds it horizontal .. but not overwrite and when it is supposed to it only does it once .. ???
proc send_ban {nick uhost hand chan arg} {
global ban send_ban
set fw [open "test.txt" "a"]
set fc [open "count.txt" "r"]
set nr "[read $fc]"
set count [expr $nr + 1]
puts $fw "IP$count=-[lindex $arg 0]"
set fd [open "count.txt" "w"]
puts -nonewline $fd $count
close $fw
close $fc
close $fd
}
Wel, yes. You open the cout.txt file for reading, the a few line later you open it for writing and you close it only one time. First close it for reading then open it for writing.
Once the game is over, the king and the pawn go back in the same box.
huh look again i close it 2 times only for reading i set fc and for writing i set fd ??? hehe or am i mestaking cause i am not that good that this stuff .. :/
Oups, yes.. haven't noticed the second close. Anyway, first close it for reading, the open and close for writing. Also, you can open it with r+ for the reading and the writing.
Once the game is over, the king and the pawn go back in the same box.