CODE
// This blink script uses a single texture with the frames set up as follows within the image.
//
// +-----+-----+
// | 1 | 2 |
// +-----+-----+
// | 3 | 4 |
// +-----+-----+
// The minimum time between blinks
float minBlinkTime = 0.5; // in seconds
// The Maximum time between blinks
float maxBlinkTime = 12.0; // in seconds
// The animation frame speed
float animationSpeed = 7; // in fps
// number of frames in the animation
integer numberFrames = 4;
// temporary variable
float waitTime;
// Returns a reandom number between min and max
float randBetween(float min, float max)
{
return llFrand(max - min) + min;
}
default
{
// Main part of the program
state_entry()
{
// Sets the size and position of the default frame
llOffsetTexture(-0.25,0.25,ALL_SIDES);
llScaleTexture(0.7,0.5,ALL_SIDES);
// Intialize time even
llSetTimerEvent(randBetween(minBlinkTime,maxBlinkTime));
waitTime = (numberFrames * 2) / animationSpeed;
}
// Timer event
timer()
{
// Temporarily turn off the timer event
llSetTimerEvent(0.0);
// Animate the eyes onces.
llSetTextureAnim(ANIM_ON|PING_PONG,ALL_SIDES,2,2,1,4,animationSpeed);
// Wait for the eyes to finish animating
llSleep(waitTime);
// Turn off animation
llSetTextureAnim(FALSE,ALL_SIDES,2,2,1,4,animationSpeed);
// Reset Timer for next event
llSetTimerEvent(randBetween(minBlinkTime,maxBlinkTime));
}
}
Ok, the texture I want to use looks fine with a 0.7 on the horizontal repeat, but when the animation gets playing, it jumps back to 0.5 on the next 3 frames, then back to 0.7 when its done. How can I force it to stay 0.7 when its running? Hope this isn't too simple of a question. ^_^;