Region Stats as Graphical Floating Text ( V3 )

Written by Kitsune
// V3 //
 
integer on = TRUE;
 
Switch()
{
    if(on)
    {
        llSetTimerEvent(0.0);
        llSetText("Click Me to Enable Region Stats Display\n \n ", <1.0, 1.0, 0.0>, 1.0);
    }
    else
    {
        llSetText("Gathering Region Stats...\n \n ", <1.0, 1.0, 0.0>, 1.0);
        llSetTimerEvent(2.5);
    }
    on = (!on);
}
 
DisplayStats()
{
    integer count;
    string d = "";
    string f = "";
    integer fps = (llRound((llGetRegionFPS() * 2.0) + 10.0) / 10);
    integer dilation = llRound((llGetRegionTimeDilation() * 10.0));
    integer combo = (dilation + fps);
    while((++count) < dilation)
    d += "||";
    count = 0;
    while((++count) < fps)
    f += "||";
    llSetText("The Region is  -  " + GetCondition((combo * 2)) +
              "\n \nNumber of Agents on Region  -  " + ((string)llGetRegionAgentCount()) +
              "\n \nRegion F.P.S.  -  " + f +
              "\nRegion Dilation  -  " + d, <1.0, ((((float)combo) / 2.0) / 10.0), 0.0>, 1.0);
}
 
string GetCondition(integer c) // Obviously you can change this wording if you like.
{                              // I just thought of "health" and went with it.
    if(c == 40)
    return "TRANSCENDENT";
    else if(c > 35)
    return "ATHLETIC";
    else if(c > 30)
    return "HEALTHY";
    else if(c > 25)
    return "AVERAGE";
    else if(c > 20)
    return "ILL";
    else if(c > 15)
    return "DYING";
    else if(c > 10)
    return "CRITICAL";
    else
    return "DEAD?";
}
 
default
{
    state_entry()
    {
        Switch();
    }
    touch_start(integer nd)
    {
        Switch();
    }
    timer()
    {
        DisplayStats();
    }
}