Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sync lights with ANIM_ON

grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
09-29-2006 07:14
I am trying to help a new club owner reduce lag.

First, I noticed he was using 100’s of continuous color changing scripts for the lights.
Worse yet he linked the lights together and this causes SL to send updates for the whole set.

I had him apply the free rainbow texture and this script.

I have a few problems.

1. I can’t keep the lights in sequence. Each time someone logs in they are out of sequence for that person. I added a “Touch here box” but It would be better to have it update every 10 seconds or so.

2. I can’t get llOffsetTexture() to have any effect other to clear it to zero. It appears that the ANIM_ON, starts at zero if the texture offset has been modified.

I am looking for a way to set the animation to a specific start phase without having to stop it. The code below is close, but not perfect.

CODE

// anim SMOOTH Script
// By Doug Linden (I think)
// Updated by grumble Loudon, for rainbow texture

float m_Phase = 0;

AnimStart(){
// llSetTextureAnim() is a function that animates a texture on a face.
llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 127,1, 0, 0, 10);
// animate the script to scroll across all the faces.

}
AnimStop(){
llSetTextureAnim(0, ALL_SIDES, 127, 1, 0, 0, 10);
}

default
{
// state_entry() is an event handler, it executes
// whenever a state is entered.
state_entry()
{
AnimStart();
llListen(9, "", NULL_KEY, "sync") ;
}
listen(integer channel, string name, key id, string message){

llSleep(m_Phase);

AnimStop();
llOffsetTexture(0, 0, ALL_SIDES);
AnimStart();
}
}
Zeera Xi
Real Join Date: Mid '05
Join date: 21 Sep 2006
Posts: 54
09-29-2006 09:41
Ok the best way is to setup two scripts.

1. The Master script with the timer
2. Slave script with the anim functions

Basically the master script gives out a link message out to each slave at same time to tell them to re-sync ie. Switch off Anim and switch on again.

The Slave script should basically just do the switching on and off based on the link messages received.

Voila.

Simple low-lag system.

Its better than having each script have a timer or listener of its own.

The Master script could also be adjusted to change the speed with a bit more clever linkmessaging instead of replacing each slave script.