Difference between revisions of "Key2RGB"
Jump to navigation
Jump to search
Pazako Karu (talk | contribs) (Created page with "= key2RGB = Free to use in any context for any reason. Provided by Pazako Karu Convert a key to a color vector in RGB. Useful for assigning colors to specific avatars in a si...") |
m (Replaced <source> with <syntaxhighlight>; added category & LSL Header; probably should become a 'user function' with the appropriate template, if only I could figure out where to place the code...) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{LSL Header}} | |||
Free to use in any context for any reason. Provided by Pazako Karu | Free to use in any context for any reason. Provided by Pazako Karu | ||
Line 6: | Line 7: | ||
Each key will generate a unique color specific to that key. | Each key will generate a unique color specific to that key. | ||
< | <syntaxhighlight lang="lsl2"> | ||
vector key2RGB(key input) | vector key2RGB(key input) | ||
{ | { | ||
Line 12: | Line 13: | ||
return llVecNorm(<intColor%16777216, intColor%65536, intColor%256>); // 256^3, 256^2, 256^1 | return llVecNorm(<intColor%16777216, intColor%65536, intColor%256>); // 256^3, 256^2, 256^1 | ||
} | } | ||
</ | </syntaxhighlight> | ||
[[Category:LSL Examples]] |
Latest revision as of 13:38, 9 March 2023
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Free to use in any context for any reason. Provided by Pazako Karu
Convert a key to a color vector in RGB. Useful for assigning colors to specific avatars in a single direction.
Each key will generate a unique color specific to that key.
vector key2RGB(key input)
{
integer intColor = llAbs((integer)("0x" + llGetSubString(llMD5String(input,0), 0, 7)));
return llVecNorm(<intColor%16777216, intColor%65536, intColor%256>); // 256^3, 256^2, 256^1
}