Difference between revisions of "Say Region Frames Per Second"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
float fps;
<source lang="lsl2">
string frames;
string region;
float home=FALSE;
default
default
{
{
     state_entry()
     touch_start(integer num_detected)
     {
     {
         llListen(0,"",llGetOwner(),"region fps");
         float fps = llGetRegionFPS();
    }
        string region = llGetRegionName();
    listen(integer c,string n,key i,string m)
 
    {
        llSay(0, "Region '" + region + "' is running at " + (string)fps + " fps.");
        if(m=="region fps")
 
        {
        string moreInfo = "CAUTION: '" + region + "' is in danger of crashing.";
            fps=llGetRegionFPS();
 
            frames=(string)(fps);
        if (fps > 15)
            region=llGetRegionName();
             moreInfo = "'" + region + "' is running slowly.");
            llSay(0,region+" fps is:"+frames);
 
            if(fps > 27)
        if (fps > 27)
            {
             moreInfo = "'" + region + "' is running smoothly.");
                llSay(0,region+" is running smoothly");
 
            }
        llSay(0, moreInfo);
            if(fps > 22 && fps < 15 )
             {
                llSay(0,region+" is running slowly");
            }
            if(fps < 15)
             {
                llSay(0,"CAUTION:"+region+" is in danger of crashing");
            }
            llResetScript();
        }   
     }
     }
}
}
</source>
{{LSLC|Examples}}
{{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);
    }
}