Difference between revisions of "Say Region Frames Per Second"

From Second Life Wiki
Jump to: navigation, search
m (removed unnecessary listen from example script and changed to touch_start)
m (<lsl> tag to <source>)
 
(2 intermediate revisions by 2 users 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.");
+
  
         if (27.0 < fps)
+
         string moreInfo = "CAUTION: '" + region + "' is in danger of crashing.";
            llSay(PUBLIC_CHANNEL,
+
                "'" + region + "' is running smoothly.");
+
  
         else if (15.0 < fps)
+
         if (fps > 15)
             llSay(PUBLIC_CHANNEL,
+
             moreInfo = "'" + region + "' is running slowly.");
                "'" + region + "' is running slowly.");
+
  
         else
+
         if (fps > 27)
            llSay(PUBLIC_CHANNEL,
+
            moreInfo = "'" + region + "' is running smoothly.");
                "CAUTION: '" + region + "' is in danger of crashing.");
+
 
 +
        llSay(0, 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);
    }
}