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.

special characters in chan names

Old posts that have not been replied to for several years.
Locked
b
bonboncho

special characters in chan names

Post by bonboncho »

hi, i'm using a script for op/invite/unban/clear in a chan but the chan name has special characters and the bot doesn't execute the commands it says invalid command name "rip"...#[rip] is the name of the channel
i read the post about the split command in tcl and i tried it but it doesn't work that way neither.. i'm paste-ing the script here... please help if you know how to solve this problem.

set regnick "Ma3oXuCTka"
set nspass "ku4ka22"
set nsserv "NS!NickServ@UniBG.services"
set csserv "CS!ChanServ@Unibg.services"
set csnick "CS"
set nsnick "NS"
proc deban {arg} {
global botnick regnick

#unbanva se ako e bannat
if {[string match "*[string toupper $botnick]*" [string toupper $regnick]]} {
set c [lindex [split $arg] 0]
putlog "Opit za mahane na ban ot kanala $c prez CS...."
putserv "PRIVMSG CS :UNBAN $c"
putserv "PRIVMSG CS :INVITE $c"
putserv "PRICMSG CS :CLEAR $c ALL"
}
}

# vzimane na op ot CS
proc getop {arg} {
global botnick regnick csnick
if {[string match "*[string toupper $botnick]*" [string toupper $regnick]]} {
set c [lindex [split $arg] 0]
putlog "Opit za vzimane na OP v kanal $c ot CS ...."
putserv "PRIVMSG $csnick :op $c $botnick"
putserv "PRIVMSG $csnick :op all"
}
}

#Ako kanal e invite only da se Invite-va prez CS
proc invite {arg} {
global botnick regnick csnick
if {[string match "*[string toupper $botnick]*" [string toupper $regnick]]} {
set c [lindex [split $arg] 0]
putlog "Opit bota da se invite-ne v kanal $c prez CS ..."
putserv "PRIVMSG $csnick :INVITE $c"
}
}

# Vku4vane i izklu4vane na postoqnni opiti vzimane na op ot CS v kanali kadeto bota e addnat
# .cssup #lame -> vklu4va
# .cssup #lame off -> izklu4va

proc cssup {hand idx arg} {
if {[lindex $arg 1]!="off"} {
channel set [lindex $arg 0] need-op "getop [lindex [split $arg] 0]"
channel set [lindex $arg 0] need-unban "deban [lindex [split $arg] 0]"
channel set [lindex $arg 0] need-invite "invite [lindex [split $arg] 0]"
putlog "Ot tozi moment natatuk se iska op [lindex [split $arg] 0] ot CS"
} {
channel set [lindex [split $arg] 0] need-op ""
channel set [lindex [split $arg] 0] need-unban ""
channel set [lindex [split $arg] 0] need-invite ""
putlog "Iziskvaneto na op v [lindex [split $arg] 0] ot CS e izklu4eno !"
}
}

# identvane kogato trqbwa
proc notice_a {from keyword arg} {
global nsnick csnick nspass nsserv csserv
set servresp [lindex [split $arg] 1]
set msg [lrange [split $arg] 0 end]

if {$from==$nsserv} {
if {[lindex [split $arg] 1]==":This"} {
putserv "PRIVMSG $nsnick :IDENTIFY $nspass"
putlog "$nsnick iska da se IDENTIFY..." }
}


return "$from $keyword $arg"
}



proc n_311 {a b c} {
putlog "$c"
return "$a $b $c"
}

# blidz
unbind dcc o|o msg *dcc:msg
bind dcc n|- msg *dcc:msg

bind dcc n cssup cssup
bind raw - 311 n_311
bind raw - notice notice_a
putlog "Services Support by bonboncho zareden !!"


thanks in advance
User avatar
Souperman
Halfop
Posts: 69
Joined: Sat Feb 02, 2002 8:00 pm
Location: Cape Town, South Africa
Contact:

Post by Souperman »

In proc cssup you still have a few "[lindex $arg 0]" instead of "[lindex [split $arg] 0]".

You also have an lrange a little after that which probably needs to be converted back into a string using join, i.e. "set msg [join [lrange [split $arg] 0 end]]". Incidentally, this is kinda pointless, since using a range of "0" to "end" effectively means "the whole list". Not sure what you're trying to achieve there.

Something that would help a lot for anyone trying to read your code would be proper indentation, e.g.:
Unclear:

Code: Select all

proc foo {bar baz} {
putlog "$bar"
if {[string compare -nocase $foo hello]} {
putlog "hello"
}
}
Good indentation == more readable:

Code: Select all

proc foo {bar baz} {
  putlog "$bar"
  if {[string compare -nocase $foo hello]} {
    putlog "hello"
  }
}
Finally, I'd suggest you read http://www.peterre.com/characters.html, if you haven't already done so.
Quick! Somebody get me a new ink cartridge
b
bonboncho

Post by bonboncho »

it still doesn't work :(
User avatar
Souperman
Halfop
Posts: 69
Joined: Sat Feb 02, 2002 8:00 pm
Location: Cape Town, South Africa
Contact:

Post by Souperman »

Please be more specific. What changes have you made (preferably paste the script again)? Can you paste the output on the partyline, if any?
Quick! Somebody get me a new ink cartridge
b
bonboncho

ok

Post by bonboncho »

i changed all the [lindex $arg 0/1] and [lrange $arg 0/1] to [lindex [split $arg] 0/1] and [lrange [split $arg] 0/1] and it's still giving the same output which is:

[17:18] Tcl error in script for 'need-op':
[17:18] invalid command name "rip"

and for the need-unban, need-invite is the same
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

This error is not from the code you posted. You have an error in your need-op setting or in a need-op script.
b
bonboncho

sir fz

Post by bonboncho »

the scipt i have posted is the one that the bot uses instead of the need-op option in the eggdrop.conf ... and the channel is not added in the conf file but by the .+chan command so i cannot change the command by what the bot is requesting an @ ot the speciffic channel
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Now I realized what the problem was, try to use string map to add "\" before [] in the chan name in order to skip []'s.

this code is by User:

Code: Select all

[string map {\\ \\\\ \[ \\\[ \] \\\]} $c]
so if the channel name is #[rip] this will return #\[rip\]
Locked