| View previous topic :: View next topic |
| Author |
Message |
BlackTux Voice
Joined: 19 Aug 2005 Posts: 5
|
Posted: Sat May 30, 2009 3:05 am Post subject: Help on where to begin |
|
|
Hi I am kinda new to tcl and eggdrop scripting. I can do the basic bind and proc functions with little to no trouble.
I am working on a script now that writes certain text to a file.
Then allows that text to be searchable only allowing 10 results.
I have the gathering of the info just not sure how to do the searching part. I have tried to look at other searching script and got lost about half way through.
Here is what I have so far:
| Quote: | set pack_file_dir "scripts/custom/packs.txt"
set pack_list ""
set pack_list_chan "<gathering channel>"
set pack_chan "<searching channel>"
bind pubm - *New* Log:Tor
bind pubm - !torsearch* Log:Tor
proc Log:Tor {nick host hand chan arg} {
global pack_file pack_file_dir
set pack_file [open $pack_file_dir a]
puts $pack_file $arg
close $pack_file
}
|
Thank You |
|
| Back to top |
|
 |
Ofloo Owner
Joined: 13 May 2003 Posts: 953 Location: Belguim
|
Posted: Wed Jun 03, 2009 11:05 am Post subject: |
|
|
| Code: | set text {
write some text here if like ..
that the command should write to the file
}
if {[catch {open file.txt 'w'} w]} {
#
# either puts $w $text
#
# or line by line
#
foreach {x} [split $text \n] {
puts $w $x
}
close $w
} |
it all depends, .. a is append w is write and r is read i see you use a .. depends what you want to do remember that w destroys all data currently stored in file.txt _________________ XplaiN but think of me as stupid |
|
| Back to top |
|
 |
|