• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

String Comparison that isn't case sensitive.

Status
Not open for further replies.
Level 13
Joined
Jan 4, 2014
Messages
556
I want a comparison trigger that checks a player's name, but doesn't look if the letters are capitalized or not.


So far this is what i got. It only works if my name is WorldEdit, but if my name is worldedit than it does not work :(
WZD6YGf.png
 
Level 10
Joined
Apr 4, 2010
Messages
509
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Name of (Owner of (Triggering unit))) Equal to WorldEdit
        • (Name of (Owner of (Triggering unit))) Equal to (String(WorldEdit) as Lower case)
or you can just convert it to lowercase.
  • Strings
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Name = (Name of (Owner of (Triggering unit)))
      • Set Name = (String(Name) as Lower case)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Name Equal to worldedit
        • Then - Actions
          • Game - Display to (All players) the text: Works
        • Else - Actions
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
-_- nice try DEE-BOO, but not really what he asked for.

Anyway, what DB said was almost correct.
However, you should change the name of the player to lower case.
In that way, you can check if the lower case string of <myName> is equal to "worldedit"
In that case, "WorldEdit", "worldedit", "WORLDEDIT", "worldEdit", "Worldedit", "WoRlDeDiT", "wOrLdEdIt", etc would all be true.

On the other hand, when you compare it to "WorldEdit", it would always return false cause the player name that you compare it to will never have capital letters.
So unless your "worldedit" will be a static string, you should make that one to lower case as well.
 
Status
Not open for further replies.
Top