March 20th, 2010
// Display Sim Statistics
// Created by Water Rogers for IBM/Opensource
// Purpose
// --------------------------------------------------------------
// This script shows you how to use settext() and read some simple
// sim statistics.
//
// Requirements
// --------------------------------------------------------------
// A single prim is all that is necessary for this example.
// GLOBALS
// --------------------------------------------------------------
float g_Timer = 5.0; // Interval to update in seconds
vector g_TextColor = <1, 1, 1>; // The text color (1,1,1 = White)
// FUNCTIONS
// --------------------------------------------------------------
display()
{
// This function shows the SetText(). "\n" is a "NewLine" character
// that the compiler notices as an escape sequence.
string output;
// Shows how to get the current name of the simulator the script is in
output = llGetRegionName() + "\n";
// This function returns the hostname of the server (DNS)
output += "Hostname: " + llGetSimulatorHostname() + "\n";
// This will return the current SIM FPS
output += "FPS: " + (string)llGetRegionFPS() + "\n";
// This will return the current Sim Time Dilation
output += "Time Dilation: " + (string)llGetRegionTimeDilation() + "\n";
llSetText(output, g_TextColor, 1);
}
// EVENTS
// --------------------------------------------------------------
default
{
state_entry()
{
// First we clear any text that the object may already have,
// then call the display() function and set the event timer.
llSetText("", g_TextColor, 1);
display();
llSetTimerEvent(g_Timer);
}
timer()
{
display();
}
}
Tags: detector, display, sim, status, tool
Posted in LSL Scripts