|
Hinska Petrov
Registered User
Join date: 9 May 2007
Posts: 5
|
07-18-2008 10:03
I'm thinking this would be a very simple script, but since I'm still a bit new to scripting, im not sure of values, names, etc, but I'll make it as easy to understand as possible.
Bassicly, I'm using if statements to do this. What I have is an object with:
touch1(){ changeColorBy(10);
I need something like:
if color = 10 then play sound1 if color = 20 then play sound2 if color = 30 then play sound3 etc etc
any help would be appriciated
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
07-18-2008 13:32
Not sure which parts are the question. One can get the color of an object (or one face of an object) with llGetColor... which will return a vector of floats corresponding to RGB values. Then it's a question of how to map the RGB colorspace into the fixed set of sounds, so you can play them, probably with llPlaySound() (although llLoopSound(), llTriggerSound, or llTriggerSoundLimited() might be appropriate, depending on the desired effect).
Maybe, if there are just three sounds, you find which of the Red, Green, and Blue color values is the largest, and choose based on that. Or you add together the floats and play a sound based on total brightness (< 1.0 is the "dark" sound, > 2.0 is the "bright" sound, otherwise it's the "medium" sound). Or something.
_____________________
Archived for Your Protection
|