163bc3822910e5a77cc04d5e57312804629f6d9b
[feisty_meow.git] / huffware / huffotronic_scripts / hamster_sound_effects_v0.8.txt
1 
2 // huffware script: hamster sound effects, by fred huffhines
3 //
4 // a randomizing sound player, originally used to replace a sound
5 // playing script with bad perms in a freebie hamster.
6 //
7 //   this script is licensed by the GPL v3 which is documented at: http://www.gnu.org/licenses/gpl.html
8 //   do not use it in objects without fully realizing you are implicitly accepting that license.
9 //
10
11 list all_sounds;
12
13 default
14 {
15     state_entry() { if (llSubStringIndex(llGetObjectName(),  "huffotronic") < 0) state real_default; }
16     on_rez(integer parm) { state rerun; }
17 }
18 state rerun { state_entry() { state default; } }
19
20 state real_default {
21     state_entry() {
22         llStopSound();
23         integer indy;
24         for (indy = 0; indy < llGetInventoryNumber(INVENTORY_SOUND); indy++) {
25             all_sounds += [ llGetInventoryName(INVENTORY_SOUND, indy) ];
26         }
27     }
28
29     touch_start(integer cnt) {
30         all_sounds = llListRandomize(all_sounds, 1);
31         llTriggerSound(llList2String(all_sounds, 0), 1.0);
32     }
33     
34     changed(integer change) {
35         if (change & CHANGED_INVENTORY) llResetScript();  // reset when sounds might have changed.
36     }
37 }
38