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.

ch-relay1.101 error.

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

ch-relay1.101 error.

Post by iamdeath »

Hi has anyone of you ever worked on this TCL ?.. ch-relay1.01 it's not working with me ...

Code: Select all

# chan-relay v1.01 by shred, 2001 <shreder@tsu.tmn.ru>


# <vars>
set cr(version) "1.01"

# format: "bot1 #bot1chan flags1 {users1} bot2 #bot2chan flags2 {users2}"

# bot1                         <---  #bot2chan, flags2, {users2}
# #bot1chan, flags1, {users1}  --->  bot2

# users: 
# {}		- no users
# {*}		- all users
# {nick1 nick2}	- selected users (only nick1 and nick2)

# flags (what to send):
# -	- NOTHING
# c	- chan msgs, actions
# C	- chan msgs, actions with @/+ prefix
# j	- join, part, quit msgs
# m	- mode change msgs
# k	- kick msgs
# n	- nick change
# N	- send with out nick (message only)
# t	- topic change
# u	- request user list (from another side)
# T	- t + synchronize
# 1|2|3	- output priority (default is 3, 1 is NOT recommended)
# a	= cjmnkt
# A	= CjmknT
# !! incorrect lines are ignored !!
### *** THIS IS WORKING EXAMPLE: 
set cr(sets) {
  "dnr #distributed cN {dctievent} duron #distributed - {}"
  "dnr #distributed cN {dctievent} chasm #distributed - {}"
  "dnr #distributed cN {dctievent} chasm #dnet.ru - {}"
  "dnr #distributed cN {dctievent} Cluster #distributed - {}"
  "chasm #nnm.ru A {*} duron #noname uc {shred}"
  "ZED #qw.ru A {*} duron #qw.ru ucjn1 {shred}"
  "Cluster #atom a {*} duron #tyumen u {shred}"
  "dnr #qq A {*} duron #eggdrop A {*}"
}

# list of bots with this script on board (authorized bots)
# also needed for dcc command "cr_rehash" (rehash all selected bots)
### *** THIS IS WORKING EXAMPLE: 
set cr(netbots) "Cluster ZED Fiber BadBlock def chasm duron dnr"
# </vars>


# <procs>
proc xindex {xarg xarg1} {return [join [lrange [split $xarg] $xarg1 $xarg1]]}
proc xrange {xarg xarg1 xarg2} {return [join [lrange [split $xarg] $xarg1 $xarg2]]}
proc b {} { return \002 }

