This is the new home of the 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.

bind topc

Old posts that have not been replied to for several years.
User avatar
Posts: 47
Joined: Sun Sep 23, 2001 8:00 pm
Location: Brazil

Post by stere0 »

i have one script to put in the topic my url on all topic change.
after my upgrade to 1.6.6 this doesn't run correct, the bot can't change the topic anymore, but they match the bind command, why!?
<bot> topc -|- * 2 url_topic

the entire script
set urltopicchans "#Chaññel"
set urltopicmatch " "
set urltopics ""
set maxtopiclength "215"
bind topc - * url_topic

proc url_topic { nick uhost hand chan topic } {
global urltopicchans urltopicmatch urltopics botnick maxtopiclength
if {$urltopicchans == ""} {
putlog "URLtopic ERROR: Channel"
return 0
if {$urltopicmatch == "" || $urltopics == ""} {
putlog "URLtopic ERROR: URL"
return 0
set urlindex [lsearch [string tolower $urltopicchans] [string tolower $chan]]
set topic [topic $chan]
set urlmatch [lindex $urltopicmatch $urlindex]
set url [lindex $urltopics $urlindex]
if {![string match [string tolower "*$urlmatch*"] [string tolower $topic]]} {
if {![botisop $chan]} {
putlog "I don't have op"
return 0
if {[expr [string length $topic] + [string length $url]] < $maxtopiclength} {
putserv "TOPIC $chan :$topic $url"
putlog "Including.. ."
return 1
} {
putlog "Topic too long"
return 0
} {
return 0

putlog "URLtopic Loaded"
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

By any chance, is the topic before the change set to nothing/blank?

I would sugest somthing more along the lines of this code.

Code: Select all

set chantopics {
set urltemp ""
set urltemp2 ""
foreach urltemp $chantopics {
  lappend urltemp2 [string tolower $urltemp]
set chantopics $urltemp
unset urltemp urltemp2
bind topc - * url_topic
proc url_topic {nick uh hand chan arg} {
  global chantopics
  if {[set idx [lsearch -glob $chantopics "[sting tolower $chan] *"]] < 0} { return }
  set topic [join [lrange [lindex $chantopics $idx] 1 end]]
  if {![string match -nocase "*${topic}*" $arg]} {
    putserv "TOPIC $chan :http://${topic}/"