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.

topic with special formatted characters

Old posts that have not been replied to for several years.
Locked
b
bofh
Voice
Posts: 8
Joined: Mon Feb 14, 2005 1:36 am

topic with special formatted characters

Post by bofh »

Hello

I have a problem with the topic changing

I have this in my script:

bind pub -|- !topic pub:topic
bind pub -|- !t pub:topic

proc pub:topic { nick host handle chan text } {
global botnick

if { [botisop $chan] } {
if { [onchan $nick $chan] && [matchattr $handle o|C $chan] } {
set arg [lindex $text 0 ]
set newtopic [lrange $text 1 end]
if { $arg != "+" } {
set newtopic [lrange $text 0 end]
if { $newtopic == "" } {
putserv "TOPIC $chan :"
} else {
putserv "TOPIC $chan :[join $newtopic]"
}
} else {
set curtopic [topic $chan]
putserv "TOPIC $chan :$curtopic | [join $newtopic]"
}
} else {
putserv "NOTICE $nick : You haven't permission for this!"
}
flushmode $chan
} else {
putserv "NOTICE $nick : I'm not opped on $chan"
}
}

but when I do: !t \x01\x02 it will replace that binary codes with the representing characters, and I don't want that. Also when I do: !t {hello}
it will replace it with only hello...

How can I fix it?

P.S.:
Sorry for my english, and maybe too lame question, but I'm not very skilled at coding at all :wink:
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

addslashes

\{hello\} \\x01 \\x02 etc put a \ infront of every special character
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

'split' the text before using list commands (like 'lindex' and 'lrange') on it.
Have you ever read "The Manual"?
b
bofh
Voice
Posts: 8
Joined: Mon Feb 14, 2005 1:36 am

Post by bofh »

^DooM^ wrote:addslashes

\{hello\} \\x01 \\x02 etc put a \ infront of every special character
Well that's not a solution...
b
bofh
Voice
Posts: 8
Joined: Mon Feb 14, 2005 1:36 am

Post by bofh »

user wrote:'split' the text before using list commands (like 'lindex' and 'lrange') on it.
I think you didn't see the whole code I wrote, did you? :?
I'm using lindex and lrange, but doesn't help...
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

user wrote:'split' the text before using list commands (like 'lindex' and 'lrange') on it.
Miss something bofh? Like the link so you can READ about the use of split?
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
b
bofh
Voice
Posts: 8
Joined: Mon Feb 14, 2005 1:36 am

Post by bofh »

Alchera wrote:
user wrote:'split' the text before using list commands (like 'lindex' and 'lrange') on it.
Miss something bofh? Like the link so you can READ about the use of split?

Oh, I'm sorry, I understood that reply from user after I answered to him :-)
b
bofh
Voice
Posts: 8
Joined: Mon Feb 14, 2005 1:36 am

Re: topic with special formatted characters

Post by bofh »

Well i fixed that (using [join [lrange [split $text] 0 end]] ), but not so well I wanted:

The problem is with this:

!topic {hello]

bot => Tcl error [pub:topic]: unmatched open brace in list


What to do with this? I have no idea... :roll:
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

For each opening bracket '[' there has to be a matching closing bracket ']'.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

Maybe if you read 'The Manual' ? you would find all the help you need.

Try this

Code: Select all

proc subst {text} {
    regsub -all -- \\\\ $text \\\\\\\\ text
    regsub -all -- \\\[ $text \\\\\[ text
    regsub -all -- \\\] $text \\\\\] text
    regsub -all -- \\\} $text \\\\\} text
    regsub -all -- \\\{ $text \\\\\{ text
    regsub -all -- \\\" $text \\\\\" text
    return $text
}
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
b
bofh
Voice
Posts: 8
Joined: Mon Feb 14, 2005 1:36 am

Post by bofh »

Alchera wrote:For each opening bracket '[' there has to be a matching closing bracket ']'.
I know that, but didn't know how to fix...
b
bofh
Voice
Posts: 8
Joined: Mon Feb 14, 2005 1:36 am

Post by bofh »

^DooM^ wrote:Maybe if you read 'The Manual' ? you would find all the help you need.

Try this

Code: Select all

proc subst {text} {
    regsub -all -- \\\\ $text \\\\\\\\ text
    regsub -all -- \\\[ $text \\\\\[ text
    regsub -all -- \\\] $text \\\\\] text
    regsub -all -- \\\} $text \\\\\} text
    regsub -all -- \\\{ $text \\\\\{ text
    regsub -all -- \\" $text \\\\" text
    return $text
}
Thx

(I played with this few days ago but this made some problems, I will try once again.. 8) )
Locked