Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Animated Texture On Touch

Robbo Mills
Registered User
Join date: 2 Jul 2007
Posts: 3
09-18-2008 09:32
I've been searching all over for a script that can do this but can't find precisely what I need:

Using a grid of images in a single image file, as one would for making an animated texture, but being able to cycle through each separate image on the grid by touching the prim.

I've got a Texture Animation script and I've got a Texture Changer script that cycles through textures in the prim inventory by touch - but I'd rather not fill up the prim (and shell out the L$) for multiple images when a singe larger image containing the individual "frames" could be used. Is there any way to merge these two scripts?

Is this possible? Or is the ANIM_ON script command limited to just running and not being able to stop and advance through each frame with each touch of the prim?

Hope someone can help.

Galena Qi
Registered User
Join date: 9 Sep 2006
Posts: 249
09-18-2008 14:50
The llSetTextureAnim command does step through frames, if you omit the SMOOTH command. The command is explained here: http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSetTextureAnim
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-18-2008 20:26
if i understand correctly you're wanting to basically show a slideshow of animations? you could use a notecard. and list the name of each texture, the frame lay out as it is in the script function and probably how fast you want it to cycle. i'm sure someone has one, but whether or not it's free i dunno. try slxchange
Dark Heart Emporium


want more layers for tattoos, specifically for the head? vote here

llDetectedCollision* Functions similar to touch
Renee Roundfield
Registered User
Join date: 10 Mar 2006
Posts: 278
09-18-2008 22:10
Here's a script I made (there are probably more elegant methods -- I'm very much still learning). You need only change the x and y values in the first two lines to reflect the dimensions of your image grid and put the texture in the prim. This displays on what would be the top face of a cube prim. I tapered both x and y, shortened z to .05, and made all but the display face black for a "frame" around the display. I also had to rotate the texture 90 degrees -- when I could tell the textures had orientations. :)


//written by Renee Roundfield 18-Sep-08
//as a gift to the SL community
//in appreciation for the many gifts
//she has received.

integer x = 4; //number of columns
integer y = 4; //number of rows
string texture;
integer cx = 0;
integer cy = 0;
float scalex = 1.0;
float scaley = 1.0;
float basex;
float basey;
float offsetx;
float offsety;

scalex /= x;
scaley /= y;
basex = -.5 + scalex/2;
basey = .5 - scaley/2;
texture = llGetInventoryName(INVENTORY_TEXTURE, 0);
llSetTexture(texture, 0);
llScaleTexture(scalex, scaley, 0);
llOffsetTexture(basex, basey, 0);
changed (integer change)
touch_start(integer total_number)
cx = cx +1;
if (cx > x-1)
cx = 0;
cy = cy + 1;
if (cy > y - 1)
cy = 0;
offsetx = basex + cx * scalex;
offsety = basey - cy * scaley;
llOffsetTexture(offsetx, offsety, 0);

Robbo Mills
Registered User
Join date: 2 Jul 2007
Posts: 3
Thank You!
09-19-2008 08:58
Renee - many many thanks!

This is precisely what I needed.