When I try to read the file, it gets all the way through the code, but doesn't spit anything out. Via the telnet, I get this error: "[15:18] Tcl error [act:trigger]: can not find channel named "file14""
What shows in channel is this:
* AuntieChrist Pix file read test.egt (yeah, I'm silly, I made a file extention for EGgdrop Text)
* PixelCatv2 file14
* PixelCatv2 opened file named test.egt
* PixelCatv2 read file named test.egt
* PixelCatv2 closed file named test.egt
For my tutorial, I used this post here: http://forum.egghelp.org/viewtopic.php?t=6885
The append and create work just fine, the reading isn't.
Code: Select all
proc act:trigger {nick mask hand chan keyword arg} {
if {[lindex $arg 0] == "Pix"} {
global temp_file data counter temp_string file_name
set temp_file ""
set data ""
set temp_string ""
set file_name [lindex $arg 3]
if {[lindex $arg 2] == "create"} {
set temp_file [open $file_name "w+"]
putserv "PRIVMSG $chan :\001ACTION created file named $file_name\001"
close $temp_file
putserv "PRIVMSG $chan :\001ACTION closed file named $file_name\001"
return
}
if {[lindex $arg 2] == "read"} {
set temp_file [open $file_name "r"]
putserv "PRIVMSG $chan :\001ACTION $temp_file\001"
putserv "PRIVMSG $chan :\001ACTION opened file named $file_name\001"
putserv "PRIVMSG $chan :\001ACTION read file named $file_name\001"
close $temp_file
putserv "PRIVMSG $chan :\001ACTION closed file named $file_name\001"
set data [read -nonewline $temp_file]
putlog "Debug B"
set temp_string [split $data "\n"]
putserv "PRIVMSG $chan :\001ACTION is parsing data. . .\001"
set counter 0
while {$counter <= [llength $data]} {
putserv "PRIVMSG #chan :\001ACTION sees [lindex $temp_string $counter] as line [$counter + 1] in $file_name.\001"
incr counter
}
return
}
if {[lindex $arg 2] == "append"} {
set temp_file [open $file_name "r"]
putserv "PRIVMSG $chan :\001ACTION opened file named $file_name\001"
set temp_string ""
set counter 4
while {$counter <= [llength $arg]} {
lappend temp_string [lindex $arg $counter]
incr counter
}
set [lindex $arg 3] [open $file_name "a"]
puts $temp_file $temp_string
putserv "PRIVMSG $chan :\001ACTION appended $temp_string to file named $file_name\001"
close $temp_file
putserv "PRIVMSG $chan :\001ACTION closed file named $file_name\001"
return
}
}
}
Brendan