Jump to content

Trying to combine animation scripts


ChaosRaine
 Share

You are about to reply to a thread that has been inactive for 3589 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have a script then animates a nearby avatar on touch and one the animates on attach. I want to run these in the same script, but I'm having trouble with the combo of permissions. Any ideas? Here's what I'm using

Animate on Touch

//Touch and get near avatars in a dialog menu.
//menu listener
integer listener;
integer sensorChannel;
// range and arc for the sensor
float range = 15.0;
float arc = PI;
list avatarsKeys;
list avatarsNames;
integer permissions;
menu(key user,integer channel,string title,list buttons)
{
    listener = llListen(channel,"","","");
    llDialog(user,title,buttons,channel);
    //remove listener if there's no activity in menu
    llSetTimerEvent(20.0);
}
integer randomNumber()
{
    return (integer)(llFrand(99999.0) * -1);
}
default
{
    touch_start(integer total_number)
    {
        //only owner can access the menu
        if (llDetectedKey(0) == llGetOwner())
        {
            llSensor("","",AGENT,range,arc);
        }
    }
    sensor(integer total_number)
    {
        integer i;
        key tempId;
        avatarsKeys = [];
        avatarsNames = [];
        i = 0;
        while ((i < total_number) && (i < 12))
        {
            tempId = llDetectedKey(i);
            avatarsKeys = avatarsKeys + tempId;
            avatarsNames = avatarsNames + llKey2Name(tempId);
            i = i+1;
        }
        sensorChannel = randomNumber();
        menu(llGetOwner(),sensorChannel,"Select an avatar...",avatarsNames);
    }
    listen(integer channel,string name,key id,string message)
    {
        if (channel == sensorChannel)
        {
            integer pos = llListFindList(avatarsNames,[message]);
            if (pos > -1)
            {
//                llSay(0,message + "'s key is " + llList2String(avatarsKeys,pos));
        llRequestPermissions(llList2String(avatarsKeys,pos), PERMISSION_TRIGGER_ANIMATION );
            }
        }
    }
     run_time_permissions(integer permissions)
    {
        if (permissions & PERMISSION_TRIGGER_ANIMATION)
        {      
            llStartAnimation( llGetInventoryName(INVENTORY_ANIMATION, 0) );
         
        }
}
}

 

 

Animate on Attach

 

default
{
    state_entry() 
    {
        }
   
        attach(key attached)
    {
        if (attached != NULL_KEY)   
        { 
    
   
        llRequestPermissions( llGetOwner(), PERMISSION_TRIGGER_ANIMATION );
}

}
  
 run_time_permissions(integer permissions)
    {
        if (permissions & PERMISSION_TRIGGER_ANIMATION)
        {      
            llStartAnimation( llGetInventoryName( INVENTORY_ANIMATION, 0) );
         
        }
        else
        {
            llResetScript();
        }
    }
}

 

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3589 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...