Texture Swap on Linked Objects
|
|
H3thr Swashbuckler
Registered User
Join date: 15 Sep 2008
Posts: 1
|
05-05-2009 13:24
I created a bed that I want to allow the owner to change the textures on to his/her liking. I had a texture swap script in there but it only works for the prim it is in. I tried editing it with setlinktexture but I don't know what I'm doing well enough. Basically what ended up happening is the script changed the texture of the prims I chose once and then stopped. Further clicking produced no further effect.
I've searched the forum and I didn't find anything similar. I do apologize if this a repost. I did try my best to find this.
There are 3 sets of prims within the linked object that I'd like to group for texture change.
Thanks for any help you can give.
H3thr
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-05-2009 15:28
you'll need to call set link for all three, in order... if you don't know the prim numbers drop this script in the root and touch the piece you want the kink number for (delete if after you get all your link numbers to use in the bed) default{ touch_start( integer vIntTotal ){ llOwnerSay( (string)llDetectedLinkNumber ); } }
_____________________
| | . "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... | - 
|
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
05-05-2009 15:42
From: Void Singer you'll need to call set link for all three, in order... if you don't know the prim numbers drop this script in the root and touch the piece you want the kink number for (delete if after you get all your link numbers to use in the bed) Better would be to use this script: list prim_names = [ "pillow1", "pillow2", "blanket", "headboard", ... ]; list prim_numbers = [ -1, -1, -1, -1, ... ]; default { state_entry() { integer i; integer n = llGetNumberOfPrims(); for(i = 0; i < n; i++) { string s = llGetLinkName(i); integer j = llListFindList(prim_names, ); if(j != -1) prim_numbers=llListReplaceList(prim_numbers, , j, j); } }
Now the prim number for pillow1 will be llList2Integer(prim_numbers, 0) and so on...
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-05-2009 17:21
and then search the list to get the prim number? very roundabout if you're only changing one set of prims.
_____________________
| | . "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... | - 
|
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
05-05-2009 18:23
No searching, just a lookup. The search happens when you're creating the list.
The problem is that if you ever relink the object, say to do a new version, you have to go and change all the prim numbers stored in your script. If you go by the prim names, you just have to reset the script and you're done.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-05-2009 20:31
only applies to the creator really though, who can easily follow the steps again.
user mods by relinking are kinda outside warranty. with new script limitation in the works, leaner is probably preferable.
there are places you'd want to do that.. I just don't think a for sale bed would be one of them. personal opinion.
_____________________
| | . "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... | - 
|
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
05-06-2009 02:51
From: Void Singer only applies to the creator really though, who can easily follow the steps again. And again, and again, and again, every time they change them. It gets old. And if you're selling a mod bed... unless you make the script full-perm I think it less than ethical to hardcode actual prim numbers in the script. From: someone user mods by relinking are kinda outside warranty. with new script limitation in the works, leaner is probably preferable. Unless you have hundreds of named prims you're tracking the memory and computational overhead of this approach is negligible.
|