Difference between revisions of "Say Region Frames Per Second"

From Second Life Wiki
Jump to navigation Jump to search
m (removed unnecessary listen from example script and changed to touch_start)
m (minor optimization)
Line 10: Line 10:
         llSay(PUBLIC_CHANNEL,
         llSay(PUBLIC_CHANNEL,
             "Region '" + region + "' is running at " + (string)fps + " fps.");
             "Region '" + region + "' is running at " + (string)fps + " fps.");
        string moreInfo = "CAUTION: '" + region + "' is in danger of crashing.";


         if (27.0 < fps)
         if (27.0 < fps)
             llSay(PUBLIC_CHANNEL,
             moreInfo = "'" + region + "' is running smoothly.");
                "'" + region + "' is running smoothly.");


         else if (15.0 < fps)
         else if (15.0 < fps)
             llSay(PUBLIC_CHANNEL,
             moreInfo = "'" + region + "' is running slowly.");
                "'" + region + "' is running slowly.");


         else
         llSay(PUBLIC_CHANNEL, moreInfo);
            llSay(PUBLIC_CHANNEL,
                "CAUTION: '" + region + "' is in danger of crashing.");
     }
     }
}
}

Revision as of 12:47, 18 October 2012

<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>