Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Face Colour

Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
04-26-2006 11:17
This is a simple script that colours all the faces of an object and gives you a key so you know which one is which. Handy for working out what number that odd side is!

It is also non-destructive, in that it colours sides, but takes a note of what colour they were so you can reset them.

To use, simply create a script in the object you wish to colour, then copy/paste this into it and save. Once it has saved it will tell you it is ready at which point you may simply touch your object to colour the sides, then touch again to reset them to their previous colour.

This is best used when applied to an object with no textures, or transparency applied to it yet, though most objects will work fine.

CODE
list colours = [
"red", <1.0,0.0,0.0>,
"green", <0.0,1.0,0.0>,
"blue", <0.0,0.0,1.0>,
"yellow", <1.0,1.0,0.0>,
"cyan", <0.0,1.0,1.0>,
"magenta", <1.0,0.0,1.0>,
"orange", <1.0,0.5,0.0>,
"violet", <1.0,0.0,0.5>,
"white", <1.0,1.0,1.0>,
"black", ZERO_VECTOR,
"grey", <0.5,0.5,0.5>,
"pink", <1.0, 0.75,0.75>,
"brown", <0.529, 0.318, 0.118>,
"dark red", <0.33,0.0,0.0>,
"dark blue", <0.33,0.0,0.0>,
"dark green", <0.33,0.0,0.0>
];
integer colourListSize;
integer colourStride = 2;
list oldColours;

default {
state_entry() {
colourListSize = llGetListLength(colours) / colourStride;
state ready;
}
}

state ready {
state_entry() {llOwnerSay("Face colour is ready, touch object to colour code the sides"); }

touch_start(integer x) {
oldColours = [];
x = llGetNumberOfSides();
if (x > colourListSize)
llOwnerSay("This object has more faces than I have colours to assign! "+
"Please enter more to the list");
else {
integer i; integer l;
for (i = 0, l = 0; i < x; ++i, ++l) {
oldColours += [llGetColor(i)];
llOwnerSay("Side "+(string)i+" was coloured "+
(string)llList2String(colours, l++));
llSetColor(llList2Vector(colours, l), i);
}
llOwnerSay("Colouring complete, touch again to reset colours");
state done;
}
}
}

state done {
touch_start(integer x) {
integer i; x = llGetListLength(oldColours);
for (i = 0; i < x; ++i) llSetColor(llList2Vector(oldColours,i), i);
oldColours = [];
state ready;
}
}
Neb Soyer
Really good looking.
Join date: 9 Apr 2006
Posts: 45
05-03-2006 16:40
Very nice. I will definately find this useful.
_____________________
down in the ghetto.
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
05-23-2006 18:11
This is interesting and useful, but it is MUCH easier to just use ctrl+alt+shift+t with the texture selected.