proc cr_modep {nick chan cmd} {
  if {$cmd == "cr_pubm" || $cmd == "cr_act"} {
    if {[isop $nick $chan]} {return "\@$nick"}
    if {[isvoice $nick $chan]} {return "\+$nick"}
  }
  return $nick
}
proc cr_cansend {cmd modes} {
  if {$modes == "-"} {return 0}
  regsub "a" $modes "cjmnkt" modes
  regsub "A" $modes "CjmnkT" modes
  if {[lsearch "cr_report cr_ulist" $cmd] != -1} {return 1}
  switch $cmd {
    cr_pubm {if {[string match "*\[cC\]*" $modes]} {return 1}}
    cr_act {if {[string match "*\[cC\]*" $modes]} {return 1}}
    cr_join {if {[string match "*j*" $modes]} {return 1}}
    cr_part {if {[string match "*j*" $modes]} {return 1}}
    cr_sign {if {[string match "*j*" $modes]} {return 1}}
    cr_mode {if {[string match "*m*" $modes]} {return 1}}
    cr_nick {if {[string match "*n*" $modes]} {return 1}}
    cr_topc {if {[string match "*\[tT\]*" $modes]} {return 1}}
    cr_ulistreq {if {[string match "*u*" $modes]} {return 1}}
  }
  return 0
}
proc cr_getpri {modes} {
  if {[string match "*1*" $modes]} {return 1}
  if {[string match "*2*" $modes]} {return 2}
  return 3
}
proc cr_send2 {b1d b2d cmd nick text} {
  set b1name	[xindex $b1d 0]
  set b1chan	[xindex $b1d 1]
  set b1modes	[xindex $b1d 2]
  set b1users	[xindex $b1d 3]
  set b1pri	[cr_getpri $b1modes]
  set b2name	[xindex $b2d 0]
  set b2chan	[xindex $b2d 1]
  set b2modes	[xindex $b2d 2]
  set b2users	[xindex $b2d 3]
  set b2pri	[cr_getpri $b2modes]
  if {![cr_cansend $cmd $b1modes]} {return}
  if {$b1name == $b2name} {
    if {[string match "*\[CA\]*" $b1modes]} {set nick [cr_modep $nick $b1chan $cmd]}
    cr_brecive $b1name $cmd [concat $b2chan $nick $text]
  } else {
    if {[string match "*\[CA\]*" $b1modes]} {set nick [cr_modep $nick $b1chan $cmd]}
    foreach x $b1users {
      if {$x == $nick || $x == "\*"} {
        if {$cmd == "cr_topc" && $nick == $b1name} {continue}
        if {($cmd == "cr_topc") && [string match "*\[AT\]*" $b1modes]} {append cmd "s"}
        if {($cmd == "cr_pubm" || $cmd == "cr_act") && [string match "*N*" $b1modes]} {set nick "\*"}
        if {[catch {putbot $b2name "$cmd $b1pri $b2chan $nick $text"} err]} {putlog "$x bot error: $err"}
      }
    }
  }
}
proc cr_send {cmd chan nick text} {
  global botnick cr
  regsub -all ï $text Ÿ text
  foreach i $cr(sets) {
    if {[llength $i] != 8} {continue}
    set b1name	[xindex $i 0]
    set b1chan	[xindex $i 1]
    set b1modes	[xindex $i 2]
    set b1users	[xindex $i 3]
    set b2name	[xindex $i 4]
    set b2chan	[xindex $i 5]
    set b2modes	[xindex $i 6]
    set b2users	[xindex $i 7]
    if {$b1name == $botnick && $b1chan == $chan} {
      cr_send2 "$b1name $b1chan $b1modes $b1users" "$b2name $b2chan $b2modes $b2users" $cmd $nick $text
    } elseif {$b2name == $botnick && $b2chan == $chan} {
      cr_send2 "$b2name $b2chan $b2modes $b2users" "$b1name $b1chan $b1modes $b1users" $cmd $nick $text
    }
  }  
}

proc cr_pubm {nick uhost hand chan text} {cr_send cr_pubm $chan $nick $text}
proc cr_act {nick uhost hand chan keyw text} {cr_send cr_act $chan $nick $text}
proc cr_nick {nick uhost hand chan newnick} {cr_send cr_nick $chan $nick $newnick}
proc cr_mode {nick uhost hand chan mc victim} {
  if {$nick == "" && $hand == "\*"} {
    cr_send cr_mode $chan $uhost "$chan $mc $victim"
  } else {
    cr_send cr_mode $chan $nick "$chan $mc $victim"
  }
}
proc cr_join {nick uhost hand chan} {
  cr_send cr_join $chan $nick "$chan $uhost"
  cr_send cr_ulistreq $chan $nick "$chan"
}
proc cr_part {nick uhost hand chan msg} {cr_send cr_part $chan $nick "$chan $uhost"}
proc cr_sign {nick uhost hand chan reason} {cr_send cr_sign $chan $nick "$uhost $reason"}
proc cr_topc {nick uhost hand chan topic} {if {$nick == "\*"} {return}; cr_send cr_topc $chan $nick "$chan $topic"}
proc cr_kick {nick uhost hand chan target reason} {cr_send cr_kick $chan $nick "$target $reason"}

