[Solved] Multiple chat message recognition within a single trigger

Level 12
Joined
Jul 5, 2014
Messages
551
Assuming this is the event.

  • Player - Player 1 (Red) types a chat message containing left as An exact match
  • Player - Player 1 (Red) types a chat message containing right as An exact match
Is it possible to recognize the two message individually within a single trigger without creating more triggers? So the result would be something like this:

  • Player - Player 1 (Red) types a chat message containing left as An exact match
  • Game - Display to (All players) the text: You said left.
  • Player - Player 1 (Red) types a chat message containing right as An exact match
  • Game - Display to (All players) the text: You said right.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
It's a sub... string. A smaller string that was part of a bigger one. It helps if you read the action descriptions:
run.png
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Multiple Events can be registered to the same trigger:
  • Events
    • Player - Player 1 (Red) types a chat message containing left as An exact match
    • Player - Player 1 (Red) types a chat message containing right as An exact match
  • Conditions
  • Actions
    • Set Variable Str = (Entered chat string)
    • If all conditions are true then do (Actions)
      • If - Conditions
        • Str Equal to left
      • Then - Actions
        • -------- P1 typed "left" --------
      • Else - Actions
    • If all conditions are true then do (Actions)
      • If - Conditions
        • Str Equal to right
      • Then - Actions
        • -------- P1 typed "right" --------
      • Else - Actions
The Actions will run the moment any of the Events occur.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Multiple Events can be registered to the same trigger:
  • Events
    • Player - Player 1 (Red) types a chat message containing left as An exact match
    • Player - Player 1 (Red) types a chat message containing right as An exact match
  • Conditions
  • Actions
    • Set Variable Str = (Entered chat string)
    • If all conditions are true then do (Actions)
      • If - Conditions
        • Str Equal to left
      • Then - Actions
        • -------- P1 typed "left" --------
      • Else - Actions
    • If all conditions are true then do (Actions)
      • If - Conditions
        • Str Equal to right
      • Then - Actions
        • -------- P1 typed "right" --------
      • Else - Actions
The Actions will run when one or the other happens.
Yes, Pyrogasm mentioned the chat id condition. What's the idea behind using a variable, rather than just using the condition?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Yes, Pyrogasm mentioned the chat id condition. What's the idea behind using a variable, rather than just using the condition?
Micro optimization, it also just makes things easier if you expand the trigger.

Then you would drag the second ITE into the Else - Actions of the first ITE since these two things are mutually exclusive.

But these types of optimizations aren't going to make or break anything - unless your trigger does some crazy heavy task.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Micro optimization, it also just makes things easier if you expand the trigger.

Then you would drag the second ITE into the Else - Actions of the first ITE since these two things are mutually exclusive.

But these types of optimizations aren't going to make or break anything - unless your trigger does some crazy heavy task.
I don't see the difference. It requires typing in the wanted chat message, same as giving the condition simply "entered chat string". What exactly it makes easier?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I don't see the difference. It requires typing in the wanted chat message, same as giving the condition simply "entered chat string". What exactly it makes easier?
It's more efficient which is what I really care about. A variable look-up is faster than calling a function to retrieve a variable.

But I personally find it easier to browse through my variables instead of a list of functions. I often only have a couple of String variables.

Variables in general make things easier.
 
Top