Jump to content

Adding Animation menu to this script


Allison Lynagh
 Share

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

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

Recommended Posts

I came across the quick collar on the SL wiki, and I've done some edits to it personally for my own use (and added them to the discussion page here ). My question is, how can I go about adding a menu button to this script and having it read the animations in the inventory of the object?

Quick edit: This is done in lieu of heavier scripts, thus far the collar is just a single script, and the question was posed to me if the script couldn't be further modified to add animations as that is a huge reason why people wear collars in certain roleplay oriented places.

Link to comment
Share on other sites

You could mod this.   Added this bit as i just read your script. If it was me id ibe nclined to have this script stand alone. You can get the main script to message this one.

// Script Name: Texture_switcher_for_many_textures.lsl
// Author: Ferd Frederix
// texture switcher, menu driven, supports many many textures

// Downloaded from : http://www.free-lsl-scripts.com/cgi/freescripts.plx?ID=1194

// This program is free software; you can redistribute it and/or modify it.
// Additional Licenes may apply that prevent you from selling this code
// You must leave any author credits and any headers intact in any script you use or publish.
///////////////////////////////////////////////////////////////////////////////////////////////////
// If you don't like these restrictions and licenses, then don't use these scripts.
//////////////////////// ORIGINAL AUTHORS CODE BEGINS ////////////////////////////////////////////


// Texture switcher with many levels of menus
integer i = 0;
integer currentPos = 0;

integer listener;
integer MENU_CHANNEL ;

// opens menu channel and displays dialog
Dialog(key id)
{
    list MENU1 = [];

    // count the textures in the prim to see if we need pages
    integer c = llGetInventoryNumber(INVENTORY_TEXTURE);
    if (c <= 12)
    {
        for (i = 0; i < c; i++ ) {
            MENU1 += llGetInventoryName(INVENTORY_TEXTURE, i);
        }
    }
    else
    {
        for (i = 10 * currentPos; i < (10 + (10 * currentPos)) ; i++) {

            // check to make sure name <= 24, or else the menu will not work.
            string aname = llGetInventoryName(INVENTORY_TEXTURE, i);
            if ( llStringLength(aname) >24)
            {
                llOwnerSay("The texture  named " + aname + " has too long of a name to be used, please give it a shorter name <= 24 characters ");
            }
            else
            {
                if (i < c ) {
                    MENU1 += aname;
                }
            }
        }
        MENU1 += ">>";
        if (currentPos != 0)
            MENU1 += "<<";
        else
            MENU1 += "-";
    }


    MENU_CHANNEL = (integer) (llFrand(10000) + 10000);
    listener = llListen(MENU_CHANNEL, "", NULL_KEY, "");

    llDialog(id, "Select one object below: ", MENU1, MENU_CHANNEL);
}

default
{
    on_rez(integer num)
    {
        // reset scripts on rez
        llResetScript();
    }

    touch_start(integer total_number)
    {
        // display the dialog
        Dialog(llDetectedKey(0));
    }

    listen(integer channel, string name, key id, string message)
    {
        if (channel == MENU_CHANNEL)
        {
            llListenRemove(listener);
            if (message == ">>")
            {
                currentPos ++;
                Dialog(id);
            }
            else if (message == "<<")
            {
                currentPos--;
                if (currentPos < 0)
                    currentPos = 0;
                Dialog(id);
            }
            else
            {
                // display the texture from menu selection
                llSetTexture(message, ALL_SIDES);

            }
        }
    }
}




Link to comment
Share on other sites

list AnimList; list getInventoryList(){    list       result = [];    integer   n = llGetInventoryNumber(INVENTORY_ANIMATION);    while(n)     result = llGetInventoryName(INVENTORY_ANIMATION, --n) + result;     return result;}default{    state_entry()    {        AnimList = getInventoryList();    }    touch_start(integer total_number)    {       string temp = llDumpList2String(AnimList, "\n");

llSay(0,"Animations :\n" + temp);

} }

a menu button which, when touched says the anims in Inventory?

to actually use them you would need a dialog menu i think?

Link to comment
Share on other sites

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