proc cr_putx {pri text} {
  switch $pri {
    1 {putquick $text}
    2 {putserv $text}
    3 {puthelp $text}
    default {putlog "ERROR: Wrong priority ($pri) for message '$text'"}
  }
}
proc cr_brecive {frombot cmd arg} {
  global cr server
  if {$server == ""} {return}
  if {[lsearch $cr(netbots) $frombot] == -1} {return}
  set pri  [xindex $arg 0]
  set chan [xindex $arg 1]
  set nick [xindex $arg 2]
  set text [xrange $arg 3 end]
  switch $cmd {
    cr_pubm {if {$nick == "*"} {cr_putx $pri "PRIVMSG $chan :$text"} else {cr_putx $pri "PRIVMSG $chan :\<$nick\> $text"}}
    cr_act {if {$nick == "*"} {putact $chan $text} else {cr_putx $pri "PRIVMSG $chan :\* $nick $text"}}
    cr_nick {cr_putx $pri "PRIVMSG $chan :\*\*\* $nick is now known as $text"}
    cr_mode {cr_putx $pri "PRIVMSG $chan :\*\*\* $nick sets [xindex $text 0] mode: [xrange $text 1 end]"}
    cr_sign {cr_putx $pri "PRIVMSG $chan :\*\*\* $nick ([xindex $text 0]) Quit ([xrange $text 1 end])"}
    cr_join {cr_putx $pri "PRIVMSG $chan :\*\*\* $nick ([xindex $text 1]) has joined [xindex $text 0]"}
    cr_part {cr_putx $pri "PRIVMSG $chan :\*\*\* $nick ([xindex $text 1]) has left [xindex $text 0]"}
    cr_topc {cr_putx $pri "PRIVMSG $chan :\*\*\* $nick changes [xindex $text 0] topic to '[xrange $text 1 end]'"}
    cr_topcs {cr_putx $pri "PRIVMSG $chan :\*\*\* $nick changes [xindex $text 0] topic to '[xrange $text 1 end]'"; if {[botisop $chan]} {putserv "TOPIC $chan :[xrange $text 1 end] ($nick)"}}
    cr_kick {cr_putx $pri "PRIVMSG $chan :\*\*\* [xindex $text 0] was kicked from $chan by $nick ([xrange $text 1 end])"}
    cr_dorehash {putbot $frombot cr_rehashing; putlog "REHASH request from $frombot"; rehash}
    cr_rehashing {putlog "  $frombot: rehashing..."}
    cr_report {cr_putx $pri "PRIVMSG $chan :\! Relay bot (${frombot}) reporting: $text"}
    cr_ulistreq {putbot $frombot "cr_ulist 3 $text $nick [b][llength [chanlist $chan]][b] users on [b]$chan[b]: [join [lsort [chanlist $chan]] {, }]"}
    cr_ulist {cr_putx $pri "NOTICE $nick :\[$chan\] $text"}
  }
}
proc cr_sendrehash {hand idx arg} {
  global cr botnick
  putlog "Sending REHASH request to [llength $cr(netbots)] bots..."
  foreach x $cr(netbots) {
    if {$x == $botnick} {continue}
    if {![islinked $x]} {putlog "$x bot is not currently linked"; continue}
    if {[catch {putbot $x "cr_dorehash"} err]} {putlog "$x bot error: $err"}
  }
  putlog "Send completed. Rehashing myself..."; rehash
}
proc cr_need {chan type} {
  if {$type == "unban"} {cr_send cr_report $chan - "need unban on $chan"}
}
# </procs>

# <binds>
bind dcc n cr_rehash cr_sendrehash
bind need - * cr_need
bind pubm - * cr_pubm
bind ctcp - ACTION cr_act
bind nick - * cr_nick
bind mode - * cr_mode
bind join - * cr_join
bind part - * cr_part
bind sign - * cr_sign
bind topc - * cr_topc
bind kick - * cr_kick
bind bot - cr_pubm cr_brecive
bind bot - cr_act cr_brecive
bind bot - cr_nick cr_brecive
bind bot - cr_mode cr_brecive
bind bot - cr_join cr_brecive
bind bot - cr_part cr_brecive
bind bot - cr_sign cr_brecive
bind bot - cr_topc cr_brecive
bind bot - cr_topcs cr_brecive
bind bot - cr_kick cr_brecive
bind bot - cr_dorehash cr_brecive
bind bot - cr_rehashing cr_brecive
bind bot - cr_report cr_brecive
bind bot - cr_ulistreq cr_brecive
bind bot - cr_ulist cr_brecive
# </binds>

# <c>
putlog "  chan-relay v$cr(version) by shred, 2001 <shreder@tsu.tmn.ru>"
# </c>
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Check your logfiles for error messages or type ".set errorInfo" in your bot's partyline to see if there are any errors generated by this script. And make sure the script is on all of your bots.
Post Reply