Allison Andric
Registered User
Join date: 28 Sep 2005
Posts: 30
|
12-17-2005 03:31
I was wondering if anyone had a script that would make it so when I click on my object, it would make a random sound out of say, five wavs, kinda like one of those action figures with the stupid random sayings 
|
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
|
12-17-2005 03:50
I'm unable to get in world right now, so I hope this compiles correctly for you. integer InvSounds; integer ChooseSound; string PlaySound; default { state_entry() { InvSounds = llGetInventoryNumber(INVENTORY_SOUND); } on_rez(integer r) { llResetScript(); } touch_start(integer total_number) { ChooseSound = llRound(llFrand(InvSounds)); PlaySound = llGetInventoryName(INVENTORY_SOUND,ChooseSound); llTriggerSound(PlaySound,1.0); } } Hope that helps :}
|
Allison Andric
Registered User
Join date: 28 Sep 2005
Posts: 30
|
12-17-2005 04:05
From: Cid Jacobs I'm unable to get in world right now, so I hope this compiles correctly for you. integer InvSounds; integer ChooseSound; string PlaySound; default { state_entry() { InvSounds = llGetInventoryNumber(INVENTORY_SOUND); } on_rez(integer r) { llResetScript(); } touch_start(integer total_number) { ChooseSound = llRound(llFrand(InvSounds)); PlaySound = llGetInventoryName(INVENTORY_SOUND,ChooseSound); llTriggerSound(PlaySound,1.0); } } Hope that helps :} I need for it to play random sounds though, as in, being able to load 5 or 6 sounds into the object so it spits out a random wave each time it is touched 
|
Alondria LeFay
Registered User
Join date: 2 May 2003
Posts: 725
|
12-17-2005 08:46
This script will.... drop your sound files into the object and then this script.
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
12-17-2005 11:44
add a changed event and you can add or remove sounds to your hearts content integer InvSounds; integer ChooseSound; string PlaySound;
integer change; default { state_entry() { InvSounds = llGetInventoryNumber(INVENTORY_SOUND); change = CHANGED_ALLOWED_DROP | CHANGED_INVENTORY; } changed(integer a) { if(a & change) InvSounds = llGetInventoryNumber(INVENTORY_SOUND); } on_rez(integer r) { llResetScript(); } touch_start(integer total_number) { ChooseSound = llRound(llFrand(InvSounds)); PlaySound = llGetInventoryName(INVENTORY_SOUND,ChooseSound); llTriggerSound(PlaySound,1.0); } }
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|