• 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.

[Trigger] How do you make it so if two different words are said in a chat message

Status
Not open for further replies.
Level 5
Joined
Aug 18, 2013
Messages
85
Let's say someone says "look at girl".

How do I make it so a trigger detects if someone said something that contains both "look" and "girl"

so that "look girl" and "look at girl" would both work it is possible?


I can't seem to get it to work even when I just want one phrase to be the activator of the trigger. I always have to write the specific message in game.

Like if "gordon freeman is cool" is typed nothing happens. when the activator is "gordon" I have to type "gordon" for it to work

please help
 

Rheiko

Spell Reviewer
Level 25
Joined
Aug 27, 2013
Messages
4,121
lol, no
  • Girl
  • Events
    • Player - Player 1 (Red) types a chat message containing look as A substring
  • Conditions
    • (Substring((Entered chat string), 1, 5)) Equal to look
  • Actions
    • Game - Display to (All players) the text: (Substring((Entered chat string), 6, 13))
Look at girl
the activation word is look, the rest is at girl
so the one which will be displayed is at girl (6,13)
count all letter and space
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
lol, no
  • Girl
  • Events
    • Player - Player 1 (Red) types a chat message containing look as A substring
  • Conditions
    • (Substring((Entered chat string), 1, 5)) Equal to look
  • Actions
    • Game - Display to (All players) the text: (Substring((Entered chat string), 6, 13))
Look at girl
the activation word is look, the rest is at girl
so the one which will be displayed is at girl (6,13)
count all letter and space

the white color... it burns smeagul's eyeballs

anyway, what the OP is looking for is a regex compiler which can't be done in GUI, probably not even JASS. The trigger quoted will work for the initial "look". if you want different lookats (girl, boy, dog, etc.) than you can do like

  • if (Substring((Entered chat string), 6, Length of (Entered Chat String)) is equal to "at girl" then
  • ... do stuff
  • else if (blah) is equal to "at boy" then
  • ... do stiff
(excuse my psuedogui syntax)
 
Example:

  • keywords
    • Ereignisse
      • Spieler - Spieler 1 (Rot) types a chat message containing look as Ein Teil-String
      • Spieler - Spieler 1 (Rot) types a chat message containing girl as Ein Teil-String
    • Bedingungen
    • Aktionen
      • Set Player = (Triggering player)
      • Set Real = (Real + 1.00)
      • Wait 0.00 seconds
      • Set Real = (Real - 1.00)

  • execution
    • Ereignisse
      • Spiel - Real becomes Gleich 2.00
    • Bedingungen
    • Aktionen
      • Spiel - Display to (All players) for 30.00 seconds the text: (Name of Player)


Idk, maybe it will help you.
 
Last edited:
Level 12
Joined
Oct 16, 2010
Messages
680
  • Untitled Trigger 003
    • Events
      • Player - Player 1 (Red) types a chat message containing girl as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 4)) Equal to look
    • Actions
this will work for "lookgirl" , "look girl" , "look that cvazy girl maaan" and anything that contains "girl" and starts with "look".
 

Rheiko

Spell Reviewer
Level 25
Joined
Aug 27, 2013
Messages
4,121
actually this is work just same, but you just need to change it
  • Girl
  • Events
    • Player - Player 1 (Red) types a chat message containing look as A substring
  • Conditions
    • (Substring((Entered chat string), 1, 5)) Equal to look
  • Actions
    • Game - Display to (All players) the text: (Substring((Entered chat string), 6, Length of (Entered Chat String))))
it will show the words after "look" and "look" as the activation words
 
Status
Not open for further replies.
Top