Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple Typing Animation Killer

Solomon Devoix
Used Register
Join date: 22 Aug 2006
Posts: 496
04-11-2007 15:39
I've seen a lot of requests for something to kill the "typing on a keyboard" animation an avatar enters when you start typing something. The usual answer, and probably the best one, is to use an animation with a higher priority than the typing one to override the default typing action.

The only problem with this is there are a few situations where you don't want to, or can't, use another animation, but still want to get rid of the typing animation. One that comes to mind for me is when you want to use a poseball that has an animation in it you like but didn't create... and it doesn't have the priority set so that it overrides the typing animation. In that case, you can't really add a higher-priority animation to override the typing animation without also overriding the animation you WANT to be using.

The script below isn't a perfect solution by any means, but it will get the job done. The main way that it isn't a perfect solution is that your avatar will start to make the typing action, then go back to whatever animation WAS playing. It's usually just the bare beginning... as if starting to reach for the invisible keyboard... but if you can live with that, this is a way to kill the typing animation without having to use another animation instead.

This script can be dropped into an item that you wear as an attachment, or can be put into something on which you're going to be sitting, like a poseball that already contains a poseball script an an animation.

As noted in the comments, the 'llAvatarOnSitTarget' command won't give you the key of the avatar sitting on an object (necessary to stop the typing animation) unless the object's sit target has been set. This won't matter if you're using it in an attachment, and if you're putting it into something like a poseball, odds are very good the sit target has already been set. If if you continue to make the typing motions while sitting on an object containing this script, uncomment the 'llSitTarget' command in the 'state_entry' event and re-save the script. It offsets the Z part of the position by just a tiny bit, but it's enough to make 'llAvatarOnSitTarget' work properly. I reccomend you ONLY uncomment that line in the case I just outlined, otherwise you stand a good chance at overriding the sit target set up by the poseball script or whatever, and messing up the positioning of the animation.

CODE

// Simple typing animation killer
//
// By Solomon Devoix
//
// Just put this script into an object you wear (perhaps one of those
// popular 'multitool' attachments) or put it into an objec on which
// you'll sit, like a poseball, that already has an animation in it
// that isn't properly overriding the typing animation.
//
// The usual behavior is that the avatar will START to make the typing
// motion, but immediately stop. So this ISN'T a perfect solution, but
// if you don't want to (or can't) use an animation that will override
// the typing animation, this may do the trick for you.
//
// Note: The 'llAvatarOnSitTarget' command in the 'changed' event will
// only report the key of the avatar sitting on the object if the
// object has had its sit target set. This doesn't matter if this
// script is in an attachment you're wearing, and if you're putting
// it into something like a poseball, odds are VERY good the sit
// target HAS been set already. But if you sit on an object containing
// this script and just keep right on typing, try un-commenting the
// 'llSitTarget' command in the 'state_entry' event, resaving the
// script, and trying it again.


key avatar = NULL_KEY;

default
{
state_entry()
{
// llSitTarget(<0.0,0.0,0.01>,ZERO_ROTATION);
}

attach(key attached)
{
if (attached)
{
avatar = attached;
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
}
else
{
llResetScript();
}
}

changed(integer change)
{
if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if (agent)
{
avatar = agent;
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
}
else
{
llResetScript();
}
}
}

timer()
{
if( ( llGetAgentInfo( avatar ) & AGENT_TYPING ))
{
llStopAnimation( "type" ) ;
}
}

run_time_permissions(integer perm)
{
if ( perm & PERMISSION_TRIGGER_ANIMATION )
{
llSetTimerEvent(0.1);
}
}
}
Solomon Devoix
Used Register
Join date: 22 Aug 2006
Posts: 496
04-12-2007 11:24
Follow-up: in case you don't want to drop the script into an item yourself, I've put this up on SLX as a freebie attachment; just wear it and you're good to go. :)