Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

a simple problem, no solution? texture changer

Amarin Polonsky
Registered User
Join date: 20 Sep 2005
Posts: 6
10-23-2009 10:27
hello people, thanks for reading

i have a set of like 11 prims linked, all kinds of shapes. i aligned the texture settings (offsets, repeats, rotations, etc.) perfectly.

now the problem is, i want to change the textures of the prims all at once. but no matter which texture changing script i used so far, they dont save the "texture settings" (offsets, etc.) so when i change the texture via a changer script, the texures are not aligned anymore.

it seems like there is no script out that can do this. can anyone help? does anyone know of a script that would get the job done? im really a script noob and all of this is like rocket science to me.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
10-23-2009 10:55
So..... just as a test ..... what happens if you just drag-drop a new texture from your inventory onto any one of the prims you have already textured? That manual operation should change the texture without messing with any of the alignment/scaling properties. Unless the new texture needs to adjusted in some way because of the way it is drawn, there should be no problem.

If you write a simple script that uses llSetTexture http://lslwiki.net/lslwiki/wakka.php?wakka=llSetTexture or http://lslwiki.net/lslwiki/wakka.php?wakka=llSetLinkTexture, it will mimic the manual process I was just describing.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Tecak Oyen
Registered User
Join date: 13 Jun 2007
Posts: 18
10-23-2009 13:18
You need to save the texture offsets, repeats and rotations using llGetPrimitiveParams(). Then when you call llSetPrimitiveParams with the new texture, pass the saved values in.

Unfortunately there isn't a llGetLinkPrimitiveParams, so you need to run a script in each prim to save the parameters. You can either store them in each prim or send them to the root prim using linked messages. llSetLinkPrimitiveParams does exist so a script in the root prim could set the textures in the other prims. Or the script in the prims could respond to a linked message and set the texture.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
10-23-2009 13:35
Unless you plan on changing some parameters, you shouldn't need to go to all the trouble of getting and then resetting them. They should just stay the same as you apply the new texture. You ought to be able to apply the same new texture to all prims in the linkset with

CODE

default
{
touch_start(integer num)
{
llSetLinkTexture(LINK_SET,"New Texture",ALL_SIDES);
}
}


It's a little more work to put different textures on different faces/prims, but you still ought to be able to do it without messing around with the parameters.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Amarin Polonsky
Registered User
Join date: 20 Sep 2005
Posts: 6
10-23-2009 13:59
okay what i dont get is....

(LINK_SET,"New Texture",ALL_SIDES)

what do i use for the "new texture"? i dont want to add a script for each texture i put into the root prim...
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
10-23-2009 14:23
Oh, that's easy... You just put one texture into the prim that has the script. Then you write

CODE

default
{
touch_start(integer num)
{
llSetLinkTexture(LINK_SET,llGetInventoryName(INVENTORY_TEXTURE,0), ALL_SIDES);
}
}


By definition, if there's only one texture there, it has to be number 0. If you want to apply a different texture, remove that one, drop a new one into the prim, and run the script again.

ETA: If you plan to change textures a lot, you really can put several textures in inventory. Your script would then be slightly more complicated because you'd want to be able to pick one of them with a dialog, but it's still basically the same script.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Amarin Polonsky
Registered User
Join date: 20 Sep 2005
Posts: 6
10-23-2009 14:37
i hate bothering you with my noob questions. i read everything i could find on the problem and comprehend it.

what you wrote is basically what i want. a root prim that i put like 20 textures into, that gives me the possibility to chose from those and that changes the textures on the child prims, without messing up the alignment.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
10-23-2009 14:46
OK... build on this example. You'll need to create two tiers of dialog buttons, since you can only use 12 buttons per dialog box, but otherwise the script should be like this. The easiest thing to do is to rename your textures "Texture 1", "Texture 2" and so forth when you put them in the object's inventory. That way the button labels work nicely and look uniform.

CODE

integer CHAN = -1234;
list buttons = ["Texture 1", "Texture 2", "Texture 3", "Texture 4"];
//Be careful to type the names of your textures exactly right, or
//as an alternative, redefine what these button names mean instead of
//using them directly in the llSetLinkTexture statement
default
{
state_entry()
{
llListen(CHAN,"","","");
}

touch_start(integer num)
{
llDialog(llDetectedKey(0),"Choose a texture",buttons,CHAN);
}

listen (integer channel, string name, key id, string message)
{
llSetLinkTexture(LINK_SET,message, ALL_SIDES);
}
}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at