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.

controlcodes in nicks prevent script to work, how to fix?

Old posts that have not been replied to for several years.
Locked
o
odoisc2
Voice
Posts: 2
Joined: Sat May 07, 2005 11:35 am

controlcodes in nicks prevent script to work, how to fix?

Post by odoisc2 »

I have a script that allows people to kick someone through a ctcp command. It only works if those people are online in a seperate controlroom, wich has restricted access.

the command is like /ctcp botname kick roomname nick kickreason

Code: Select all

bind CTCP - kick ctcpkick
proc ctcpkick { nick host handle dest keyword text } {
	if { $keyword == "KICK" } {	   
	   if { [onchan $nick "#controlroom"] } {
		 set kickchan [lindex $text 0]
		 set kicknick [lindex $text 1]	
		 set kickmsg [lrange $text 2 100]	
       putserv "PRIVMSG #controlroom :kickcommand used by $kicknick in $kickchan , by $nick"
       putserv "kick $kickchan $kicknick $kickmsg"
		}
       }
}
And it works, except when the targetted nick has a \ in his nick, wich seems te be processed as a control code afaik.

So my question is ofcourse, how can I use that script even for nicks with \ in it ? is there some way to convert those \ to normal characters ?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

replace

Code: Select all

[lindex $text ...
with

Code: Select all

[lindex [split $text] ...
and

Code: Select all

[lrange $text 2 100]
with

Code: Select all

[join [lrange [split $text] 2 end]]
Check the 'tip of the day' thread in the FAQ forum.
o
odoisc2
Voice
Posts: 2
Joined: Sat May 07, 2005 11:35 am

Post by odoisc2 »

ok cool thanks, think I start to understand why its like that
Locked