Shuangli Zhangsun
Registered User
Join date: 14 Oct 2008
Posts: 8
|
01-09-2009 07:14
hello world!
i was send here for my request : )
i want to add facial expressions to some posaballs. I learned i must use the build-in animations from sl, and that they can be triggered by a script in sl. Im searching such a script.
something like that just as real sl-script:
(
start: onsit start expression: express_tongue_out loop expression sec: 5.0 stop: unsit
)
can someone help me?
Shuangli
|
Lily Cicerone
Registered User
Join date: 25 Jan 2007
Posts: 30
|
01-14-2009 14:27
Hm... Ok, I'm stranded in a computer lab for a while, so I'll take a minute to write this for you. I don't have an LSL compiler on hand to test, but your code will probably look something like this:
string gAnim = "express_tongue_out"; float gAnimLoop = 5.0; key gSitting;
default { state_entry () { llSitTarget ( < 0.0, 0.0, 0.1 >, ZERO_ROTATION ); }
changed ( integer change ) { if ( change & CHANGED_LINK ) { gSitting = llAvatarOnSitTarget ();
if ( gSitting ) { llRequestPermissions ( gSitting, PERMISSION_TRIGGER_ANIMATION ); }
else { llSetTimerEvent ( 0.0 ); } } }
run_time_permissions ( integer perm ) { if ( perm & PERMISSION_TRIGGER_ANIMATION ) { llStopAnimation ( "sit" ); // Override the default sitting animation llStartAnimation ( gAnim ); llSetTimerEvent ( 5.0 ); } }
timer () { integer perm = llGetPermissions (); if ( perm & PERMISSION_TRIGGER_ANIMATIONS ) { llStartAnimation ( gAnim ); } } }
Someone may want to check this for bugs, but that should give you the basic idea, anyway. If someone sits on the prim, it requests animation permissions, the script should automatically grant permissions, at which point the default sit animation will be halted and the expression animation will begin. The script sets a timer to trigger the same animation every 5.0 seconds or until the avatar stands up, at which point the timer will halt.
|