Difference between revisions of "Say Region Frames Per Second"

From Second Life Wiki
Jump to navigation Jump to search
m (lsl code tagging)
m (removed unnecessary listen from example script and changed to touch_start)
Line 2: Line 2:
default
default
{
{
     state_entry()
     touch_start(integer num_detected)
    {
        llListen(0,"",llGetOwner(),"region fps");
    }
    on_rez(integer code)
    {
        llResetScript();
    }
    listen(integer c,string n,key i,string m)
     {
     {
         float fps = llGetRegionFPS();
         float fps = llGetRegionFPS();
         string region = llGetRegionName();
         string region = llGetRegionName();
         llSay(0,region + " fps is:" + (string)fps);
 
         if(fps > 27)
        // PUBLIC_CHANNEL has the integer value 0
        {
         llSay(PUBLIC_CHANNEL,
             llSay(0,region + " is running smoothly");
            "Region '" + region + "' is running at " + (string)fps + " fps.");
        }
 
         else if(fps > 15)
         if (27.0 < fps)
        {
             llSay(PUBLIC_CHANNEL,
             llSay(0,region + " is running slowly");
                "'" + region + "' is running smoothly.");
        }
 
         else if (15.0 < fps)
             llSay(PUBLIC_CHANNEL,
                "'" + region + "' is running slowly.");
 
         else
         else
        {
             llSay(PUBLIC_CHANNEL,
             llSay(0,"CAUTION: " + region + " is in danger of crashing");
                "CAUTION: '" + region + "' is in danger of crashing.");
        }
     }
     }
}
}

Revision as of 13:48, 7 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.");
       if (27.0 < fps)
           llSay(PUBLIC_CHANNEL,
               "'" + region + "' is running smoothly.");
       else if (15.0 < fps)
           llSay(PUBLIC_CHANNEL,
               "'" + region + "' is running slowly.");
       else
           llSay(PUBLIC_CHANNEL,
               "CAUTION: '" + region + "' is in danger of crashing.");
   }

} </lsl>