A Touching Event

integer r;
integer g;
integer b;
vector colour;

default
{
    link_message(integer sender_num, integer num, string str, key id)
    {
        colour = (vector) str;
        llSetColor(colour, ALL_SIDES);
        r = (integer)(colour.x * 255);
        g = (integer)(colour.y * 255);
        b = (integer)(colour.z * 255);

        llSetText((string) r + "," + (string) g + "," + (string) b, colour, 1.0);
    }
}

If you’re concerned about performance, you could do it the other way round: leave the main prim just to send the range coordinates, and do the math on the sphere’s script. I’ve added some hovertext to display the colours in float (on the Colour Cube) and in decimal (on the sphere), just as a visual feedback to be sure I was doing this correctly. You can obviously remove them, as well as the float-to-decimal conversion — hovertext is laggy, although, again, compiling it on Mono you won’t see any issues.

Many, many thanks to Qarl Linden and his amazing talent to develop the kind of features that will have huge impact on how future Second Life devices will work! Now you can have a one-prim-HUD and simplify dramatically your interface with just a single click 🙂 I’m eager to try this out on the main grid… very, very soon!

| ← Previous | | | Next → |
%d bloggers like this: