egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help on where to begin

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
BlackTux
Voice


Joined: 19 Aug 2005
Posts: 5

PostPosted: Sat May 30, 2009 3:05 am    Post subject: Help on where to begin Reply with quote

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
View user's profile Send private message
Ofloo
Owner


Joined: 13 May 2003
Posts: 953
Location: Belguim

PostPosted: Wed Jun 03, 2009 11:05 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber