Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Client-Side Color Loop

Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
01-14-2005 20:21
Moving from simple script to insane script to simple again, here's a ubiquitous script I should have posted a long time ago.

CODE
//Passive, Client-Side Color-Changer by Jeffrey Gomez
//Please use this. It saves a lot of color-swap grief. =D

key colorpallete = "0c23e2ea-a6aa-4ee5-7d86-efafa4b9e221";
//Basic image I uploaded that defines the useable colors.
//For those wondering, this is the MS Paint default pallete, minus black :P
default
{
state_entry()
{
llSetTexture(colorpallete,ALL_SIDES);
llSetTextureAnim(ANIM_ON | LOOP,ALL_SIDES,5,5,0,0,1);
}
}


Looks can be deceiving on why I choose this, out of all the scripts I've written, to put up. Put simply...

If you enjoy color changers in a script, use a variant of this instead of an llSetColor loop. Please! :o

I cannot stress this enough. Cheers to a little bird for giving me the idea to write this.

Simply put, this script is a grief-ender. It solves the problem of having 500 flashing lights going off 50 times, all while making server calls. Instead, this script only makes a single call when invoked, either by the server or a client entering viewing range. Much, much better on the sim as a result.

And for those wondering, here's the sample color palette I've used. You can easily alter it and/or the script to better fit your tastes. The script will run right out of the box, but it uses a texture UUID I uploaded.
Upshaw Underhill
Techno-Hobbit
Join date: 13 Mar 2003
Posts: 293
Original Thread
01-16-2005 23:57
/15/de/33008/1.html


original post that i jacked

one thing I would add to this, as I suggested in this post is that since texture anims are not only client side but are a permanent property of a prim all you have to do to completely eliminate the server having to think about this blinker again is add a llRemoveInventory(llGetScriptName());

if every single llSetText, llParticleSystem, llSetTextureAnim, that never updates would do this we'd save a bunch of extra server cycles.

L8r,
UU
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
02-02-2005 20:13
The problem with this is that it replaces any texture you currently have on the prim, thereby making this script useless if you want the actual light COLOR changed.

But thanks, though.
Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
06-02-2005 14:55
Well maybe if you put another semi-transparent prim around the one whose color you want to change, and have that cycles colors, you could do it.
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.
a lost user
Join date: ?
Posts: ?
08-26-2005 20:18
That or make your own textured/multi colored .gif and upload it. =P
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
server-side vs. client-side
03-19-2006 16:39
Really, this is all just more hassle than it's worth. LL simply needs to implement server-side functions for most, if not all, functions. Not EVERYTHING needs to be server-side. Everyone doesn't NEED to have EVERYTHING in-sync. Movement, rotation, scaling, primitive parameters, etc, could all be animated MUCH smoother if client-side. Active Worlds does this and it works well--and it even has a new "global" command where EVERYONE (in range) sees/hears the same SMOOTH effect.
Kyrah Abattoir
cruelty delight
Join date: 4 Jun 2004
Posts: 2,786
03-28-2006 10:03
hmm usually its the coder that adapt to its environement, not the opposite.

GG jeffrey
_____________________

tired of XStreetSL? try those!
apez http://tinyurl.com/yfm9d5b
metalife http://tinyurl.com/yzm3yvw
metaverse exchange http://tinyurl.com/yzh7j4a
slapt http://tinyurl.com/yfqah9u
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-28-2006 11:55
From: Eep Quirk
*

Preacher, meet choire. :D
_____________________
---
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
03-28-2006 14:58
From: Eep Quirk
Movement, rotation, scaling, primitive parameters, etc, could all be animated MUCH smoother if client-side.
IIRC for all those functions (at least on non physical objects) the animation is client side. As far as the server is concerned the object jumps to the new position/rotation/scale. The client does all of the smooth animation stuff. This is one reason we can't control the amount of time the object appears to take moving to its new position.
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-28-2006 15:29
From: Jeffrey Gomez
If you enjoy color changers in a script, use a variant of this instead of an llSetColor loop. Please! :o
Hmmm. Textures versus prims again. If you have 500 flashing lights this is probably a win. If you have one flashing light, how many color updates does one texture download amount to?

How about "stretching" the texture over the prim face more? You really only need one pixel of each color if you arrange the offsets and repeats for the texture correctly.
Merlin Alphabeta
Registered User
Join date: 12 Feb 2006
Posts: 83
New Service
04-14-2006 10:50
Ok so this is a great idea

But why not generalize it? I now have a program that will generate ANY color gradient you want for use in a script like this, provided there is some kind of mathematical ordering to the segments.

I have a full RGB palette (5-bits per color) done already. next up is probably a hue gradient. If anyone wants a specific gradient IM me inworld and I'll whip one up for you... unless it's extremely complicated, it'll cost you $100L and it shouldn't take me more than 5 minutes or so...

Jeffrey, you get freebies of course lol