Say Region Frames Per Second

From Second Life Wiki
Revision as of 14:48, 7 October 2012 by Kireji Haiku (talk | contribs) (removed unnecessary listen from example script and changed to touch_start)
Jump to navigation Jump to search

<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.");
       if (27.0 < fps)
           llSay(PUBLIC_CHANNEL,
               "'" + region + "' is running smoothly.");
       else if (15.0 < fps)
           llSay(PUBLIC_CHANNEL,
               "'" + region + "' is running slowly.");
       else
           llSay(PUBLIC_CHANNEL,
               "CAUTION: '" + region + "' is in danger of crashing.");
   }

} </lsl>