|
Zakia Drum
Registered User
Join date: 25 Aug 2006
Posts: 3
|
08-27-2006 13:37
Firstly let me apologise to all the seasoned scripters for the noob question!!
I need help finding a script that will play a wav file that is in a prims inventory. I've seen items in SL that you can touch to start a looped sound but cant seem to find any info on how to script it.
If anyone can help or point me in the right direction it would be great!
Thanks In Advance
Zakia
|
|
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
|
08-27-2006 14:17
this should do it integer group = FALSE; integer anyone = FALSE; integer on = FALSE; string sound_name; float volume;
integer allowed( key lid ) { if ( lid == llGetOwner() ) {return TRUE;} if ( group ) { if ( llSameGroup( lid ) ) {return TRUE;} } if ( anyone ) {return TRUE;} return FALSE; }
init() { group = FALSE; anyone = FALSE; if ( llGetInventoryType( "allow_group" ) == INVENTORY_NOTECARD ) { group = TRUE; } if ( llGetInventoryType( "allow_anyone" ) == INVENTORY_NOTECARD ) { anyone = TRUE; } llStopSound(); on = FALSE; } default { state_entry() { init(); } on_rez( integer r ) { init(); } changed( integer c ) { if ( c & CHANGED_OWNER ) { llResetScript(); } } touch_start( integer t ) { if ( allowed( llDetectedKey(0) )) { if ( on ) { on = FALSE; llStopSound(); } else { on = TRUE; sound_name = llGetInventoryName( INVENTORY_SOUND ,0 ); volume = 1.0; llLoopSound( sound_name,volume ); } } } }
It is set to allow only owner to use it - touch it and it starts playing the first sound file it finds in the prim. Touch it again to stop. If you want to allow your group to use it put a notecard called allow_group in the prim contents. If you want to allow anyone to use it put a notecard called allow_anyone in the prim contents. Forgive any syntaxes - havent compiled/tested it
|
|
Zakia Drum
Registered User
Join date: 25 Aug 2006
Posts: 3
|
08-27-2006 14:33
Thats great - Im going to try it now - well, as soon as darthVader stops flying his spaceship around my work platform!
Thanks Very Much
|
|
Zakia Drum
Registered User
Join date: 25 Aug 2006
Posts: 3
|
08-27-2006 14:40
Many Thanks Adriana
It works an absolute treat!!!
Zakia
|
|
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
|
08-27-2006 14:49
Your Welcome 
|