Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This script only works with non-looped animations that have a known uuid.
- // Non-full perm animations will return NULL_KEY when checking with llGetInventoryKey in the inventory of an object and you can't copy the asset uuid from your own avatar inventory if the animation is not full perm.
- //There is however a workaround...
- // llGetAnimationsList will show uuids of all currently playing animations, even non full perm animations. By process of elimination you can match the uuid to the animation name.
- // The easiest way to match the uuid is take off all items on your avatar that would play animations (AOs, etc) so you have as few animations playing as possible and then run llOwnerSay(llList2CSV(llGetAnimationsList())) in a timer while playing the animation you want to match. Then try match the uuid to the animation name.
- // Once you have the correct uuids you can use the following script to play animations from a list randomly/consecutively without messing with sleeps:
- string current_animation;
- list animations = ["sipping sl","758547a2-7212-d533-43e3-1666eda1705e", "HX Pick Up Anim 1"," c9d0ef97-2c7b-4293-a197-f4f64e0eb5ec" ,"throw", "d292a068-1dd7-e97d-97c5-dab9dbc87775" ]; // these are example animations, replace with your own. Remember to add them to the contents of the object this script is in.
- // add an animation name and it's uuid as a pair to the list. You can get the uuid by right clicking it in your inventory (your inventory, not the object's inventory) and selecting copy asset uuid.
- integer i;
- integer len;
- integer switch;
- default
- {
- touch_end(integer i)
- {
- switch = !switch;
- if(switch) // switch on
- llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
- else // switch off
- {
- llSetTimerEvent(0.0);
- llStopAnimation(current_animation);
- }
- }
- run_time_permissions(integer perm) {
- if(perm & PERMISSION_TRIGGER_ANIMATION)
- {
- len = llGetListLength(animations);
- i = llRound(llFrand(len));
- if(i == len) i = i-1; // in case i is out of bounds
- // we need the name of the animation to play, not its uuid, so if frand lands on the uuid, just subtract 1 to get its name
- if(i % 2 == 1) // if i is odd
- i = i -1;
- current_animation = llList2String(animations,i);
- llStartAnimation(current_animation);
- llSetTimerEvent(1.0);
- }
- }
- timer()
- {
- list playing = llGetAnimationList(llGetPermissionsKey());
- // since llGetAnimationList returns keys of currently playing animations we need to check if the uuid of the current_animation we are playing is in the list
- // llOwnerSay(llList2CSV(playing));
- integer idx = llListFindList(playing,[llList2Key(animations, i + 1)]);
- if(idx == -1) // if current_animation is not in the list play the next animation in the animations list
- {
- i = llRound(llFrand(len));
- if(i == len) i = i-1; // in case i is out of bounds
- if(i % 2 == 1) // if i is odd
- i = i -1;
- current_animation = llList2String(animations,i);
- llStartAnimation(current_animation);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement