i have a file called ftaserv.tcl when i access this tcl to make a change with gedit when i save the file. a hidden file appears called ftaserv.tcl~ and the changes i made dont take affect. if i access this new file and make the changes in it. another hidden file opens called ftaserv.tcl~~ etc... this same script accesses a file in the eggdrop dir called triggers.txt. I access this file with
proc trig:add {nick user@host handle text} {
putserv "privmsg #just :this is a test"
putserv "privmsg topdawg :this is another test"
set thestb [lindex $text 1]
set in [open "triggers.txt" r]
set data [read $in]
set line [split $data \n]
set here [lsearch [string tolower $line] "$thestb *"]
if {$here != -1} {putserv "privmsg $nick :$thestb already on file. use .trigupd $thestb address";return}
close $in
set out [open "triggers.txt" a]
puts $out [lrange $text 1 end]
close $out
}
if i access this with .trigadd newtest this is a test.
the first time it accepts it. if I do it again it says already on file like its suppose to. however there is nothing in the file and none of the other scripts can access the newly added info. been looking at it for hours. this was working fine yesterday. and still works fine on my other bot. (on a different box). im really confused. thanks in advance
The ~-file is merely a temporary cache created by gedit, partly to allow you to resume editing upon a crash without having to save every 2 seconds. I assume you remembered to save in gedit, and .rehash/.restart in eggdrop?
Are there any other functions/scripts/programs accessing that triggers.txt file? Most linux and *bsd systems allows one file to be opened in multiple instances under certain conditions. More so, one may open a file for writing while some other process has opened it for reading. In this case, the other process will not see your changes until it closes the file and opens it again for reading.