Why would you want to spam retarded over and over again?
I tried it out, and the timing is a bit off... It sounded like it was saying "Target acRetreTarget acRetreTarget acRetreat!"
Also, the code is hella confusing.
Your keybind calls a toggle function (LSstatus), which calls the spam function (startLS).
You could replace that whole first function with the following key command:
Code: Select all
bindCommand(keyboard0, make, "numpad-", TO, "$LSstat = !$LSstat; startLS();");
Also, you should use incrementer operators, instead of addition. For instance, instead of $LSnum = $LSnum + 5; you could write $LSnum += 5;
And, instead of $LScount = $LScount + 1; you could write $LScount++;
In fact, you can combine those lines of code with the if statements that follow them... For instance,
if(2 < $LSnum += 5), and if(4 < $LScount++)
But more importantly, all of that (except the keybind code) is a waste of space, too, since you are using the LS count to count from 1 to 4 over and over again, and I think LSnum is supposed to toggle between 1 and 2.
So, what you should be using, instead of all of that crap, is the modulus operator.
For example:
Code: Select all
//Perrinoia's overhaul of check's Local Spam v1.0
//Opensource, freeware, annoying script, please don't use it around me.
EditActionMap("playMap.sae");
bindCommand(keyboard0, make, "numpad-", TO, "$retard = !$retard; retard(0);"); // Toggle built into keybind.
function retard(%i) // Counter passed locally instead of using global variables.
{
localMessage(getWord("retreat tgtacq", %i % 2)); // voice list is hard coded, using modulus of counter to cycle through the word list.
schedule("if($retard) retard("@ %i++ @");", 0.19); // Toggle check and counter incremented in the recursive scheduler, and the timing is fixed.
}
It just occured to me that different character voices have different audio durations for the same voice command... So thats probably why the timing was off...
I'm rewriting this to be a little more versatile, but it's going to take some research, because I need to come up with multiple phrases to test out to make sure it works, and I've gotta get the timing down right for each syllable...