LlGetDayLength

来自人工智能助力教育知识百科
跳转至: 导航搜索
函数名
Function: integer llGetDayLength( )
参数:无
返回值:返回应用于当前包裹的天周期中的秒数。llGetDayLength返回当前包裹的秒数,llGetRegionDayLength是一天周期中应用到整个区域的秒数。
注意事项
注意事项
示例
// print the apparent time of day as HH:MM (%), just like the environment window in the viewer.
// Time of day is a fraction between 0 and 1, 0 is midnight, 0.5 is noon
string printTimeOfDay(float dayFraction) {
    integer hours = (integer)(dayFraction * 24);
    integer minutes = (integer)(dayFraction * 24 * 60) % 60;
    integer percent = (integer)(dayFraction * 100);
    return (string)hours + ":" + llGetSubString((string)(100+minutes), 1, 2) + " (" + (string)percent + "%)";
}
 
default {
    state_entry() {
        llSetTimerEvent(5);
    }
 
    timer() {
        float timeOfDay = (llGetUnixTime() + llGetDayOffset()) % llGetDayLength() * 1.0 / llGetDayLength();
        llSetText(printTimeOfDay(timeOfDay), <1,1,0>, 1);
    }
}
相关函数
llGetDayLength

llGetDayOffset

llGetMoonDirection

llGetMoonRotation

llGetSunDirection

llGetSunRotation

llGetRegionDayLength

llGetRegionDayOffset

llGetRegionMoonDirection

llGetRegionMoonRotation

llGetRegionSunDirection

llGetRegionSunRotation

相关事件