Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help changing texture on sculpty - basic question

Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
03-18-2009 21:35
My first time trying to change a texture on a prim in a linkset...sculpty prim to be exact.

I have a message link command to switch from one texture to another, which works except the new texture will NOT take on the Offset and Repeat params of the original texture. I want all params are to remain the *same*, just the texture is changed.
I have this script in the targeted sculpty prim:

default
{

link_message(integer sender, integer num, string message, key id)
{
if (message == "texture1";)
{
llSetPrimitiveParams([ PRIM_TEXTURE, ALL_SIDES, "UUID", <-1.0, 1.0, 0.0>, <0.9, 0.0, 0.0>, 0.0 ]);

}

else if (message == "texture2";)
{
llSetPrimitiveParams([ PRIM_TEXTURE, ALL_SIDES, "UUID", <-1.0, 1.0, 0.0>, <0.9, 0.0, 0.0>, 0.0 ]);

}
}

}


Help please, why won't the replacing texture pick up the params?
Lynnore Vaher
Registered User
Join date: 19 Jul 2008
Posts: 16
03-18-2009 23:47
If you don't want anything other then the texture changed, then use llSetTexture instead of llSetParams. Or am i misunderstanding something? Can't immediatly see whats wrong with your script but try llSetTexture.
Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
03-19-2009 10:36
Thx Lynnore, and llSetTexture was the first one I tried which gave me the very same result....so I thought I must need to put the textures parameters in for the replacing texture (texture2) to pick it up, but both llSetTexture and llSetPrimitiveParams did not work for me.

First attempt, which did not work either:

default
{

link_message(integer sender, integer num, string message, key id)
{
if (message == "texture1";)
{
llSetTexture("UUID", ALL_SIDES);
}

else if (message == "texture2";)
{
llSetTexture("UUID", ALL_SIDES);
}
}
}


Is it not working because it's a sculpty?
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
03-19-2009 17:54
From: Keera Zenovka
Thx Lynnore, and llSetTexture was the first one I tried which gave me the very same result....so I thought I must need to put the textures parameters in for the replacing texture (texture2) to pick it up, but both llSetTexture and llSetPrimitiveParams did not work for me.

First attempt, which did not work either:

default
{

link_message(integer sender, integer num, string message, key id)
{
if (message == "texture1";)
{
llSetTexture("UUID", ALL_SIDES);
}

else if (message == "texture2";)
{
llSetTexture("UUID", ALL_SIDES);
}
}
}


Is it not working because it's a sculpty?
I don't know why this example didn't work(works fine for me on testing in world on a sculpty) but I think the reason the first, llSetPrimitiveParams, example didn't was that you've got the repeats and offsets switched round .. the script's trying to set the horizontal repeats to -1, which is impossible, so it's presumably making a silent correction to <1.0,1.0,0.0>, which it thinks you want.

First vector should be repeats, second offsets.
Keera Zenovka
Registered User
Join date: 23 Mar 2007
Posts: 35
03-19-2009 23:57
From: Innula Zenovka
I don't know why this example didn't work(works fine for me on testing in world on a sculpty) but I think the reason the first, llSetPrimitiveParams, example didn't was that you've got the repeats and offsets switched round .. the script's trying to set the horizontal repeats to -1, which is impossible, so it's presumably making a silent correction to <1.0,1.0,0.0>, which it thinks you want.

First vector should be repeats, second offsets.


Oh, well I was going by the wiki for the negative repeat value because it said
"vector repeats – x and y range from 0.0 to 100, or -0.0 to -100 in 0.01 increments. Negative values flip the texture"

Tested that out again just in case though because I'm using the texture "flip" and it does indeed flip it when you add the negative....

You all have helped me rule out my scripting ignorance of these functions as the cause of my screwup...I must have screwed up in the creation of said replacement texture.
Learned much - thank you!
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
03-20-2009 01:33
From: Keera Zenovka
Oh, well I was going by the wiki for the negative repeat value because it said
"vector repeats – x and y range from 0.0 to 100, or -0.0 to -100 in 0.01 increments. Negative values flip the texture"

Tested that out again just in case though because I'm using the texture "flip" and it does indeed flip it when you add the negative....

You all have helped me rule out my scripting ignorance of these functions as the cause of my screwup...I must have screwed up in the creation of said replacement texture.
Learned much - thank you!
My mistake -- I was going by the lsl wiki, http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSetPrimitiveParams, which says of repeats, "x and y range from 0.0 to 100 (z is ignored) " and of offsets, " x and y range from -1 to 1 (z is ignored) ," and when I tested it in world, I didn't bother to look at the repeats per meter box in the texturing window (the horizontal and vertical repeats boxes don't go lower than 0.00, thus adding to my confusion).

Not realising you were trying to flip the texture, I didn't think to look further. But I've just tried with a texture where a flip is obvious and you're right. Sorry about that.

Before remaking your texture, why not apply it to your scultpy, adjust it to both your desired settings using the texture window in the editor till it looks right, and then read them using llGetTextureScale and llGetTextureOffset?