Say Region Frames Per Second

From Second Life Wiki
Revision as of 13:47, 18 October 2012 by Kireji Haiku (talk | contribs) (minor optimization)
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.

<lsl> default {

   touch_start(integer num_detected)
   {
       float fps = llGetRegionFPS();
       string region = llGetRegionName();
       // PUBLIC_CHANNEL has the integer value 0
       llSay(PUBLIC_CHANNEL,
           "Region '" + region + "' is running at " + (string)fps + " fps.");
       string moreInfo = "CAUTION: '" + region + "' is in danger of crashing.";
       if (27.0 < fps)
           moreInfo = "'" + region + "' is running smoothly.");
       else if (15.0 < fps)
           moreInfo = "'" + region + "' is running slowly.");
       llSay(PUBLIC_CHANNEL, moreInfo);
   }

} </lsl>