llListStatistics

From Second Life Wiki
Revision as of 15:07, 5 April 2008 by Xerdar Oh (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Summary

Function: float llListStatistics( integer operation, list src );

Returns a float that is the result of performing statistical aggregate function operation on src.

• integer operation a LIST_STAT_* flag
• list src

If a list entry type is not a float or an integer it is silently ignored.

Constant Description
LIST_STAT_RANGE 0 Returns the range.
LIST_STAT_MIN 1 Retrieves the smallest number.
LIST_STAT_MAX 2 Retrieves the largest number.
LIST_STAT_MEAN 3 Retrieves the mean (average).
LIST_STAT_MEDIAN 4 Retrieves the median number.
LIST_STAT_STD_DEV 5 Calculates the standard deviation.
LIST_STAT_SUM 6 Calculates the sum.
LIST_STAT_SUM_SQUARES 7 Calculates the sum of the squares.
LIST_STAT_NUM_COUNT 8 Retrieves the number of float and integer elements.
LIST_STAT_GEOMETRIC_MEAN 9 Calculates the geometric mean.

Examples

<lsl> // shows just how bad SL is behaving and demonstrates the use of llListStatistics() list dil_s; list fps_s;

default {

   state_entry ()
   {
       dil_s = [];
       fps_s = [];
       llSetTimerEvent (1.0);
   }
   
   on_rez (integer parm)
   {
       llResetScript ();
   }
   
   timer()
   {
       dil_s += llGetRegionTimeDilation ();
       fps_s += llGetRegionFPS ();
       integer n = llGetListLength (dil_s);
       while (n > 60) {
           dil_s = llDeleteSubList (dil_s, 0, 0);
           fps_s = llDeleteSubList (fps_s, 0, 0);
           n = llGetListLength (dil_s);
       }
       if (n > 3) {
               string s = "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_MEAN, dil_s) + "\n";
               s += "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);
               llSetText (s, <1,1,0>, 1);
       }
   }

}

</lsl>

See Also

Functions

•  llGetListEntryType

Deep Notes

Search JIRA for related Issues

Signature

function float llListStatistics( integer operation, list src );