Difference between revisions of "Say Region Frames Per Second"

From Second Life Wiki
Jump to navigation Jump to search
m (minor optimization)
m (<lsl> tag to <source>)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<lsl>
<source lang="lsl2">
default
default
{
{
Line 7: Line 7:
         string region = llGetRegionName();
         string region = llGetRegionName();


        // PUBLIC_CHANNEL has the integer value 0
         llSay(0, "Region '" + region + "' is running at " + (string)fps + " fps.");
         llSay(PUBLIC_CHANNEL,
            "Region '" + region + "' is running at " + (string)fps + " fps.");


         string moreInfo = "CAUTION: '" + region + "' is in danger of crashing.";
         string moreInfo = "CAUTION: '" + region + "' is in danger of crashing.";


         if (27.0 < fps)
         if (fps > 15)
            moreInfo = "'" + region + "' is running slowly.");
 
        if (fps > 27)
             moreInfo = "'" + region + "' is running smoothly.");
             moreInfo = "'" + region + "' is running smoothly.");


         else if (15.0 < fps)
         llSay(0, moreInfo);
            moreInfo = "'" + region + "' is running slowly.");
 
        llSay(PUBLIC_CHANNEL, moreInfo);
     }
     }
}
}
</lsl>
</source>
{{LSLC|Examples}}
{{LSLC|Examples}}
{{LSLC|Library}}
{{LSLC|Library}}

Latest revision as of 16:51, 24 January 2015

default
{
    touch_start(integer num_detected)
    {
        float fps = llGetRegionFPS();
        string region = llGetRegionName();

        llSay(0, "Region '" + region + "' is running at " + (string)fps + " fps.");

        string moreInfo = "CAUTION: '" + region + "' is in danger of crashing.";

        if (fps > 15)
            moreInfo = "'" + region + "' is running slowly.");

        if (fps > 27)
            moreInfo = "'" + region + "' is running smoothly.");

        llSay(0, moreInfo);
    }
}