TriggerAddEventChatMessage
void TriggerAddEventChatMessage (trigger t, int player, string capture, bool strict);
Register a trigger that will be executed on Chat Messages
Parameters
- trigger t
The trigger that will be executed. Must have the following prototype:
bool name(bool checkConds, bool doActions);
- checkConds : always true?
- doActions : always true?
- The return value is used to increment either FailedConditions (when false) or Run in the debug trigger window
- int player
The number of the player
- string capture
The string you want to capture. This is case insensitive.
- bool strict
- true: The chat message has to be exactly the capture string
- false : The string to capture is a substring of the chat message
Examples
- Example: Repeat Trigger
// Define the trigger function bool TriggerRepeat (bool checkConds, bool doActions) { // Repeat what you said UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringToText(EventChatMessage(false))); return true; } // Create a new trigger based off the function trigger t = TriggerCreate("TriggerRepeat"); // Bind it to the Chat Message event TriggerAddEventChatMessage(t, 1, "repeat", false); // Whenever the player 1 will say something that contains the word "repeat" // It is going to call the trigger and repeat what he just said.
- 1 comment
- 1 comment
- Reply
- #1
vjeux Thu, 04 Mar 2010 17:04:11This is used that way in the Blizzard AI code (MeleeAI.galaxy)
When the player 1 says "waves 1" it will call DebugMelee(1)