Jump to content

Hide/show prims with menu


Suki Hirano
 Share

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

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

Recommended Posts

I was wondering if there is an open source script somewhere that includes a simple touch menu that hides/shows certain prims in a multi-prim object. For instance I click the object, then given a few choices in a menu like "hide all green", "hide all red", "hide all", "show all", "show all green", "show all red", etc, according to the object's description parameter, or some linkset identification number. I know I can insert a copy of the script into each prim but I heard that would be redundant and memory-heavy. And this only works if the owner touches the object of course.

I'm new to scripting so I only got the hide/show part understood. (Source: marketplace script, I made some minor mods)

 

string showCommand = "show";
string hideCommand = "hide";
integer channel = 9;
integer time = 0;
integer swithToPhantom = TRUE;

default
{
    state_entry()
    {
        llListen(channel,"",llGetOwner(),"");
        llSetStatus(STATUS_PHANTOM,swithToPhantom);
        llSetTimerEvent(time);
    }

    listen(integer channel, string name, key id, string msg)
    {
        if (msg == showCommand)
        {
            llSetAlpha(1,ALL_SIDES);
            llSetTimerEvent(time);
           
        }
        
        if (msg == hideCommand)
        {
            llSetAlpha(0,ALL_SIDES);
        }
    }
    timer()
    {
        llSetAlpha(0,ALL_SIDES);
    }
    on_rez(integer start_param)
    {
        llResetScript();
    }
        
        
}

 

If you have some time and would like to help me with this please IM me inworld or post here.

Thanks.

Link to comment
Share on other sites

Basically, what you'll want to do is name each of the prims in your structure according to their color si that you have a flock of prims named "green" and another flock named "red" and so forth.  Then your menu choice to turn all the green ones transparent could look something like

if (msg == "green off"){    integer i = llGetNumberOfPrims();    while(i)    {        if (llGetLinkName(i) == "green")        {            llSetLinkAlpha(i, 0.0, ALL_SIDES);        }        --i;    }}

 There are other ways to accomplish the same thing, and there are ways to compress the menu choices into a more elegant structure, but that's the basic idea.  Once you have named each set of distinctly-colored prims, you use a mechanism like that to target the set and turn it ON or OFF.

 

Link to comment
Share on other sites

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