I'm having a problem with an 1-prim animated door texture i've made for a space station. It works great except when i 'Take a Copy' or 'Save back to inventory' and i believe other editing related actions cause it also. Normal usage (opening,closing) works fine. The problem is that after 'Take a Copy' the animation stops and shows the entire 6-frame texture instead of the desired frame (opened or closed). I've posted a picture at https://my.secondlife.com/ariagirl/snapshots/516442a6ee679e1c9f000001 I can't seem to find a scripting solution and I am wondering if this is just a viewer glitch (Phoenix Firestorm Release v2.2.29837). I thought detecting and responding to appropriate 'changed' events might work, but did nothing. The problem can be temporarily fixed by Reseting all scripts from the viewer but will just reoccur with the next 'Take a Copy'. Here is my script if it matters: i integer DOOR_OPEN = 283;
integer DOOR_ACTIVATE = 282;
integer open = FALSE;
integer x = 3;
integer y = 2;
float speed = 8.0;
string closesound = "close";
string opensound = "open";
string doorcode;
float doortime = 10.0;
Close()
{
llPlaySound( closesound, 1.0 );
llSetTextureAnim( ANIM_ON | REVERSE, ALL_SIDES, x,y,0.0,0.0,speed ); //play in reverse to close the door
llSetLinkPrimitiveParams( LINK_THIS,[PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM] ); //make door solid
llSleep(1.0);
llSetTextureAnim( ANIM_ON | SMOOTH, ALL_SIDES, x, y, 0.001, 1.0, speed); //adding this line fixed a problem i was having where the door would be invisible sometimes when i logged in. Removing this line doesn't fix the current problem. Using 0.0 instead of 0.001 didn't fix my original problem if you're wondering.
open = FALSE;
}
Open()
{
if ( !open )
{
llPlaySound( opensound, 1.0 );
llSetTextureAnim( ANIM_ON, ALL_SIDES, x,y,0.0,0.0,speed ); //play forward to open the door
llSetLinkPrimitiveParams( LINK_THIS,[PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_NONE] ); //make door phantom
llSleep(1.0);
llSetTextureAnim( ANIM_ON | SMOOTH, ALL_SIDES, x, y, 5.001, 1.0, speed);//adding this line fixed a problem i was having where the door would be invisible sometimes when i logged in. Removing this line doesn't fix the current problem. Using 5.0 instead of 5.001 didn't fix my original problem if you're wondering.
open = TRUE;
llSetTimerEvent( doortime ); // close door after specified amount of time
}
}
string GetCode()
{
return llList2String( llGetPrimitiveParams( [PRIM_DESC] ), 0 );
}
default
{
on_rez( integer param )
{
llResetScript();
}
state_entry()
{
doorcode = GetCode();
Close();
}
link_message( integer sender, integer num, string msg, key id )
{
if ( num == DOOR_ACTIVATE && doorcode == msg )
{
if ( open ) Close();
else Open();
}
if (num == DOOR_OPEN && doorcode == msg )
{
Open();
}
}
timer()
{
Close();
llSetTimerEvent(0.0);
}
}