What is the problem?
The function HasTextBeenTyped defined in the EE2 Scripting.doc doesn't seem to work with the given example:
Code: Select all
// bool HasTextBeenTyped( const char *in_szText) // Check and see if the specified text has been typed into // the chat box during the current game. Note that this check // is case insensitive. Therefore if you are checking for "BAR" // and "bar" had been typed into the chat box, true would be // returned. // Example: // is steve rocking? if( HasTextBeenTyped("steve is rocking") ) then playSomeRockingMusic
Cause of the problem
In EE2, around address: "0079FFBD" it pushes a string that doesn't start with the actual message string, but has got the ending of the formatted player color...
I decided that it's not worth to fix this function with Unofficial Patch 1.5, as it requires assembling, and other things related to testing / documentation / update release.
It's already possible to use the following solution in order to be able to use this function.
For example, we want an action to be triggered on message: "sex"
Instead of using "sex", we need to add some strange characters before the actual string:
Download an .IES script:
I can't put those characters in the forum post, that's why I attached an example .IES file.
Please use Notepad++ (or some other text editor that supports displaying of control characters).
The PERIODICITY and INSTANT (without specified ONESHOT or PERIODICITY) are being executed multiple times, for a few seconds after message was sent.
To fix it, we would need to save the current elapsed game time to a variable, and check check if it's greater than variable + X seconds.