LlListStatistics/ja
Jump to navigation
Jump to search
LSL ポータル | 関数 | イベント | 型 | 演算子 | 定数 | 実行制御 | スクリプトライブラリ | カテゴリ別スクリプトライブラリ | チュートリアル |
要約
関数: float llListStatistics( integer operation, list src );
Constant | 説明 | |
---|---|---|
LIST_STAT_RANGE | 0 | 範囲を計算します。 |
LIST_STAT_MIN | 1 | 最小値を計算します。 |
LIST_STAT_MAX | 2 | 最大値を計算します。 |
LIST_STAT_MEAN | 3 | 平均を計算します。 |
LIST_STAT_MEDIAN | 4 | 中央値を計算します。 |
LIST_STAT_STD_DEV | 5 | 標準偏差を計算します。 |
LIST_STAT_SUM | 6 | 合計を計算します。 |
LIST_STAT_SUM_SQUARES | 7 | 平方和を計算します。 |
LIST_STAT_NUM_COUNT | 8 | float integer の要素数を調べます。 |
LIST_STAT_GEOMETRIC_MEAN | 9 | 幾何学的平均を返します。 |
サンプル
// SL のふるまいのおかしさと、llListStatistics() の使い方を示しています。
list dil_s;
list fps_s;
integer ticks;
default
{
state_entry()
{
llSetTimerEvent(1.0);
}
on_rez (integer parm)
{
llResetScript();
}
timer()
{
dil_s = llList2List(dil_s + llGetRegionTimeDilation(), -60, -1);
fps_s = llList2List(fps_s + llGetRegionFPS(), -60, -1);
if(3 > ++ticks)
{
llSetText(
"Dilation: min="+(string) llListStatistics(LIST_STAT_MIN, dil_s) + ", mean=" +
(string) llListStatistics(LIST_STAT_MEAN, dil_s) + ", max=" +
(string) llListStatistics(LIST_STAT_MAX, dil_s) + ", std.dev=" +
(string) llListStatistics(LIST_STAT_STD_DEV, dil_s) + "\n" +
"FPS: min="+(string) llListStatistics(LIST_STAT_MIN, fps_s) + ", mean=" +
(string) llListStatistics(LIST_STAT_MEAN, fps_s) + ", max=" +
(string) llListStatistics(LIST_STAT_MAX, fps_s) + ", std.dev=" +
(string) llListStatistics(LIST_STAT_STD_DEV, fps_s),
<1.0, 1.0, 0.0>, //yellow
1.0);
}
}
changed(integer change)
{
if(change & CHANGED_REGION)
{
llResetScript();
}
}
}
注意点
この操作がリストの中の数字でない要素を無視することを逆手にとって、混合リストの中で、(LIST_STAT_NUM_COUNT を引数に渡して使うと) リストの中の数字要素の数を知らせることもできます。
関連項目
関数
• | llGetListEntryType |
特記事項
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。