- Joined
- Dec 24, 2018
- Messages
- 3,541
- SL Rez
- 2006
- Joined SLU
- Back in the day.
- SLU Posts
- 0
I've had the problem of furniture and pose stands stopping all animations which freezes my wings and makes my face go squinty, so I made a little script to restart the animations after unsitting.
It also includes "blink" and "typing" for Bento heads (I'm using a freebie head that was un-animated)
As usual, I 'll take any suggestions for improving/bugfixing.
A later version may actually check to see what anims are playing and restart them so I can keep the same facial expression -- this is a stopgap.
It also includes "blink" and "typing" for Bento heads (I'm using a freebie head that was un-animated)
As usual, I 'll take any suggestions for improving/bugfixing.
A later version may actually check to see what anims are playing and restart them so I can keep the same facial expression -- this is a stopgap.
Code:
//For Bento wings/ears/head/whatever that get "stuck" after unsitting
//in this example, the first is for my head and the second is for wings
//my tail didn't need to be added as it has it's own sit recognition
list default_anims = ["F0001_NOMAN","Mid Anim"];
//talking anim for Bento head
//AO's generally handle hand moving talking
string typing_anim = "F3004_TALK";
//Blink anim for Bento head, this shold be a run-once anim, NOT looped.
//Blinking is every 5-10s
string blink_anim = "F9117_BLINK";
integer IsTyping;
integer IsSitting;
integer counter;
integer blinktime;
key Owner;
default
{
state_entry()
{
blinktime = 300*llRound(llFrand(5.0)+5.0);
Owner=llGetOwner();
IsTyping = FALSE;
IsSitting = FALSE;
llRequestPermissions(Owner,PERMISSION_TRIGGER_ANIMATION);
}
on_rez(integer R)
{
llResetScript();
}
run_time_permissions(integer P)
{
if(P & PERMISSION_TRIGGER_ANIMATION)
{
llSetTimerEvent(0.2);
}
else
{
llSetTimerEvent(0.0);
}
}
timer()
{
integer Check = llGetAgentInfo(Owner);
if(Check & AGENT_TYPING)
{
llStopAnimation("c541c47f-e0c0-058b-ad1a-d6ae3a4584d9");
if(!IsTyping)
{
IsTyping = TRUE;
llStartAnimation(typing_anim);
}
}
else
{
if(IsTyping)
{
IsTyping = FALSE;
llStopAnimation(typing_anim);
}
}
++counter;
if(counter > blinktime)
{
llStartAnimation(blink_anim);
blinktime = 300*llRound(llFrand(5.0)+5.0);
counter = 0;
}
if(Check & AGENT_SITTING)
{
if(!IsSitting)
{
IsSitting = TRUE;
}
}
else
{
if(IsSitting)
{
IsSitting = FALSE;
llSleep(0.3);
integer N = llGetListLength(default_anims);
integer C;
for(C=0;C<N;++C)
{
llStartAnimation(llList2String(default_anims,C));
}
}
}
}
}