Jump to content
crazydudemartijn

searching for a script

Recommended Posts

im searching for a script that colors a object by usings the nearest persons uuid within 10 meters if it cant find any it uses owners uuid

for all faces and linked parts

Share this post


Link to post
Share on other sites

cheapo idea:

modulo UUID by 256 -> treat result as 8bit colour -> run algorithm to convert result into the 3 8bit RGB modern computers use

 

Share this post


Link to post
Share on other sites
39 minutes ago, Fionalein said:

cheapo idea:

modulo UUID by 256 -> treat result as 8bit colour -> run algorithm to convert result into the 3 8bit RGB modern computers use

 

Good ol' binary. Might as well.

vector Key2Color(key id)
{
    integer value = (integer)("0x" + llGetSubString(id, 0, 5));
    return <(value&255)/255.0, ((value>>8)&255)/255.0, ((value>>16)&255)/255.0>;
}

default
{
    state_entry()
    {
        llSetColor(Key2Color(llGetOwner()), ALL_SIDES);
    }
}

In short, the function I wrote above takes the first 6 characters of any given UUID (RGB is 6 hexadecimal symbols long), converts them into an integer (so we can use bitwise operators), and checks the first 8 bits (2 hexadecimal symbols) which will give you a value between 0 and 255, then divides that value by 255 to get down to the proper [0.0 - 1.0] range used for color vectors in LSL.

The rest is up to you.

  • Like 2

Share this post


Link to post
Share on other sites

hmm, could combine this with someone's height maybe to be a more unique aura assuming some uuids might result in the same color alone

Share this post


Link to post
Share on other sites
1 minute ago, Ruthven Willenov said:

hmm, could combine this with someone's height maybe to be a more unique aura assuming some uuids might result in the same color alone

You are correct with your concern. Even if you took a larger set of characters to turn into an integer, there could still be two people with the same integer, or "close enough." No matter how much randomization you add into the mix, there will be "collisions."

The human eye can't detect enough colors to guarantee every person to have a unique color from each other.

Share this post


Link to post
Share on other sites

I'm not sure if the objective is for these to be visually distinctive to the human eye, or if the goal is to encode a UUID in the surface tint of enough faces and links to be a persistent record perhaps for use by a script that might need to recover the information after being reset.

If the latter, the alpha channel could add another eight bits to each face, and of course there are lots of other properties that might be set -- especially if the object is made of prims rather than mesh. Finding places to squirrel-away such data used to be a thing. Historically, some of these have gotten in trouble by relying on fields that later were truncated or subject to different validation.

Share this post


Link to post
Share on other sites
Posted (edited)
5 hours ago, Qie Niangao said:

I'm not sure if the objective is for these to be visually distinctive to the human eye, or if the goal is to encode a UUID in the surface tint of enough faces and links to be a persistent record perhaps for use by a script that might need to recover the information after being reset.

If the latter, the alpha channel could add another eight bits to each face, and of course there are lots of other properties that might be set -- especially if the object is made of prims rather than mesh. Finding places to squirrel-away such data used to be a thing. Historically, some of these have gotten in trouble by relying on fields that later were truncated or subject to different validation.

My understanding was that OP wants the whole object be one color based on the key of the closest avatar. It doesn't sound like they want to store any real info. 

Edited by Wulfie Reanimator
  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×