“LlAdjustSoundVolume”的版本间的差异

来自人工智能助力教育知识百科
跳转至: 导航搜索
Kjf讨论 | 贡献
 
(未显示1个用户的3个中间版本)
第4行: 第4行:
 
{{函数详情
 
{{函数详情
 
|函数名=Function: llAdjustSoundVolume( float volume );
 
|函数名=Function: llAdjustSoundVolume( float volume );
|参数= 参数:• float
+
|参数= 参数:float volume – 介于 0.0 (沉默) 1.0 (最大声)之间 (0.0 <= volume <= 1.0)
volume  
+
|返回值= 返回值:无返回值,会调整附着物的音量
–  
 
between 0.0 (silent) and 1.0 (loud) (0.0 <= volume <= 1.0)
 
|返回值= 返回值:Adjusts volume of attached sound.
 
  
  
|注意事项=This function causes the script to sleep for 0.1 seconds.
+
|注意事项=‎此函数使脚本睡眠 0.1 秒。
  
  
 
|示例=
 
|示例=
示例1
 
 
<pre>
 
<pre>
//  This example exercises the full valid range of argument from -1.0 to +1.0
 
 
 
default
 
default
 
{
 
{
     touch_start(integer num_detected)
+
     state_entry()
 
     {
 
     {
         float random = llFrand(2.0) - 1.0;
+
         llListen(42, "", llGetOwner(), "");
 
        llOwnerSay("The arccosine of " + (string)random + " is " + (string)llAcos(random));
 
 
     }
 
     }
}
 
</pre>
 
 
示例2
 
<pre>
 
//An example for the Law of Cosines to calculate any angle of a triangle from 3 known side lengths.
 
 
   
 
   
default
+
     listen(integer chan, string name, key id, string msg)
{
+
     {
     touch_start(integer num_detected)
+
         float value = (float)msg;
     {      
+
         llAdjustSoundVolume(value);
         vector t=< llFrand(9.0)+1.0 , llFrand(9.0)+1.0 , llFrand(9.0)+1.0 >; //the 3 values of this vector are used to set the lengths of 3 sides of a triangle.
+
         llOwnerSay("Volume set to: " + (string)value + " of 1.0");
 
         float anglexy=llAcos( (t.x*t.x+t.y*t.y-(t.z*t.z)) / ( 2*t.x*t.y) ) //Law Of Cosines
 
 
         llOwnerSay("Using the Law Of Cosines, the angle of a triangle between side a="+(string)t.x+"and side b="+(string)t.y+"is = "+(string)anglexy+" radians="+(string)(anglexy*RAD_TO_DEG)+"° and that angle is not on side c="+(string)t.z);
 
 
     }
 
     }
 
}
 
}
 
</pre>
 
</pre>
  
|相关函数=
+
|相关函数=
[[llSin]] [[llAsin]] –sine & inverse Sine
 
[[llCos]] –cosine
 
[[llTan]] [[llAtan2]] –tangent & inverse tangent
 
 
}}
 
}}

2021年8月16日 (一) 08:44的最新版本

Template:Needs Translation/


函数名
Function: llAdjustSoundVolume( float volume );
参数:float volume – 介于 0.0 (沉默) 和 1.0 (最大声)之间 (0.0 <= volume <= 1.0)
返回值:无返回值,会调整附着物的音量
注意事项
‎此函数使脚本睡眠 0.1 秒。
示例
default
{
    state_entry()
    {
        llListen(42, "", llGetOwner(), "");
    }
 
    listen(integer chan, string name, key id, string msg)
    {
        float value = (float)msg;
        llAdjustSoundVolume(value);
        llOwnerSay("Volume set to: " + (string)value + " of 1.0");
    }
}
相关函数
相关事件