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.

Problem with [ % ] when changing topic

Old posts that have not been replied to for several years.
Locked
i
infos

Problem with [ % ] when changing topic

Post by infos »

I'm using this script for change the topic:
bind pub o|o "[char]topic" pub_topic
proc pub_topic {user uhost hand chan arg} {
set topic [lrange $arg 0 end]
putserv "TOPIC $chan :$topic"
putlog "$chan: Changing topic too \"$topic\" by request of $user\[$hand\]"
}

but if i do !topic [test]
it changes the topic for "{[test]}"
what's the problem?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This is because you are using list commands on strings.

The correct usage is

Code: Select all

bind pub o|o "[char]topic" pub_topic 
proc pub_topic {user uhost hand chan arg} { 
set topic [join [lrange [split $arg] 0 end]]
putserv "TOPIC $chan :$topic" 
putlog "$chan: Changing topic too \"$topic\" by request of $user\[$hand\]" 
}
However, notice you are using an index of 0 to end in the lrange. Why?

You might as well skip that, and use

Code: Select all

set topic $arg
i
infos

Post by infos »

it isn't mine.
it's a modified version of ophelper that i found in google. i am only tring to fix some bugs and ajust something.
i'll change the topic for "$arg" and i 'll use [join [lrange [split $arg] 0 end]] for the kick and kickban. thanks :)
Locked