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.
Yoda
Halfop
Posts: 78 Joined: Thu Oct 24, 2002 2:57 am
Location: Milano, Italy
Contact:
Post
by Yoda » Sat May 17, 2003 10:23 am
hi,
I have a very stupid problem but I dont know how resolve it
in this way bot detect only if the nick is Yoda, but how get that bot detect not case sensitive?
I tried with != and works as non sensitive but bot continue to repete the message asked by procedure. what instead of == ?
thanks for help
Yoda
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Sat May 17, 2003 10:31 am
This is a basic form of matching, also known as explicit matching.
There are several ways to use non-explicit and explicit matching, in a non-case sensitive way.
Some inlclude converting both the matching text, and the incoming text to lower case.
Others involved non-case sensitive commands.
Here are a few.
Code: Select all
set a "Hello"
set b "heLLo"
# Exlicit
if {$a == $b} {}
# Non-sensitive
if {[string tolower $a] == [string tolower $b]} {}
if {[string equal -nocase $a $b]} {}
Yoda
Halfop
Posts: 78 Joined: Thu Oct 24, 2002 2:57 am
Location: Milano, Italy
Contact:
Post
by Yoda » Sat May 17, 2003 11:24 am
thanks for rush answer. my problem:
Code: Select all
if {$nick == "yoda"} {
putmsg $chan "4,0 Yoda wecome"
}
I would like to join with Yoda, yoda, YOda, YODa, YODA and the script detect me. with the script above I am detected only if I join with yoda, if I join with Yoda nothing happen. can you say me what I have exatly to add?
Yoda
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Sat May 17, 2003 11:38 am
Use string tolower or strlwr (wich is the same thing but with a shorter name) then. eg:
Code: Select all
if {[strlwr $nick] == "yoda"} {
bla
}
You should pay more attention to what ppslim sugested you before me.
Once the game is over, the king and the pawn go back in the same box.
Yoda
Halfop
Posts: 78 Joined: Thu Oct 24, 2002 2:57 am
Location: Milano, Italy
Contact:
Post
by Yoda » Sat May 17, 2003 1:42 pm
thanks alot and sorry, now I have understood. I am not much practical one with tcl.
Yoda