Difference between revisions of "Say Region Frames Per Second"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
float fps;
<pre>
string frames;
string region;
float home=FALSE;
float home=FALSE;
default
default
Line 8: Line 6:
     {
     {
         llListen(0,"",llGetOwner(),"region fps");
         llListen(0,"",llGetOwner(),"region fps");
    }
    on_rez()
    {
        llResetScript();
     }
     }
     listen(integer c,string n,key i,string m)
     listen(integer c,string n,key i,string m)
     {
     {
         if(m=="region fps")
         float fps = llGetRegionFPS();
        string region = llGetRegionName();
        llSay(0,region + " fps is:" + (string)fps);
        if(fps > 27)
        {
            llSay(0,region + " is running smoothly");
        }
        else if(fps > 15)
        {
            llSay(0,region + " is running slowly");
        }
        else
         {
         {
             fps=llGetRegionFPS();
             llSay(0,"CAUTION: " + region + " is in danger of crashing");
            frames=(string)(fps);
         }
            region=llGetRegionName();
            llSay(0,region+" fps is:"+frames);
            if(fps > 27)
            {
                llSay(0,region+" is running smoothly");
            }
            if(fps > 22 && fps < 15 )
            {
                llSay(0,region+" is running slowly");
            }
            if(fps < 15)
            {
                llSay(0,"CAUTION:"+region+" is in danger of crashing");
            }
            llResetScript();
         }  
     }
     }
}
}
</pre>
{{LSLC|Examples}}

Revision as of 17:17, 16 March 2007

float home=FALSE;
default
{
    state_entry()
    {
        llListen(0,"",llGetOwner(),"region fps");
    }
    on_rez()
    {
        llResetScript();
    }
    listen(integer c,string n,key i,string m)
    {
        float fps = llGetRegionFPS();
        string region = llGetRegionName();
        llSay(0,region + " fps is:" + (string)fps);
        if(fps > 27)
        {
            llSay(0,region + " is running smoothly");
        }
        else if(fps > 15)
        {
            llSay(0,region + " is running slowly");
        }
        else
        {
            llSay(0,"CAUTION: " + region + " is in danger of crashing");
        }
    }
}