以下是控制音量的示例,将这个脚本和bell音乐放在一起,当在公共频道说low,medium,high是音量会不同.
float volumeLow=0.3; // make a volumelowvariable
float volumeMedium=0.6;
float volumeHigh=1.0;
default
{
state_entry()
{
llListen(0,"",NULL_KEY,""); //listen on channel 0 to anyone
}
listen(integer channel,string name,key id,string message) //this is the listen event
{
if (message=="low") //if someone says low
{
llPlaySound("bell",volumeLow);
}
if (message=="medium") //if someone says Medium
{
llPlaySound("bell",volumeMedium);
}
if (message=="high") //if someone says Medium
{
llPlaySound("bell",volumeHigh);
}
}
}