LlRequestSimulatorData

From Second Life Wiki
Jump to: navigation, search

Summary

Function: key llRequestSimulatorData( string region, integer data );

Requests data about region. When data is available the dataserver event will be raised.
Returns a handle (a key) for a dataserver event response.

• string region Case sensitive region name.
• integer data DATA_* flag
data Constant Type Description
DATA_SIM_POS 5 (vector) The regions global position.
DATA_SIM_STATUS 6 string Value Description
"up" region currently up and running
"down" region currently down
"starting" region currently starting
"stopping" region currently stopping
"crashed" region has crashed
"unknown" region status unknown or unknown region
DATA_SIM_RATING 7 string Value Maturity rating
"PG" Parcel lght G.png General
"MATURE" Parcel lght M.png Moderate
"ADULT" Parcel lght A.png Adult
"UNKNOWN" rating or region unknown

Caveats

  • This function causes the script to sleep for 1.0 seconds.
  • There is no DATA_SIM_MAXPRIMS flag (but llGetEnv("region_product_name") returns the region type). SVC-4921
All Issues ~ Search JIRA for related Bugs

Examples

Hide objects in PG or unknown regions

key         gRateingQuery       =   NULL_KEY        ;
 
show()
{
    llSetLinkAlpha( LINK_SET, 1.0, ALL_SIDES );
}//show
 
hide()
{
     llSetLinkAlpha( LINK_SET, 0.0, ALL_SIDES );
}//hide
 
default
{
    on_rez(integer Setting)
    {
        llResetScript();
    }//on_rez
 
    state_entry()
    {
        gRateingQuery = llRequestSimulatorData( llGetRegionName(), DATA_SIM_RATING );
    }//state_entry
 
    changed(integer ItChanged)
    {
        if (ItChanged & CHANGED_OWNER)      llResetScript();
        if (ItChanged & CHANGED_REGION)     llResetScript();
    }//changed
 
    dataserver(key query_id, string data)
    {
        if (query_id == gRateingQuery)
        {
            if (data == "MATURE" || data == "ADULT")        show();
            else if (data == "UNKNOWN" || data == "PG")     hide();
        }//gRateingQuery
    }//dataserver
 
}//default

Notes

Global Position in meters

See Also

Deep Notes

All Issues

~ Search JIRA for related Issues
   Script dataserver events become permanently blocked until sim restart
   Please add a way to get the region type ("full", "homestead", "openspace") to llRequestSimulatorData
   llRequestSimulatorData for DATA_SIM_POS returns same position for multiple regions

Tests

•  llRequestSimulatorData Test

Signature

function key llRequestSimulatorData( string region, integer data );