01-20-2009 13:18
Typing override support is nothing new in AOs, but I've added it to the (free) ZHAO-II release. Find it at:

http://slurl.com/secondlife/Azzurra%20Meadows/38/84/33

Here's the runtime critical code, that gets called 4 times a second:

CODE
    if (typingOverride) {
// Typing override is on. Is it configured?
string typingAnim = llList2String(overrides, typingIndex);
if (typingAnim != EMPTY) {

// Typing override is configured. Find out whether we're typing.
integer isTyping = (llGetAgentInfo(Owner) & AGENT_TYPING);

// Did this just change?
if (isTyping != wasTyping) {

// Yes, start or stop the override anim
if (isTyping) {
llStartAnimation(typingAnim);
} else {
llStopAnimation(typingAnim);
}
wasTyping = isTyping;
}
}
}


The idea is minimum impact if it's not configured or enabled (and if it's not configured, it won't be enabled unless the user turns it on and leaves it on). Also, to minimize impact when there's no change in status.

Testing showed that it's 6 times faster to use llGetAgentInfo() than to interrogate the anim list looking for the typing animation (big surprise). So, I used that here and also changed it in the timer code that also runs 4 times per second. (Using a global, I could save one call to llGetAgentInfo() per quarter second, but I didn't do that.)

Comments?

Also, please try it out and see if there are any problems.

Oh, I also added an indicator to show if the sit override is disabled (menu button goes yellow). I like being able to see that clearly, and missed it from the original ZHAO, though I prefer the new one in every other way.