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.
Old posts that have not been replied to for several years.
CoMMy
Halfop
Posts: 99 Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus
Post
by CoMMy » Fri Feb 20, 2004 9:34 am
This is my problem.
Code: Select all
foreach binding [binds] {
set bindtype [lindex $binding 0]
set bindattr [lindex $binding 1]
set bindname [lindex $binding 2]
set bindhits [lindex $binding 3]
set bindproc [lindex $binding 4]
if {[string match [string tolower $bindtype] [string tolower msg]]} {
unbind $bindtype $bindattr $bindname $bindproc }}
Where it says [string tolower msg] I want to change msg into
msg_* but it doesnt work.
Can you help me find this?
Basically i want something to select every bind that has a msg_ proc.
Thanks
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
CoMMy
Halfop
Posts: 99 Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus
Post
by CoMMy » Fri Feb 20, 2004 11:37 am
Anyone?
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
C
Cucumber
Post
by Cucumber » Fri Feb 20, 2004 1:20 pm
Howdy,
i think you've got your string match params switched. it should be [string match pattern string] and it seems you have [string match string pattern]
also change msg to msg* in your pattern
\\//_
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Fri Feb 20, 2004 3:35 pm
Instead of using two "string tolower" in a "string match" better use "string equal -nocase" directly. Example:
if {[string equal -nocase $foo $bar]} { # do something }
Once the game is over, the king and the pawn go back in the same box.
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Fri Feb 20, 2004 4:05 pm
Except he's trying to do wildcard matching, so string equal won't work.
Commy, the other problem is that it sounds like you want to match the proc name (msg_*) but the code currently matches bind type (msg, msgm, pub, etc). So you have two things to change.
CoMMy
Halfop
Posts: 99 Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus
Post
by CoMMy » Fri Feb 20, 2004 6:29 pm
Thanks for that stdragon. I missed it. but code still doesnt work.
It doesnt give out any errors but it doesnt unbind!!!
this is what we have.
Code: Select all
foreach binding [binds] {
set bindtype [lindex $binding 0]
set bindattr [lindex $binding 1]
set bindname [lindex $binding 2]
set bindhits [lindex $binding 3]
set bindproc [lindex $binding 4]
if {[string match [string tolower $bindproc] [string tolower msg_*]]} {
unbind $bindtype $bindattr $bindname $bindproc }}
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Fri Feb 20, 2004 6:53 pm
That was one thing to change, the other is what Cucumber said hehe. You have your arguments mixed up for string match.
CoMMy
Halfop
Posts: 99 Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus
Post
by CoMMy » Sat Feb 21, 2004 9:59 am
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!