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 version

Help for those learning Tcl or writing their own scripts.
Post Reply
M
MacDaddy
Voice
Posts: 9
Joined: Fri Jan 20, 2006 4:41 pm

ctcp version

Post by MacDaddy »

hey all i got a mIRC script that i use and i tryed to convert it into tcl

this is the mirc scrpt.

Code: Select all

ON !*:JOIN:#: {
  ctcp $nick version
}

ON *:CTCPREPLY:VERSION*: {
  if (!$window(@version)) window -ne @version
  aline @version $nick $1-
  if (*version here* iswm $1-) {  
    /notice $nick $nick message here
  }
}
and this is what i have for tcl.

Code: Select all

bind join - * verjoin

proc verjoin {nick uhost hand chan} {
 if {([onchan $nick $chan]) && ("[getchanhost $nick $chan]" == "$uhost")} {
  if {([string match -nocase *version here* $nick])} {
   putserv "NOTICE $nick message here"
  }
 }
}
i dont get any errors and i dont send the notice can anyone help ?
thanks :wink:
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind ctcr - VERSION version:reply
bind join - * check:version

proc check:version {nick uhost hand chan} {
 global cversion
 set cversion([string tolower $nick]) 1
 putserv "privmsg $nick :\001VERSION\001"
}

proc version:reply {nick uhost hand dest kw arg} {
 global cversion
 if {[isbotnick $dest] && [info exists cversion([string tolower $nick])]} {
  if {[string match -nocase "*version here*" $arg]} {
   puthelp "notice $nick :message here"
   unset cversion([string tolower $nick])
  }
 }
}
M
MacDaddy
Voice
Posts: 9
Joined: Fri Jan 20, 2006 4:41 pm

Post by MacDaddy »

Sir_Fz thanks testing it now ok that works well is there a way of putting the

Code: Select all

if {[string match -nocase "*version*" $arg]} {
into more than one version like

Code: Select all

if {[string match -nocase "*version1*" $arg] || [string match -nocase "*version2*" $arg]} {
and so on add ing versions like that ?
thanks
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Yes, try it. Or you can do it like this:

Code: Select all

set bversions {"*version1*" "*version2*" "*version3*"}
foreach bversion $bversions {
 if {[string match -nocase $version $arg]} {
  # found match for one of the bad versions
  break
 }
}
M
MacDaddy
Voice
Posts: 9
Joined: Fri Jan 20, 2006 4:41 pm

Post by MacDaddy »

thanks Sir_Fz works perfect :lol:
Post Reply