Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Timing Script (for changing textures)

Kensei Tachikawa
Registered User
Join date: 27 Oct 2007
Posts: 2
03-24-2009 10:27
I'm just getting started in scripting, have done a number of the tutorials, but haven't seen how to do what I want. What I want is similar to the "Touch to change texture" script which I have put into a picture, understand well, and works fine, but I want it to cycle through the pictures at a set time (which I want to be able to set in the script) without being touched. Anyone seen anything like that already, or can point me to the right LL functions I might use?
Thanks!
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
03-24-2009 11:08
If you have already written a script that changes textures on touch, then all you need to do is wrap the guts of it with a timer event instead of a touch_start event. Schematically, you'd write ...

CODE

default
{
state_entry()
{
llSetTimerEvent(x.x); // Where x.x is a floating point time in seconds
}
timer
{
//do your texture changing stuff here
}
}



See .
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
03-24-2009 11:18
The smart way to do it is with llSetTextureAnim()
Pro:
Will display frames without gabs
Can run after the script is removed
Since you need one texture only the upload price is reduced to L$10;)
Contra:
All frames have to be placed on one texture

If you make a simple shifter each viewer(avatar) will see a gray face while the texture is loading until the script has cycled through all frames. By that time me and most others would have gone off to another region:)
_____________________
From Studio Dora
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
03-24-2009 11:33
From: Dora Gustafson
If you make a simple shifter each viewer(avatar) will see a gray face while the texture is loading until the script has cycled through all frames. By that time me and most others would have gone off to another region:)


You are so right. The way to beat that small problem is to make an "almost simple" shifter. Instead of designing your script to display one texture on one face at a time, make it display a different texture on each face. Set the color on all faces but one to black, and then rotate the textures so that they appear, one after another, on the non-black face. That method pre-loads each texture so that it has time to rez behind its veil of black while people are viewing whatever is currently in front. SO long as you don't change textures too rapidly, no one should ever get bored by a gray screen and wander off.

One drawback of using llSetTextureAnim() is that because all frames have to be combined in a single texture, you can't get much pixel resolution on a frame. That's OK for frames that have simple images and little text, but not for ones with much detail.