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.

No Joy Guys

Old posts that have not been replied to for several years.
Locked
[
[Nero]
Voice
Posts: 29
Joined: Mon May 27, 2002 8:00 pm

Post by [Nero] »

Thanx for the advise guys on the previous topics but no matter what i try i cannot get the bits you have suggested to work.

if i have say ftp://123.456.789.012
in templist.txt & some one /msg the egg with ADD ftp://123.456.789.012 all i need to work is that the egg will search templist.txt and 1) find it & 2) say sorry but ftp://123.456.789.012 is already in
templist.txt } else { write it to templist.txt, is there anything else i could try ??

Many Many thanx again & no the file is very small & nowhere near 500Mb - lol
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Nero, you're doing something wrong in the other part of the script. All of our suggestions for finding lines (including your *own* code) work just fine.

If you want help with the other part of the code, you will have to post it.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

set ftp_file "/home/path/to/your/bot/templist.txt"

set ftp_site ""

bind msg - add add_ftp_site

proc add_ftp_site {nick host hand chan text} {
  global ftp_file ftp_site
  set ftp_site "$text"
  set fs [open $ftp_file r]
  while {![eof $fs]} { 
    gets $fs line 
    if {[string match "$ftp_site*" $line]} {
      putserv "MSG $nick :Sorry but $ftp_site is already in the list!"
      close $fs
    } else {
      set ap [open $ftp_file a]
      puts $ap "$ftp_site"
      putserv "MSG $nick :$ftp_site has been added to the list."
      close $ap
    }
  }
 }
I think that'll work, don't kill me if it doesn't :wink: I didn't have the time to test it
Elen sila lúmenn' omentielvo
[
[Nero]
Voice
Posts: 29
Joined: Mon May 27, 2002 8:00 pm

Post by [Nero] »

LOL - Just running that bit on it own returns [21:40] Tcl error [add_ftp_site]: no value given for parameter "text" to "add_ftp_site"

just not my day - or DAYS - lol
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Heh, if you want to make it work, just get rid of the "chan" argument in proc add_ftp_site {nick host hand chan text}

There are some other more serious errors though. I wouldn't run it until Papillon has time to test it :)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

LOL - For each new entry, the file would allmost double in size.
Locked