Condition: string contains substring?

Tru_Power22

You can change this now in User CP.
Reaction score
144
No, just use the event

Player types "your message" as a substring. Should get you what you want.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
From here: http://www.thehelper.net/forums/showthread.php?t=102161

JASS:
function StringContainsString takes string str, string partial returns boolean
    //Returns true if the full string is contained inside.  Capitalization matters!
    local integer i = 0
    local integer l = StringLength(partial)
    local integer l2 = StringLength(str)
    loop
        exitwhen i > l2
        if SubString(str,i,i+l) == partial then
            return true
        endif
        set i = i + 1
    endloop
    return false
endfunction


Trigger:
  • Custom Script: set udg_TempBool = StringContainsString(String,SubString)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • TempBool equal to true
      • Then - Actions
        • -------- String does contain SubString --------
      • Else - Actions
        • -------- String does not contain SubString --------


This is written without the editor, so it may not be word for word.

You just need to copy the function into the map header, or into a vJass library.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top