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 on where to begin

Help for those learning Tcl or writing their own scripts.
Post Reply
B
BlackTux
Voice
Posts: 5
Joined: Fri Aug 19, 2005 8:07 pm

Help on where to begin

Post by BlackTux »

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:
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
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

Code: Select all

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
Post Reply