LlLoopSoundMaster

来自人工智能助力教育知识百科
跳转至: 导航搜索

Template:Needs Translation/


函数名
Function: llLoopSoundMaster( string sound, float volume );
参数:

• string sound – a sound in the inventory of the prim this script is in or a UUID of a sound

• float volume – between 0.0 (silent) and 1.0 (loud) (0.0 <= volume <= 1.0)

返回值:

播放附加声音循环在音量,声明它是一个同步主机。

注意事项
注意事项
  • 如果声音是从 prim 的库存丢失,它不是一个 uuid 或它不是一个声音,然后一个错误是在调试通道喊叫。
  • 如果声音是 uuid,那么对象不会有新的资产权限结果。
结果对象不会产生任何新的使用限制,如果资产被放置在 prims 库存中,则可能会产生这种限制。
示例
// for an uploaded .wav file called "MasterLoop" in inventory
llLoopSoundMaster("MasterLoop", 1.0);

下面的脚本可以添加到一个对象中,来切换一个 soundmaster 的开关。注意,脚本需要一个名为 masterloop 的声音,或者需要更改函数中的参数才能工作。

//This integer (actually a boolean) will be used to manage the toggle effect.
integer soundState = FALSE;
//Change MasterLoop to the sound clip you want to use.
string soundClip = "MasterLoop";
default {
    state_entry()
    {
        //Displays red "OFF" as floating text above the prim
        llSetText("OFF", <1,0,0>, 1.0);
    }
    touch_start(integer num_detected)
    {
        //When touched, soundState inverts its current boolean value. 1 becomes 0, 0 becomes 1. 
        soundState = !soundState;
        if(soundState)
        {
            //Run this code when entering soundState 'on'
            //Displays green "ON" as floating text above the prim
            llSetText("ON", <0,1,0>, 1.0);
            llLoopSoundMaster(soundClip, 1.0);
        }else
        {   //Run this code when entering soundState 'off'
            //When touched, stop sound & display red "OFF" as floating text.
            llSetText("OFF", <1,0,0>, 1.0);
            llStopSound();
        }
    }
}
相关函数
llLoopSound--无限期地播放附加的声音

llLoopSoundSlave

llPlaySoundSlave--播放过一次声音

相关事件