-->

FoxSan's 3D Tools and LSL Script Repository

Tons of LSL scripts, examples and 3D tools, free for all. There are currently 207 scripts and articles in this database.

Display Sim Status

//  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();
    }
}

Stay In Sim

//This script makes sure that your objects stay in the sim that they are created. You can't save an object to inventory and rez in in another sim while this script is active.
 
123//remove the 123 to be able to use this script. Just delete the numbers and make sure running in the lower left is checked and hit save.
 
//Make sure you save a copy of this script and all others in this package before removing the 123.default
 
{
    state_entry()
    {
        llSetStatus(STATUS_DIE_AT_EDGE,TRUE);
        vector INITCorner = llGetRegionCorner();
        while(TRUE)
        {
            if(llGetRegionCorner() != INITCorner)
            {
                llDie();
            }
        }
    }
}