|
Saffrah Keen
Registered User
Join date: 19 Apr 2006
Posts: 3
|
05-06-2006 11:41
this question has probobly been asked already but just cant find it in this forum.
you see i have created and uploaded an animation and want to make it to where it plays only when im am flying. but i have looked everywhere:
the lsl wiki al the tutorials, sample scipts and live help and can't find any thing the tutorials just refer me to another tutorial that only refurs me to yet another to tutorial and i just wind up chaseing my tail.
so what i am asking for is just as script the in the scipting language says "ok take this animation and make it play when you r avatar flies" NOT a reference to go to somwhere else. so if you could post a cpoy of the scipt somewhere on this forum or send i to my user i would be greatful. and if it turns out sucsessful then i will give you a free copy of the avatar once i have made it. oh and if you send me a scipt through second life make sure i can edit it.
thanks a lot, Saffrah Keen
|
|
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
|
05-06-2006 13:00
integer g_isflying = FALSE ; integer g_hasperms = FALSE ;
string g_my_anim = "" ; // Your animation name goes here!
key g_user ;
default { attach( key id ) { g_user = id ; // Am I attached to someone? if( id != NULL_KEY ) { // Ask permission to animate them! llRequestPermissions( id, PERMISSION_TRIGGER_ANIMATION ) ; } // Otherwise I'm being detached... else if( g_hasperms ) { // Stop animating! llStopAnimation( g_my_anim ) ; // No longer has permissions. g_hasperms = FALSE ; // No longer flying. g_isflying = FALSE ; } } run_time_permissions( integer perms ) { // I have permission! g_hasperms = TRUE ; // Start checking for flying status. llSetTimerEvent( 1.0 ) ; } timer() { // If the agent is flying, and I don't already know they're flying... if( ( llGetAgentInfo( g_user ) & AGENT_FLYING ) && !g_isflying ) { // I'm flying! g_isflying = TRUE ; // Stop the normal flying anim. llStopAnimation( "fly" ) ; // Start my own animation. llStartAnimation( g_my_anim ) ; } // if the agent is NOT flying, and I don't already know they're not flying... else if( !( llGetAgentInfo( g_user ) & AGENT_FLYING ) && g_isflying ) { // I'm not flying. :( g_isflying = FALSE ; // Stop my own animation. llStopAnimation( g_my_anim ) ; } } }
_____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
|
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
05-08-2006 16:45
else if( g_hasperms ) { // Stop animating! llStopAnimation( g_my_anim ) ;
You need to check llGetPermissions() here, because permissions may be withdrawn by the detach as they recently started being withdrawn by an unsit. run_time_permissions( integer perms ) { // I have permission! g_hasperms = TRUE ;
You need to check perms here, because run_time_permissions may be called when you don't have permissions yet. I know they recently changed this back, but changing it back has caused other problems. Don't assume you have permissions unless you actually check the bitmap. Also, it's worthwhile to take controls, and check for flying status on CONTROL_UP. Not only does this give you another check and quicker response, but holding a control will keep you running in a NO SCRIPT parcel.
|