I have an object that has a texture on one face with 16 animation frames in it. Each frame is a different state off the object for instance the image frame 0 indicates the object is off, frame 1 it is initialising, frame 3 its ready awaiting user interaction etc.
Using the following script in its simplest form I set the particular frame to be shown at different times.
//Animate frames
integer iSide = 3;
float FRAME_OFF = 0.0;
float FRAME_INIT = 1.0;
float FRAME_THINK = 2.0;
float FRAME_READY = 3.0;
default
{
state_entry()
{
llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_INIT,1,1);
//do something
llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_READY,1,1);
}
on_rez(integer start_param)
{
llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_INIT,1,1);
llResetScript();
}
touch_start(integer total_number)
{
llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_THINK,1,1);
//do something
llSetTextureAnim(ANIM_ON , iSide,1,16,FRAME_READY,1,1);
llOwnerSay("Clicked"
;}
}
All works great initially, the correct frames are shown, however if I leave the object for a while, or right click to bring the wheel menu up the animation screws up showing the texture with all 16 frames in one go. Touching the object again, even though it has the animation command in makes no difference. The only way I can seem to get out of this is resetting the script.
Any advice would be greatly appreciated.
ty
Jade