So back to scripting, the first script we're going to look at in the library, which is what everyone has in Second Life, is anim Smooth. This was written by Doug Linden at Linden Labs and it's a clever little script that has more uses then are first apparent. It's a simple script, basically it does one thing as soon as you rez the object or implement the script and that is to animate the texture on all the sides of the prim making it scroll across them. Here's the script:
// anim SMOOTH Script
// By Doug Linden
//
// If you are interested in scripting, check out
// the Script Help under the help menu.
// The double slash means these lines are comments
// and ignored by the computer.
// All scripts have a default state, this will be
// the first code executed.
default
{
// state_entry() is an event handler, it executes
// whenever a state is entered.
state_entry()
{
// llSetTextureAnim() is a function that animates a texture on a face.
llSetTextureAnim(ANIM_ON SMOOTH LOOP, ALL_SIDES,1,1,1.0, 1,0.25);
// animate the script to scroll across all the faces.
}
}
So this script basically does the one function llSetTextureAnim. Taking a look at the lsl wiki, or hovering our mouse over the command in the script window if you are in Second Life gives us the arguments for the function:
llSetTextureAnim(integer mode, integer side, integer x_frames, integer y_frames, float start, float length, float rate);
So, we can do some interesting things with this, the first part that I messed with was the rate, which in the script of the library is the final 0.25 number. Changing that to .05 and using a water texture gives a very nice effect of waves moving across the prim, very basic but effective. Changing the ALL_SIDES parameter lets you choose which side of your prim actually has animation which can also be extremely helpful. So right away we have some decent uses for this script, but what about exploring further into possibilities. If you look at the wiki it give you all sorts of options. You can rotate the script, which is great for a steaming culdron effect and I've used to make witches pots over fires for halloween. You can make it zoom in and out. If you're really clever you can even make true animations by using the old flip book trick. This is much more advanced requiring you to make a texture divided into multiple parts with each frame of animation right above one another and I'm not going to get into it here. My point is that the resources for very advanced content creation is given to all of us if we explore a bit.
Other parts of the library can be equally as fun, check it out yourself.
0 comments:
Post a Comment