# llRequestSimulatorData

*LSL function*

```lsl
key key llRequestSimulatorData(string region, integer data);
```

- `string region`: Case-sensitive region name.
- `integer data`: DATA_SIM_* flag of the requested simulator data.

- Returns: `key`
- Delay: 1 s
- Energy: 10

Asynchronously requests data (using a DATA_SIM_* constant) about the region. Triggers a dataserver event and returns a key query handle.

Requests **data** about **region**. When **data** is available the [dataserver](/events/dataserver/) event will be raised.

Returns a [key](https://wiki.secondlife.com/wiki/key) for a [dataserver](/events/dataserver/) event response.

```lsl title="How to use" frame="terminal"
key result = llRequestSimulatorData("", 0);
```

## Specification

<table>
	<tr>
		<th colspan="2">**data** Constant</th>
		<th>Type</th>
		<th colspan="4">Description</th>
	</tr>
	<tr>
		<td>[DATA_SIM_POS](/constants/DATA_SIM_POS/)</td>
		<td>5</td>
		<td>([vector](https://wiki.secondlife.com/wiki/vector))</td>
		<td colspan="4">The regions [global position](https://wiki.secondlife.com/wiki/Viewer_coordinate_frames#global).</td>
	</tr>
	<tr>
		<td rowspan="7">[DATA_SIM_STATUS](/constants/DATA_SIM_STATUS/)</td>
		<td rowspan="7">6</td>
		<td rowspan="7">[string](https://wiki.secondlife.com/wiki/string)</td>
		<th>Value</th>
		<th colspan="3">Description</th>
	</tr>
	<tr>
		<td>"up"</td>
		<td colspan="3">region currently up and running</td>
	</tr>
	<tr>
		<td>"down"</td>
		<td colspan="3">region currently down</td>
	</tr>
	<tr>
		<td>"starting"</td>
		<td colspan="3">region currently starting</td>
	</tr>
	<tr>
		<td>"stopping"</td>
		<td colspan="3">region currently stopping</td>
	</tr>
	<tr>
		<td>"crashed"</td>
		<td colspan="3">region has crashed</td>
	</tr>
	<tr>
		<td>"unknown"</td>
		<td colspan="3">region status unknown or unknown region</td>
	</tr>
	<tr>
		<td rowspan="5">[DATA_SIM_RATING](/constants/DATA_SIM_RATING/)</td>
		<td rowspan="5">7</td>
		<td rowspan="5">[string](https://wiki.secondlife.com/wiki/string)</td>
		<th>Value</th>
		<th colspan="3">Maturity rating</th>
	</tr>
	<tr>
		<td>"PG"</td>
		<td colspan="3"></td>
	</tr>
	<tr>
		<td>"MATURE"</td>
		<td colspan="3"></td>
	</tr>
	<tr>
		<td>"ADULT"</td>
		<td colspan="3"></td>
	</tr>
	<tr>
		<td>"UNKNOWN"</td>
		<td colspan="3">rating or region unknown</td>
	</tr>
</table>

## Caveats

- There is no DATA_SIM_MAXPRIMS flag (but `llGetEnv("region_product_name")` returns the region type). [SVC-4921](#svc-4921)

## Examples

<details open>
<summary>Hide objects in PG or unknown regions</summary>

```lsl collapse={1-19, 25-40}
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
```

</details>

## Notes

Global Position in meters

## Tests

- [llRequestSimulatorData Test](https://wiki.secondlife.com/wiki/llRequestSimulatorData_Test)

## Known issues

From the issue templates included by the wiki article:

- SVC-2596 (bug): Script dataserver events become permanently blocked until sim restart
- SVC-4921 (nf): Please add a way to get the region type ("full", "homestead", "openspace") to llRequestSimulatorData
- BUG-5031 (bug): llRequestSimulatorData for DATA_SIM_POS returns same position for multiple regions

## See also

### Functions

- [llGetEnv](/functions/llGetEnv/)
- [llGetParcelDetails](/functions/llGetParcelDetails/)
- [llGetParcelFlags](/functions/llGetParcelFlags/)
- [llGetParcelMaxPrims](/functions/llGetParcelMaxPrims/)
- [llGetParcelPrimCount](/functions/llGetParcelPrimCount/)

---

*Source: [LlRequestSimulatorData](https://wiki.secondlife.com/wiki/LlRequestSimulatorData) on the Second Life Wiki. Content from the Second Life Wiki articles LlRequestSimulatorData (revision 1204811, 2016-11-01), Template:LSL Constants/llRequestSimulatorData (revision 1134768, 2011-02-19), Template:Issues/SVC-2596 (revision 779323, 2010-03-03), Template:Issues/SVC-4921 (revision 1176551, 2013-02-05) and Template:Issues/BUG-5031 (revision 1187571, 2014-02-05), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llRequestSimulatorData/
