header advt
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lindenblack - leftovers
#38
Code:
 
float timeout = 60.0;

key owner;

list animation_names;
list animation_buttons;
integer animations_count;
string animation;

integer listener;
integer page;

GetAnimations ()
{
    animation_names = [];
    animation_buttons = [];
    animations_count = llGetInventoryNumber (INVENTORY_ANIMATION);
    integer index = 0;
    while (index < animations_count)
    {
        string name = llGetInventoryName (INVENTORY_ANIMATION, index++);
        animation_buttons += llGetSubString (name, 0, 23);
        animation_names += name;
    }
}

Menu ()
{
    if (animations_count)
    {
        string text = "\n" + llList2String (["Currently playing \"" + animation + "\"\n\n", "" ], animation == "") + "Select an animation:";
        list buttons;
        integer start = 0;
        integer end = ~-animations_count;
        if (animations_count > 9)
        {
            integer pages = end / 7;
            if (page < 0) page = pages;
            else if (page > pages) page = 0;
            if (page == pages) start = animations_count - 7;
            else end = (start = page * 7) + 6;
            buttons = ["<<"] + llListInsertList (llList2List (animation_buttons, start, end), (list) ">>", 1);
            text += "\n\n(" + (string) (-~start) + " to " + (string) (-~end) + " of " + (string) animations_count + ", page " + (string) (-~page) + " of " + (string) (-~pages) + ")";
        }
        else buttons = llList2List (animation_buttons, start, end);
        llDialog (owner, text, ["END", llList2String (["STOP", " "], animation == ""), " "] + buttons, StartDialog ());
    }
    else llDialog (owner, "\nNo animations found.", ["END"], StartDialog ());
}

integer StartDialog ()
{
    integer channel;
    listener = llListen (channel = (integer) llFrand (-1999000001.0) - 1000000, "", owner, "");
    llSetTimerEvent (timeout);
    return channel;
}

EndDialog ()
{
    llSetTimerEvent (0.0);
    llListenRemove (listener);
}

StartAnimation (integer index)
{
    StopAnimation ();
    llStartAnimation (animation = llList2String (animation_names, index));
}

StopAnimation ()
{
    if (animation)
    {
        llStopAnimation (animation);
        animation = "";
    }
}

default
{
    state_entry ()
    {
        owner = llGetOwner ();
        GetAnimations ();
        if (llGetAttached ()) llRequestPermissions (owner, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
    }
    attach (key id)
    {
        if (id) llRequestPermissions (id, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
    }
    run_time_permissions (integer permissions)
    {
        if (!(permissions & PERMISSION_TRIGGER_ANIMATION))
        {
            llPlaySound ("d5567c52-b78d-f78f-bcb1-605701b3af24", 1.0);
            llOwnerSay ("You must give permission for this " + llGetObjectName () + " to animate your avatar for it to work!");
            llResetScript ();
        }
        if (permissions & PERMISSION_TAKE_CONTROLS) llTakeControls (CONTROL_ML_LBUTTON, FALSE, TRUE);
    }
    changed (integer change)
    {
        if (change & CHANGED_INVENTORY) GetAnimations ();
        else if (change & CHANGED_OWNER) llResetScript ();
    }
    touch_end (integer count)
    {
        EndDialog ();
        Menu ();
    }
    listen (integer channel, string name, key id, string message)
    {
        EndDialog ();
        if (message != "END")
        {
            integer index;
            if (~(index = llListFindList (animation_buttons, (list) message))) StartAnimation (index);
            else if (message == "STOP") StopAnimation ();
            else if (message == "<<") --page;
            else if (message == ">>") ++page;
            Menu ();
        }
    }
    timer ()
    {
        EndDialog ();
        llPlaySound ("d5567c52-b78d-f78f-bcb1-605701b3af24", 1.0);
        llDialog (owner, "\n" + llGetObjectName () + " menu timeout.", ["END"], -1);
    }
}

that script goes inside the box

inside the box you put your animations

attach box as hud

when you touch the box a menu with animations will open

you can customize the hud box as you like

has many genres the package



cheers
Reply


Messages In This Thread
Lindenblack - leftovers - by LINDENBLACK - 10-02-2020, 12:24 AM
RE: TAKETOMI Y DURA HAIR FATPACK - by jagiwig920 - 10-02-2020, 01:07 AM
RE: TAKETOMI Y DURA HAIR FATPACK - by ..:: Cyra ::.. - 10-02-2020, 04:46 PM
RE: TAKETOMI Y DURA HAIR FATPACK - by Sad Box - 10-02-2020, 06:40 PM
RE: TAKETOMI Y DURA HAIR FATPACK - by jagiwig920 - 10-02-2020, 06:51 PM
RE: HUD FULL PERM script jammer & NPV Over Filler hud v 32 - by ..:: Cyra ::.. - 10-04-2020, 08:33 PM
HAIR DOUX - by LINDENBLACK - 10-05-2020, 01:39 AM
RE: HUD FULL PERM script jammer & NPV Over Filler hud v 32 - by ..:: Cyra ::.. - 10-05-2020, 06:36 PM
RE: *SCRIPT ENTREPRENEURS* Dance animation - by ..:: Cyra ::.. - 12-02-2020, 06:57 PM
RE: *SCRIPT ENTREPRENEURS* Dance animation - by LINDENBLACK - 12-02-2020, 10:51 PM
RE: HEAD SNOW RABBIT 3D MODEL RIGGED + UVMAPS - by ..:: Cyra ::.. - 12-08-2020, 09:24 PM
RE: HEAD SNOW RABBIT 3D MODEL RIGGED + UVMAPS - by ..:: Cyra ::.. - 12-09-2020, 06:54 PM
RE: HEAD SNOW RABBIT 3D MODEL RIGGED + UVMAPS - by ..:: Cyra ::.. - 12-09-2020, 09:49 PM
RE: HEAD SNOW RABBIT 3D MODEL RIGGED + UVMAPS - by ..:: Cyra ::.. - 12-09-2020, 10:55 PM
RE: TAKETOMI Y DURA HAIR FATPACK - by C.Nails - 12-13-2020, 03:56 AM
RE: HAIR DOUX - by C.Nails - 12-13-2020, 04:00 AM
hello all people. - by LindenNegro - 05-22-2021, 04:46 PM
RE: hello all people. - by nicod - 05-22-2021, 05:51 PM
RE: hello all people. - by ..:: Cyra ::.. - 05-22-2021, 08:31 PM
RE: hello all people. - by iRobot - 05-23-2021, 04:36 AM
RE: hello all people. - by Cointreau2000 - 05-23-2021, 12:39 PM
RE: hello all people. - by showbis - 05-24-2021, 03:05 PM
RE: hello all people. - by Dynamite - 05-25-2021, 05:29 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)
footer advt