Difference between revisions of "LlRequestSimulatorData"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(31 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{Issues/SVC-2596}}{{Issues/SVC-4921}}{{Issues/BUG-5031}}
|func_id=293|func_sleep=1.0|func_energy=10.0
|func_id=293|func_sleep=1.0|func_energy=10.0
|func=llRequestSimulatorData
|func=llRequestSimulatorData
|return_type=key|p1_type=string|p1_name=simulator|p2_type=integer|p2_name=data
|return_type=key
|return_subtype=handle
|p1_type=string|p1_name=region|p1_desc=Case sensitive region name.
|p2_type=integer|p2_name=data|p2_desc=DATA_* flag
|func_footnote
|func_footnote
|func_desc=Requests data about simulator. When data is available the {{LSLG|dataserver}} event will be raised
|func_desc=Requests {{LSLP|data}} about {{LSLP|region}}. When {{LSLP|data}} is available the {{LSLG|dataserver}} event will be raised.
|return_text=that is the handle for a {{LSLG|dataserver}} event response.
|return_text=for a {{LSLG|dataserver}} event response.
|spec
|spec
|caveats
|caveats=
|constants={{{!}}
*There is no DATA_SIM_MAXPRIMS flag (but <code>[[llGetEnv]]("region_product_name")</code> returns the region type). [[#SVC-4921|SVC-4921]]
!Constant
|constants={{{!}} {{Prettytable|style=margin-top:0;}}
!Value
{{!}}- {{Hl2}}
!Description
! colspan="2" {{!}} {{LSL Param|data}} Constant
! Type
! colspan="4" {{!}} Description
{{!}}-
{{!}}-
{{!}}{{LSLG|DATA_SIM_POS}}
{{LSL_Constants/llRequestedSimulatorData}}
{{!}}5
{{!}}returns a vector specifying the simulator's global position.
{{!}}-
{{!}}{{LSLG|DATA_SIM_STATUS}}
{{!}}6
{{!}}returns a string
{{!}}-
{{!}}{{LSLG|DATA_SIM_RATING}}
{{!}}7
{{!}}returns a string, either "PG", "MATURE" or "UNKNOWN"
{{!}}}
{{!}}}
|examples
|examples=Hide objects in PG or unknown regions
<source lang="lsl2">
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
</source>
|helpers
|helpers
|also_functions
|also_functions=
|also_tests
{{LSL DefineRow||[[llGetEnv]]|}}
{{LSL DefineRow||[[llGetParcelDetails]]|}}
{{LSL DefineRow||[[llGetParcelFlags]]|}}
{{LSL DefineRow||[[llGetParcelMaxPrims]]|}}
{{LSL DefineRow||[[llGetParcelPrimCount]]|}}
|also_tests=
{{LSL DefineRow||[[llRequestSimulatorData Test]]}}
|also_events
|also_events
|also_articles
|also_articles
|notes
|notes=Global Position in meters
|issues
|cat1=Dataserver
|cat1=Dataserver
|cat2
|cat2=Region
|cat3
|cat3
|cat4
|cat4
}}
}}

Latest revision as of 06:30, 1 November 2016

Summary

Function: key llRequestSimulatorData( string region, integer data );
1.0 Forced Delay
10.0 Energy

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

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

Tests

•  llRequestSimulatorData Test

Signature

function key llRequestSimulatorData( string region, integer data );