Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

A Question about Texture changeing

Sin Poitier
RL is calling
Join date: 5 Mar 2007
Posts: 52
05-11-2007 14:32
I'm trying to make a script that loops textures 1 and 2...endlessly, and shows texture 3 when clicked for some timee, then to return to the 1-2 loop....
but i'm no scripter, and can't work that out from the free/open similar scripts i'm trying to learn from. Those all need the user to click to change the texture...AKA Slideshows...
Any help?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-11-2007 15:43
From: Sin Poitier
I'm trying to make a script that loops textures 1 and 2...endlessly, and shows texture 3 when clicked for some timee, then to return to the 1-2 loop....
but i'm no scripter, and can't work that out from the free/open similar scripts i'm trying to learn from. Those all need the user to click to change the texture...AKA Slideshows...
Any help?



CODE

integer TextureNumber = FALSE;

SetTexture()
{
if(TextureNumber)
llSetTexture("texture 1",ALL_SIDES);
else
llSetTexture("texture 2",ALL_SIDES);
}

default
{
state_entry()
{
TextureNumber = FALSE;
SetTexture();
llSetTimerEvent(10.);
}

touch_start(integer num)
{
state Texture3;
}

timer()
{
TextureNumber = ! TextureNumber ;
SetTexture();
}
}

state Texture3
{
state_entry()
{
llSetTimerEvent(5);
llSetTexture("texture 3",ALL_SIDES);
}

timer()
{
state default;
}
}
_____________________
I'm back......
Sin Poitier
RL is calling
Join date: 5 Mar 2007
Posts: 52
05-15-2007 20:01
Thx...great help!!
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
05-16-2007 08:28
Newgate's script is clear and to the point. Use it happily.

If performance is an issue, it sometimes helps to merge the three textures into one bigger one. Then, instead of changing the textures, you just slide it to one side, the middle, or the other side.
Nefertiti Nefarious
Registered User
Join date: 5 Oct 2006
Posts: 135
Alternating textures in a Prim
05-29-2007 13:21
How would you change this to just run through the textures.

For example, I have two swan textures, with the heads in different positions, and I want the object to change between them every few seconds to give the illusion of animation.

I know I can set the texture to just affect one side, but it's getting the changer that I'm confused by.
Core Taurog
Registered User
Join date: 2 May 2007
Posts: 17
05-29-2007 13:29
If you have the 3 textures on your PC, it's probably going to be easier to use the inbuilt texture animater to do what you want.

Put the 3 images into one larger one, side by side, and upload that (I'd do a 2x2 arrangement, myself - i.e. the 4th frame would just be blank).

Then use "llSetTextureAnim" to animate it as appropriate.
(which is really easy to use; just experiment with it a bit)

if you use a 2x2 arrangement then just set the texture as 0.5/0.5 repeats, -0.25/0.25 offset and the first frame will be displayed by default.

I'm using the RPG stats wiki atm, which I think is a mirror, but I don't know which I'm supposed to be refering to; the official ones seem to be all but unusable most of the time, and the "main" one seems to be down at the moment as best I can tell; this link may be useful to you:

http://rpgstats.com/wiki/index.php?title=LlSetTextureAnim

regards,

Core
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
05-29-2007 14:36
The simplest way would be the animated texture routine outlined by both Lee and Core.
If you dont want to go that root for what ever reason then take the original script I postec and remove the touch handler and Texture3 state.
_____________________
I'm back......
Nefertiti Nefarious
Registered User
Join date: 5 Oct 2006
Posts: 135
05-29-2007 18:46
Thanks -
I'll try both of them to see which works best.