|
Jebediah Spatula
Registered User
Join date: 10 Apr 2006
Posts: 3
|
12-07-2007 02:04
I make objects ranging from 5 to 60 prims. Of those 5 to 60 prims, 2 prims need to change textures. I'm trying to do it as efficiently as possible, but have come to a point where I'm not sure which way is best.
----------------------
Choice #1 - Make a list of the prims that need changed, then use a 'while' loop to send the texture change message only to the prims that need changing.
list prim_list [5, 6]; // prim#'s of the prims that will change texture key texture = "89556747-24cb-43ed-920b-47caed15465f";
touch_start(integer total_number) { integer primlistmax = llGetListLength(prim_list); integer primindex = 0; while (primindex <= primlistmax) { llMessageLinked(llList2Integer(prim_list, primindex), 111, "", texture); primindex ++; } }
-----------------------
Choice #2 - Send the texture change message to all prims.
key texture = "89556747-24cb-43ed-920b-47caed15465f";
touch_start(integer total_number) { llMessageLinked(LINK_SET, 111, "", texture); }
-----------------------
And, of course, something like this in the texture change prims...
link_message(integer sender, integer change, string message, key id) { if (change == 111) { llSetTexture(id, ALL_SIDES); } }
-----------------------
To me, choice #2 seems like it would be faster & more efficient. But, I'm wondering if when the prim count goes up, it would become less efficient. Is there a point at which the number of prims messaged would delay the script to the point where using the list & 'while' loop would actually be more efficient?
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
12-07-2007 03:33
llSetLinkTexture()
most efficient of them all.
|
|
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
|
12-07-2007 03:37
From: Jebediah Spatula I make objects ranging from 5 to 60 prims. Of those 5 to 60 prims, 2 prims need to change textures. I'm trying to do it as efficiently as possible, but have come to a point where I'm not sure which way is best. ---------------------- Choice #1 - Make a list of the prims that need changed, then use a 'while' loop to send the texture change message only to the prims that need changing. list prim_list [5, 6]; // prim#'s of the prims that will change texture key texture = "89556747-24cb-43ed-920b-47caed15465f"; touch_start(integer total_number) { integer primlistmax = llGetListLength(prim_list); integer primindex = 0; while (primindex <= primlistmax) { llMessageLinked(llList2Integer(prim_list, primindex), 111, "", texture); primindex ++; } } ----------------------- Choice #2 - Send the texture change message to all prims. key texture = "89556747-24cb-43ed-920b-47caed15465f"; touch_start(integer total_number) { llMessageLinked(LINK_SET, 111, "", texture); } ----------------------- And, of course, something like this in the texture change prims... link_message(integer sender, integer change, string message, key id) { if (change == 111) { llSetTexture(id, ALL_SIDES); } } ----------------------- To me, choice #2 seems like it would be faster & more efficient. But, I'm wondering if when the prim count goes up, it would become less efficient. Is there a point at which the number of prims messaged would delay the script to the point where using the list & 'while' loop would actually be more efficient? llSetLinkTexure, otherwise these are practically the same...the main delay comes from the built in .2 second delay with setting textures.
|
|
Jebediah Spatula
Registered User
Join date: 10 Apr 2006
Posts: 3
|
12-07-2007 04:20
Wow, I was always under the assumption that you could only change linked prim colors from within the script, for textures you need to use a link message & llSetTexture. This makes things a whole lot easier, thanks! 
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
12-07-2007 06:31
and if someone needs those textures to be simultaneous, you'd use set link texture from two scripts in the same prim, which you could trigger from 1 targeted link message
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|