Jump to content

How Do I Set Certain Prims' Transparency?


Zadd Xonfor
 Share

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

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

Recommended Posts

Hello everyone,

 

I am new to scripting in Second Life. I simply have a linked object., I only want to change transparency in certain parts of the object.

 

Everything in the link I want transparent is named "Trans" and everything else is not named that. So how may I accomplish this?

Link to comment
Share on other sites

When I do this sort of thing, I prefer to build a list of the prims I want to change, using a user function, something like this:

list prims_to_change;integer max;find_prims(){    prims_to_change =[];      max = llGetNumberOfPrims();     while(max--){        string s = llToLower(llStringTrim(llGetLinkName(max),STRING_TRIM));        //turn it lower case and clean up leading and trailng spaces, to be on the safe side        if("trans"==s){//if it's the right description            prims_to_change+=[max];//add to the list        }    }}

 I call that in state_entry, on_rez,  if (change & CHANGED_LINK) and anywhere else that looks sensible.

Then at run time, I read the list of prims, like this:

 touch_start(integer total_number)    {       toggle=!toggle;       max = -llGetListLength(prims_to_change);      do{           llSetLinkAlpha(llList2Integer(prims_to_change,max),(float)(1-toggle),ALL_SIDES);        }      while(++max);           }

 While it doesn't make a big difference in a small linkset, I've found that if you've got a large linkset (complex jewellery, for example) it really does make a difference whether you read each prim's' name each time or just run through a list of prims you already know you want to change.

The only thing to watch out for is that you can't detect a name change (as opposed to a link change) by script, so if you rename one of the prims, you need to reset the script.   But that's only normally an issue while you're working on the object.

Link to comment
Share on other sites

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