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.

ctcp bind

Old posts that have not been replied to for several years.
Locked
i
inferno
Voice
Posts: 17
Joined: Thu Jun 05, 2003 2:46 pm

ctcp bind

Post by inferno »

hey there can any1 translate this mirc script into tcl ? i'll explain later what does this script means

ctcp *:!dead*:?: {
if ($read(zlist14.txt, wn, * $+ $replace($2-, $chr(32), *) $+ *)) {
write -dl [ $+ [ $readn ] ] zlist14.txt
msg $nick 7Deleted $2 12Thx For Helping To Keep The List Clean
}
else msg $nick 7Did Not Find Anything For 12 $2
}

Actually i am using a database script for my eggdrop which contains a list of websites . . . and what i want is when a user do a /ctcp botnick !dead url
for exemple: /ctcp botnick !dead http://www.google.com
the bot removes this url from the list . . .
i hope my post is clear and understood if not plz tell me i might clear more
note i have written the script code in the top if u can translate to tcl would be gr8 10x
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Code: Select all

bind ctcp - "!dead" clear:dead
proc clear:dead {nick uh hand dest key arg} {
  regexp -all -- " " $arg "*" src
  set src "*${src}*"
  set in [split [read [set fp [open zlist14.txt r]]] \n]
  close $fp
  if {[set idx [lsearch $in $src]] >= 0} {
    set in [lreplace $in $idx $idx]
    set fp [open zlist14.txt w]
    puts $fp $in
    close $fp
    puthelp "PRIVMSG $nick :\00307Deleted \002 $arg \002 \00312Thx For Helping To Keep The List \002Clean"
  } else {
    oputhelp "PRIVMSG $nick :\00307Did \002Not\002 Find Anything For \00312\002 $arg"
  }
}
i
inferno
Voice
Posts: 17
Joined: Thu Jun 05, 2003 2:46 pm

error

Post by inferno »

ok i loaded ur script
eggdrop runs normally but give me this error in the party line when i try /ctcp botnick !dead http://www.site.com
(Insuline) [16:25] Tcl error [clear:dead]: can't read "src": no such variable
(Insuline) [16:25] Tcl error [clear:dead]: can't read "src": no such variable

Note that i have put the txt file which contains the websites in the eggdrop main directory i guess the problem is that it coudnt find zlist14.txt
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Locate the line regexp -all -- " " $arg "*" src

Change it to

Code: Select all

set srd ""; regexp -all -- " " $arg "*" src
i
inferno
Voice
Posts: 17
Joined: Thu Jun 05, 2003 2:46 pm

Post by inferno »

ok script works now but when /ctcp botnick !dead site.com
the site is removed but problem is the website list get messed up
note that i have put each website on a line
so when i use the ctcp botnick !dead all website become messed up
( i mean not each one on a line) and this cause damage to other scripts i run.
and one more thing when i /ctcp botnick !dead invalid website
for exemple : /ctcp botnick !dead sdfkjsdflkj
it says sdfkjsdflkj was deleted successfully instead of saying website not found . . .
10x for ur time but hope these bugs could be fixed
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Change

Code: Select all

puts $fp $in
to

Code: Select all

puts $fp [join $in \n]
The screwed up DB may be the cause of it saying it still found one.

I can't see anything wrong with the script that would make it say otherwise.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

ppslim wrote:

Code: Select all

set srd ""; regexp -all -- " " $arg "*" src
Don't you mean "set src" and "regsub"? :)
Have you ever read "The Manual"?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I wanted to say the same about the srd :P
Locked