Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sound Script

SirSticky Hornpipe
Registered User
Join date: 24 Jun 2005
Posts: 43
11-04-2006 09:56
Hi :)
I'm looking for a script that plays a sound when an AV walks past an object,
but i only want it to play when the AV walks close by it and only once unless the AV walks past it again.
any ideas where i could find a script like that?
SirSticky Hornpipe
Registered User
Join date: 24 Jun 2005
Posts: 43
figured out some of it
11-04-2006 11:06
i've figured out how to do it by altering a welcome script i found, but the sound delay part does not seem to work the 10 seconds i have set on it does not work.
Can anyone help me .... here is the script:

CODE

string SoundName = "Sound";
float volume = 1.0; // Vol
float Sounddelay = 10;// time delay

integer SoundOn = FALSE;
key SoundKey;

default
{
state_entry()
{
SoundKey = llGetInventoryKey(SoundName);
llSleep(Sounddelay);
}

collision(integer total_number)
{
if (SoundOn == FALSE) {
llPlaySound(SoundKey, volume);


}
}
}
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-04-2006 12:20
Not sure exactly what you are trying to achieve with the llSleep call.
What its actually doing is just sleeping the state entry processing for 10 seconds, which in thsi situation is pointless since there is no furtehr processing.

Collision is triggered while something is colliding with the prim which I dont think is what you need. Use collision_start instead. This will trigger the sound when something first starts colliding.

If you want something to trigger when soemthing is near by use a repeating sensor, or a second volume detect prim.