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 bind mode

Old posts that have not been replied to for several years.
Locked
m
matteo310

problem with bind mode

Post by matteo310 »

Hi all... i have a problem and do not exactly understand what's happening...

Here are extracts from my script:

Code: Select all

bind mode "-" "*" modes_say

proc modes_say {nick uhost hand chan mode victim} {
...
}
Now whenever I try to intercept a +something (like +o +v...) it works flawlessly...

But when en - someting is issued (-v -o...) I get:

[19:13] Tcl error [modes_say]: bad option "-o": must be -exact, -glob, -regexp, or --

in the logs.

Any ideai ?
User avatar
TALES
Halfop
Posts: 59
Joined: Sun Nov 09, 2003 8:45 am
Location: Netherlands
Contact:

could be

Post by TALES »

Code: Select all

bind mode - * modes_say


bind mode <flags> <mask> <proc>

could be anything dont see what the proc is ??
m
matteo310

Post by matteo310 »

puting

Code: Select all

bind mode "-" "*" modes_say
or

Code: Select all

bind mode - * modes_say
doesn't change anything...
But the thing is it works for the + modes and not for the - ones... I don't get why.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

matteo310 wrote:puting

Code: Select all

bind mode "-" "*" modes_say
or

Code: Select all

bind mode - * modes_say
doesn't change anything...
But the thing is it works for the + modes and not for the - ones... I don't get why.
You likely have an [lsearch] inside your proc. The minus sign of the "-o" is seen as the start of an option definition. However, "o" is not an option and so Tcl complains.

That is why there is [lsearch --]. The "--" says that no options will follow after the "--". Any following minus sign should be treated as such and not as the start of an option.
m
matteo310

Post by matteo310 »

well actually there is no lsearch in my proc... here is my proc:

Code: Select all

proc modes_say {nick uhost hand chan mode victim} {
        if {[isbotnick $victim]} {
                switch $mode {
                        "+o" {
                        putserv "PRIVMSG $chan :Merci $nick !"
                        }
                        "-o" {
                        putserv "PRIVMSG $chan :$nick:..."
                        }
                }
        } else {
                if {[isbotnick $nick]} {
                        switch $mode {
                                "+o" {
                                putserv "PRIVMSG $chan :$victim: ..."
                                }
                                "-o" {
                                putserv "PRIVMSG $chan :$victim: ..."
                                }
                        }
                } else {
                        switch $mode {
                                "+o" {
                                putserv "PRIVMSG $chan :$nick: ..."
                                }
                                "-o" {
                                putserv "PRIVMSG $chan :$nick: ..."
                                }
                        }
                }
        }
}
I get the message
Tcl error [modes_say]: bad option "-v": must be -exact, -glob, -regexp, or --
although I am not supposed to treat the -v case... this is very odd to me.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

matteo310 wrote:well actually there is no lsearch in my proc... here is my proc:

Code: Select all

[snip]
switch
[snip]
I get the message
Tcl error [modes_say]: bad option "-v": must be -exact, -glob, -regexp, or --
although I am not supposed to treat the -v case... this is very odd to me.
Same applies to [switch].

http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm
m
matteo310

Post by matteo310 »

ok thanks a lot ! I now works !
Locked