Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Flame Script

a lost user
Join date: ?
Posts: ?
08-23-2005 00:46
Hi..a newbie here..and trying to make a simple candle..with flame. I looked around and found this script for it. ..but it doesnt seem to be working. What it does is spin the object around. I know its gotta be me..but I dunno what I'm doing wrong. Thanks in advance..for any input on this.

integer animOn = TRUE; //Set to FALSE and call initAnim() again to stop the animation.

//Effect parameters: (can be put in list together, to make animation have all of said effects)

//LOOP - loops the animation
//SMOOTH - plays animation smoothly
//REVERSE - plays animation in reverse
//PING_PONG - plays animation in one direction, then cycles in the opposite direction

list effects = [SMOOTH,LOOP];

//Movement parameters (choose one):
//ROTATE - Rotates the texture
//SCALE - Scales the texture
//Set movement to 0 to slide animation in the X direction, without any special movement.

integer movement = 0;

integer face = ALL_SIDES; //Number representing the side to activate the animation on.
integer sideX = 1; //Represents how many horizontal images (frames) are contained in your texture.
integer sideY = 1; //Same as sideX, except represents vertical images (frames).
float start = 0.0; //Frame to start animation on. (0 to start at the first frame of the texture)
float length = 0.0; //Number of frames to animate, set to 0 to animate all frames.
float speed = 10.0; //Frames per second to play.


initAnim() //Call this when you want to change something in the texture animation.
{
if(animOn)
{
integer effectBits;
integer i;
for(i = 0; i < llGetListLength(effects); i++)
{
effectBits = (effectBits | llList2Integer(effects,i));
}
integer params = (effectBits|movement);
llSetTextureAnim(ANIM_ON|params,face,sideX,sideY,
start,length,speed);
}
else
{
llSetTextureAnim(0,face,sideX,sideY,
start,length,speed);
}
}


default
{
state_entry()
{
initAnim();
}
}
a lost user
Join date: ?
Posts: ?
08-23-2005 04:12
All you really need is 2 things.. a special texture and a single llSetTextureAnim() call. For the fire texture, IM me in the game and I will send it to you, the one that is used "almost" everywhere in the whole game. For the function call it would be something like this (in the state_entry() event)

llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0, 15.0, 12.0);

If you look at the texture I will give you it is set up with each frame of the animation laid out in a 4 by 4 grid. That is 4 frames wide, by 4 frames high. So a total of 16 frames of animation. What the llSetTextureAnim() call is saying is:

ANIM_ON - Start animating the texture
LOOP - When at the last frame, start from the first frame again (auto rewind)
ALL_SIDES - Apply animation to all sides of the prim

Then the next two bits of information describes the grid of animation frames:
4 - there are four frames running left to right
4 - there are four frames running top to bottom

The next two bits of information describes which frame to start from and which to end on:
0 - Start from the very first frame
15.0 - end on the 16th frame

And finally the last bit tell it how fast to go, in frames per second:
12.0 - Play 12 frames of animation per second.


The script that you have been given does all of this in what I consider to be a round-about way that attempts to dumb the single function call down for people who don't understand LSL functions. In most cases, this dumbing down actually results in things looking and feeling a lot more complicated than they really are.

I can't see how that script would rotate your prim physically as there is nothing to tell it to do that, so you must ave other code somewhere performing that rotation. Anyway.. send me an IM and I will send you the texture you need for the animation of the fire.