Braydon Randt
Registered User
Join date: 31 Jul 2008
Posts: 6
|
10-31-2009 23:24
OK, this is a rather simple one , but is causing me no end of frustration. Is there anyway to have a linkset change to alpha by prim name, this is what i have come up with so far but only seams to work on a single prim, If i have more than one prim by that name rather than changing all the prims it does a singular prim and leaves the rest ? I do now how to do this by putting a listen in each prim so that it would change to alpha on reciving a message, but i would rather not put a script in each prim. integer LINK_TARGET = -1; string target = "B1";
getLinks() { integer i; integer linkcount = llGetNumberOfPrims(); LINK_TARGET = -1; for (i = 1; i <= linkcount; ++i) { string str = llGetLinkName(i); if (str == target) { LINK_TARGET = i; } } } default { state_entry() { getLinks(); } on_rez(integer param) { getLinks(); } touch_start(integer count) { if (LINK_TARGET != -1) { //llMessageLinked(LINK_TARGET, 0, "MESSAGE", NULL_KEY); llSetLinkAlpha(LINK_TARGET, 0.0, ALL_SIDES); } } }
All for the love of script simplification. Ive checked the wiki but im comming up stumped. Thanks
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
10-31-2009 23:50
SetMatchingLinksAlpha( string target) { integer i; integer linkcount = llGetNumberOfPrims();
for (i = 1; i <= linkcount; ++i) { string str = llGetLinkName(i); if (str == target) { llSetLinkAlpha(i, 0.0, ALL_SIDES); } } } default {
touch_start(integer count) { SetMatchingLinksAlpha("B1"); } }
Would something like that work?
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
|
11-01-2009 04:56
To generalise a little bit - the llSetLink*() functions take a SINGLE prim-number or one of the constants (LINK_SET, etc). If you want to change a number of prims you can iterate through them as SuzanneC shows above. Unfortunately, if you want the change to happen simultaneously (or nearly so) in all the target prims you need to have a script in each one that will respond to a link-message. Also note that not all primitive values can be set 'remotely' so you'll often need a script-per-prim anyway 
|
Braydon Randt
Registered User
Join date: 31 Jul 2008
Posts: 6
|
Makes perfect sence to me
11-01-2009 07:01
that works great SuezanneC, I can see where i went astray on that. Thank you very much  Bray
|