Color changing in a linked set
|
Korg Stygian
Curmudgeon Extraordinaire
Join date: 3 Jun 2004
Posts: 1,105
|
12-09-2004 06:55
Okay... newbie scripting question.. or idiot scripting question if you prefer.
I want to change the color of specific prims in a linked set while not changing the color of other prims.
I want to do this on verbal command.
If I send a message to the entire set, how do I get only certain prims to pay attention/act - do I need a listen script in each of the "target" prims?
Any help here is appreciated.
|
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
|
12-09-2004 08:06
Here's a take: Let's put some matter into this question. Let's say you have a Master Prim. This could be the root, or even just the most predominant prim, it makes no difference, except to say that this is the controlling script. Since we are talking about some prims that are all linked together, you can use llMessageLink to tell specific prims which you can name what color they will be. There is a new wiki you can use to get the details of the code. I would make a snippet but I have nothing to test its accuracy. So let's say you have a prim named Santa, and 8 tiny prims (really nine) with other names, Dasher, Dancer, Prancer, Vixen, Comet, Cupid, Donner, Blitzen, and Rudolph. You make your wish list and say it to Santa, "Santa make Cupid red". Then Santa interprets your wish, and sends a linked message to Cupid (if you were nice this year) and Cupid will turn red. If not, you ge coal in your stocking. 
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
|
Cienna Rand
Inside Joke
Join date: 20 Sep 2003
Posts: 489
|
12-09-2004 08:19
Or you could use llSetLinkColor(integer linknumber, vector color, integer face)
Link numbers work the same as for link messages, numbered in reverse of selection order when linking. (So the last one is the root, or 1)
Using llSetLinkColor eliminates the need for a script in every prim that needs to change.
_____________________
You can't spell have traffic without FIC. Primcrafters (Mocha 180,90) : Fine eyewear for all avatars SLOPCO (Barcola 180, 180) : Second Life Oil & Petroleum Company Landmarker : Social landmarking software Conversation : Coming soon!
|
Ace Cassidy
Resident Bohemian
Join date: 5 Apr 2004
Posts: 1,228
|
12-09-2004 08:23
Cienna's solution is the best, from a sim-performance point of view, since you'll only need a single listener. You don't even need to put a script in the prim you want to change.
- Ace
_____________________
"Free your mind, and your ass will follow" - George Clinton
|
Korg Stygian
Curmudgeon Extraordinaire
Join date: 3 Jun 2004
Posts: 1,105
|
12-09-2004 09:24
From: Cienna Rand Or you could use llSetLinkColor(integer linknumber, vector color, integer face)
Link numbers work the same as for link messages, numbered in reverse of selection order when linking. (So the last one is the root, or 1)
Using llSetLinkColor eliminates the need for a script in every prim that needs to change. So I need to keep track of all the link numbers then.. and which ones should change or not, I guess. That's what I thought. Thanks... sigh.. on to other problems with my script-writing-retarded mind.
|
Korg Stygian
Curmudgeon Extraordinaire
Join date: 3 Jun 2004
Posts: 1,105
|
12-09-2004 10:37
Okay, tried the llSetLinkColor command as follows... llSetLinkColor(2,-1,ALL_SIDES);
Got the following error when I try to save it... Function call mismatches type or number of arguments.
#2 is the linked prim... only 2 prims in the set and #2 is not the root -1 theoretically subtracts 1 from the current color correct? and ALL_SIDES is shown in the wiki description for the function.
So... what am I doing wrong?
|
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
|
12-09-2004 10:38
How do you people keep useful track of link numbers in objects? Every time I unlink then relink an object while I"m building it, they get scattered to the winds.
_____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
|
Cross Lament
Loose-brained Vixen
Join date: 20 Mar 2004
Posts: 1,115
|
12-09-2004 10:43
From: Korg Stygian Okay, tried the llSetLinkColor command as follows... llSetLinkColor(2,-1,ALL_SIDES);
Got the following error when I try to save it... Function call mismatches type or number of arguments.
#2 is the linked prim... only 2 prims in the set and #2 is not the root -1 theoretically subtracts 1 from the current color correct? and ALL_SIDES is shown in the wiki description for the function.
So... what am I doing wrong? Well, per the wiki, llSetLinkColor(integer linknumber, vector color, integer face). The second parameter you've passed in your llSetLinkColor() is an integer; the function requires a vector parameter there, specifying the colour. Unfortunately, there's no 'llGetLinkColor()' that I'm aware of, to get the current colour of a prim in a link set.
_____________________
- Making everyone's day just a little more surreal -
Teeple Linden: "OK, where did the tentacled thing go while I was playing with my face?"
|
Korg Stygian
Curmudgeon Extraordinaire
Join date: 3 Jun 2004
Posts: 1,105
|
12-09-2004 11:01
I was trying to change the color of the second prim in relation to the first one.. that one used llSetColor(c,-1)
so I assumed, incorrectly it seems, that my adjustment would work....
ah well.. back to beating my head against that brick wall.... ummm... blood tastes so good.
|
Cienna Rand
Inside Joke
Join date: 20 Sep 2003
Posts: 489
|
12-09-2004 11:04
From: Cross Lament How do you people keep useful track of link numbers in objects? Every time I unlink then relink an object while I"m building it, they get scattered to the winds. You have to be extremely careful in the order you select things when linking the object. It's reverse of the selection order. The first item you select will have the highest link number, and the last one the lowest. If all you care about is which one is root, simply select that one last each time. What I usually do is select all, then deselect and reselect the one I want as root. If you always select in the same order, link numbers will never change; or you can design your object such that you only need broadcast link messages and it will be immune to link order changes.
_____________________
You can't spell have traffic without FIC. Primcrafters (Mocha 180,90) : Fine eyewear for all avatars SLOPCO (Barcola 180, 180) : Second Life Oil & Petroleum Company Landmarker : Social landmarking software Conversation : Coming soon!
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
12-09-2004 12:31
What I do,
on change of linking do loop copy name of primtivie into list
then I name my primtives with meening full names like color1 color2
and then when the script is triggered it check what color one is set to, and set the primtives marked by the list as color1 to color 1. and then set all color2 primtive to color 2.
this way it dosne't matter how many times I link or unlinke. If I change aprimtive from 20 to 30. It still works.
|