LlListStatistics/ja

From Second Life Wiki
Jump to navigation Jump to search

要約

関数: float llListStatistics( integer operation, list src );

統計・集計関数 operationsrc に対して行った結果を float で返します。

• integer operation a LIST_STAT_* フラグ
• list src

リストの要素タイプが float または integer でない場合、警告を出さずに無視されます。

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 幾何学的平均を返します。

サンプル

<lsl>// 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();
       }
   }
}</lsl>

注意点

この操作がリストの中の数字でない要素を無視することを逆手にとって、混合リストの中で、(LIST_STAT_NUM_COUNT を引数に渡して使うと) リストの中の数字要素の数を知らせることもできます。

関連項目

関数

•  llGetListEntryType

特記事項

Search JIRA for related Issues

テスト

•  llListStatistics Test

Signature

function float llListStatistics( integer operation, list src );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。