Jump to content

Can't find a script that animates avatar on touch of a HUD button


Galatheus
 Share

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

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

Recommended Posts

You'd think there is, but why can't I find a script on MP that animates our avi on touch of a button.  I want to make a hud that triggers the animation inside another object, that's it no menu, just a HUD button that triggers the animation inside a wearable object, anyone?

Edited by Galatheus
  • Like 1
Link to comment
Share on other sites

this should work,

enjoy


integer anim_status;

default
{
    state_entry()
    {
    }
    
    on_rez(integer start_param)
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    }
    touch_start(integer detected)
    {
        if (anim_status)
        {
            llStopAnimation("sit");
            anim_status = 0;
        }
        else
        {
            llStartAnimation("sit");
            anim_status = 1;
        }
    }
    run_time_permissions(integer perm)
    {
        if (perm & PERMISSION_TRIGGER_ANIMATION)
        {
            return;
        }
    }
}

regards,

Dargo

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

And to prevent any script errors...

integer anim_status;

default
{    
    on_rez(integer start_param)
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    }
    touch_start(integer detected)
    {
        if (llGetPermissionsKey() == NULL_KEY)
        {
            return;
        }

        if (anim_status)
        {
            llStopAnimation("sit");
            anim_status = 0;
        }
        else
        {
            llStartAnimation("sit");
            anim_status = 1;
        }
    }
}

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

7 hours ago, Galatheus said:

 I want to make a hud that triggers the animation inside another object, that's it no menu, just a HUD button that triggers the animation inside a wearable object, anyone?

two scripts are needed for this

1) HUD script that knows about the animation(s) in the other worn object
2) Animate script in the other worn object that contains the animation and holds the wearer's permissions

the Animate script listens for a message from the HUD

http://wiki.secondlife.com/wiki/Listen


pcode basics example for same owner of HUD and other worn object

// HUD script

integer CHANNEL = -161616;  // some channel number

touch_start(...)
{
    llWhisper(CHANNEL, "Name of animation");
}


// Animate script

state_entry
{
    llListen(CHANNEL, "", llGetOwner(), "");
    
    ... request owner permissions ...
}

listen (..., string text, ...)
{
   // check that script has permission
   if (llGetPermissionsKey() == llGetOwner())   
   {   
      // check that 'text' is an animation in Contents
      if (llGetInventoryType(text) == INVENTORY_ANIMATION) 
      {
         llStartAnimation(text);
        
         ... stop any previous started animation ...
      }
   } 
}

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1554 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...