LlLoopSoundMaster

De DigiWiki.

// for an uploaded .wav file called "MasterLoop" in inventory
llLoopSoundMaster("MasterLoop", 1.0);

The script below can be added to an object, to toggle a SoundMaster on and off. Note that the script requires a sound in inventory called MasterLoop, or you need to change the argument in the function for it to work. This script is a slight modification to the script Toggle_States, adding only the llLoopSoundMaster and llStopSound to make it work.

default {
    state_entry() {
        // run this code when entering the default state
        // displays red "OFF" as floating text above the prim
        llSetText("OFF", <1,0,0>, 1.0);
    }
    touch_start(integer num_detected) {
        // when touched, switch to state named 'on'
        state on;
    }
}
 
state on {
    state_entry() {
        // run this code when entering state 'on'
        // displays green "ON" as floating text above the prim
        llSetText("ON", <0,1,0>, 1.0);
        llLoopSoundMaster("MasterLoop", 1.0);
    }
    touch_start(integer num_detected) {
        // when touched, stop sound & switch back to the default state
        llStopSound();
        state default;
    }
}
Outils personnels
  • Cette page a été consultée 464 fois.
donate
Google Ads