Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

play sound randomly

LisaMaree Docherty
Registered User
Join date: 8 Mar 2007
Posts: 9
11-13-2007 14:00
i really need a script, that will play one sound at random intervals without touching the object. i have tried some i have found round the place, but often get errors.
I am really "script-illiterate"... can someone please help.
Teddy Qinan
Registered User
Join date: 10 Mar 2007
Posts: 34
11-13-2007 20:09
Well you obviously need a timer.

One was I have seen used is to create a random chance that a sound will play each timer event...
timer()
{
integer chance = 0.8;
if (chance < llFrand(1.0))
{
llPlaySound(sound, 0.25); //1.0 can be heard half way across a sim
}
}


or you could try adjusting the timer event...

timer()
{
llPlaySound(sound, 0.25);
llSetTimerEvent(llFrand(5.0));
}