Curious about a possible "batch" function?
|
Psyra Extraordinaire
Corra Nacunda Chieftain
Join date: 24 Jul 2004
Posts: 1,533
|
11-10-2004 13:02
This is a snippet of code from a vegetation planter that was written by Laukosargas Svarog in this thread: 264152 else if ( message == "planter show" ) { while( (linkKey = llGetLinkKey(i)) != NULL_KEY ) { llSetLinkAlpha( i, 1.0, ALL_SIDES ); i = i + 1; } } else if ( message == "planter hide" ) { while( (linkKey = llGetLinkKey(i)) != NULL_KEY ) { llSetLinkAlpha( i, 0.0, ALL_SIDES ); i = i + 1; }
From what I can see here, this is a functon to set all prims of a linked object alpha using a single script. Is this true? And if so, can it work on avatar attachments? Right now I use a listen script on avatar wings to turn them invisible (alpha setting just like the code above) when I'm not in flight. The annoyance being that the script needs to be placed on every single prim in the wing. *IS* it possible to affect all the prims of an object or attachment with a /single/ script without having to dump scripts into every single child prim? Just curious, and hopeful... it woul certainly make updating features on an avatar a LOT easier if you only had to change 15 scripts, rather than 200+ just to add a one line new function or so...  I'm stuick at work for almost 3 more hours so I can't test this.... but if it works, it could open a whole world of creating and improving all sorts of things. I almost expect someone to tell me "Oh, everyone's been doing that for years, you just never got with the program".... well, what script knowledge I have is from studying other scripts like this one. 
_____________________
E-Mail Psyra at psyralbakor_at_yahoo_dot_com, Visit my Webpage at www.psyra.ca  Visit me in-world at the Avaria sims, in Grendel's Children! ^^
|
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
|
11-10-2004 13:12
I'm curious now too. I'm going to test this and see if you can put ONE script in a linked set and have them all go alpha at the same time from the same script.
If not, then you might have to use llMessageLink to send the same message from the root prim to all the child prims to perform the same command.
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
|
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
|
11-10-2004 13:22
Everyone's been doing that for decades, and you're just now getting with the program.  Prims can only be affected by llSetLink* functions though, and I don't remember what functions of that type exist. Alpha is one of them though. (And you can even affect a single linked prim, rather than the whole set.)
_____________________
</sarcasm>
|
Psyra Extraordinaire
Corra Nacunda Chieftain
Join date: 24 Jul 2004
Posts: 1,533
|
11-10-2004 14:55
From: Moleculor Satyr Everyone's been doing that for decades, and you're just now getting with the program.  *eats Moleculor*  I've been meaning to do that for decades, I just got with that program today too. *urrp* 
_____________________
E-Mail Psyra at psyralbakor_at_yahoo_dot_com, Visit my Webpage at www.psyra.ca  Visit me in-world at the Avaria sims, in Grendel's Children! ^^
|
Psyra Extraordinaire
Corra Nacunda Chieftain
Join date: 24 Jul 2004
Posts: 1,533
|
11-14-2004 09:52
Well, I came up with this as an idea for a test script. You place it in the root prim of any object, and you can toggle the whole prim's invisibility with one single 'show' or 'hide' command. Woot! // =========================================================== // A nice single-script Attachment Hiding Function Thingy! // ===========================================================
integer i; key linkKey;
default { state_entry() { key owner = llGetOwner(); llListen(0,"",owner,""); } listen( integer channel, string name, key id, string message ) { if( message == "hide" ) { i = 1; while( (linkKey = llGetLinkKey(i)) != NULL_KEY ) { llSetLinkAlpha( i, 0.0, ALL_SIDES ); i = i + 1; } } if( message == "show" ) i = 1; while( (linkKey = llGetLinkKey(i)) != NULL_KEY ) { llSetLinkAlpha( i, 1.0, ALL_SIDES ); i = i + 1; } } }
My knowledge of code is what I can smash together out of two scripts into one. Sometimes they work, sometimes they don't. This one does. Are there any limitations to this script I should know about?? 
_____________________
E-Mail Psyra at psyralbakor_at_yahoo_dot_com, Visit my Webpage at www.psyra.ca  Visit me in-world at the Avaria sims, in Grendel's Children! ^^
|
Evil Fool
"==" != "="
Join date: 30 Jul 2004
Posts: 110
|
11-14-2004 12:03
From: Psyra Extraordinaire Well, I came up with this as an idea for a test script. You place it in the root prim of any object, and you can toggle the whole prim's invisibility with one single 'show' or 'hide' command. Woot! My knowledge of code is what I can smash together out of two scripts into one. Sometimes they work, sometimes they don't. This one does (not). Are there any limitations to this script I should know about??  You forgot some brackets, and there is a faster way (less function calls) to do it(especially if this script is going to stay how it is // =========================================================== // A nice single-script Attachment Hiding Function Thingy! // ===========================================================
integer i; integer prims;
default { state_entry() { llListen(0,"",llGetOwner(),""); } listen( integer channel, string name, key id, string message ) { if( message == "hide" ) { prims = llGetNumberOfPrims(); for (i = 1; i <= prims; i++) { llSetLinkAlpha( i, 0.0, ALL_SIDES ); } } else if( message == "show" ) { prims = llGetNumberOfPrims(); for (i = 1; i <= prims; i++) { llSetLinkAlpha( i, 1.0, ALL_SIDES ); } } } }
but yeah, your way would have worked too, except it show each prim after it hides them
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
11-14-2004 17:17
pretty sure this will work (know it works for llSetLinkColor) default { state_entry() { llListen(0,"",llGetOwner(),""); } listen( integer channel, string name, key id, string message ) { channel=llListFindList(["hide","show"],[message]); if( channel + 1) llSetLinkAlpha( LINK_SET, (float)channel, ALL_SIDES ); } }
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
|
11-15-2004 08:07
If you use that code on something, and you want to sell it, is this one that needs to have "mod" permissions set so it will work?
(just curious)
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
11-15-2004 16:17
don't think so...
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Laukosargas Svarog
Angel ?
Join date: 18 Aug 2004
Posts: 1,304
|
11-16-2004 09:00
Damn! that's at least the 3rd time i've forgotten about that constant ! lol 
|