LlRequestInventoryData
Looking for the current API? Open the llRequestInventoryData reference →
Wiki description
Requests data about the item
name in the prim's inventory. When data is available the dataserver event will be raised.Specification
name's Inventory Type | dataserver | Description | ||||
|---|---|---|---|---|---|---|
| Landmark | (vector) | The vector data received by dataserver is a global position as an offset from the current region's origin (<0,0,0>). To obtain the absolute global position of a landmark, add llGetRegionCorner() to the vector. | ||||
Caveats
- This function only returns data for landmark items in inventory. Other item types are not supported.
- The vector returned from landmarks is the distance in meters of the landmark's location relative to <0,0,0> in the region in which the script is running.
- For a landmark pointing to a location in the current region, that's the same as a region coordinate; however, when used with a landmark pointing to a different region the vector's x and y values can be quite large (and/or negative).
- The vector is suitable for use in calculating a global coordinate (as above) or a landmark's distance from the object containing the script in the current region or across the entire Second Life grid.
Examples
//-- Open map for owner to 1st landmark in object inventory on touch
//-- *MUST* be in an attached object (llMapDestination Requirement for non-touch use)
key vgKeyOwner;
default
{
touch_start( integer vIntNull )
{
if (llDetectedKey( 0 ) == vgKeyOwner)
{
integer vIntLMcount = llGetInventoryNumber( INVENTORY_LANDMARK );
//-- make sure we have a landmark in invetory
if (vIntLMcount)
{
llRequestInventoryData( llGetInventoryName( INVENTORY_LANDMARK, 0 ) );
}
}
}
dataserver( key vKeyNull, string vStrData )
{
//-- because we don't know who touched us in this event, this
//-- only works for the owner when called from the dataserver
llMapDestination( llGetRegionName(), (vector)vStrData, ZERO_VECTOR );
}
on_rez( integer vIntNull )
{
llResetScript();
}
state_entry()
{
vgKeyOwner = llGetOwner();
}
}//An easily-configurable teleporter that sets its destination by getting it from a landmark in the prim's inventory
//Note: this teleporter is subject to the 300m distance limit for llSitTarget
//by Ilse Mannonen
//on state entry, request inventory data and set text for first landmark found in inventory.
//If none, complain
//on getting data, set sit target
//on change in inventory, reset script
//on sit, TP the person and unsit
//Thanks to Pol Tabla, who wrote the simple sit-teleport script I have adapted here
key requestid;
default
{
state_entry()
{
//complain if there are no landmarks
if (llGetInventoryNumber(INVENTORY_LANDMARK) == 0)
{
llSay(0, "There are no landmarks in me. You need to put a landmark in me for me to work.");
}
else
{
//set floating text according to the LM name
llSetText("Teleport to " + llGetInventoryName(INVENTORY_LANDMARK, 0), <1.0, 1.0, 1.0>, 1.0);
//request the LM data
requestid = llRequestInventoryData(llGetInventoryName(INVENTORY_LANDMARK, 0));
}
}
dataserver(key id, string data)
{
if (id == requestid)
{
//data will be in vector format
rotation rot = ZERO_ROTATION / llGetRot();
vector dest = (vector)data;
vector offset = (dest - llGetPos()) * rot;
llSitTarget(offset, rot);
}
}
changed(integer change)
{
if (change & CHANGED_LINK)
{ // and it was a link change
llSleep(0.5); // llUnSit works better with this delay
key user = llAvatarOnSitTarget();
if (user) { // somebody is sitting on me
llUnSit(user); // unsit him
}
}
//when doing "ifs" on bitwise things, it's best to do them separate instead of using else..if,
//in case you hit the one in a billion chance when the inventory and link changes are reported in the same event.
if (change & CHANGED_INVENTORY)
{
//reset on inventory change, so people don't have to manually reset when they add a new LM
llResetScript();
}
}
on_rez(integer param)
{
llResetScript();
}
}See also: functions
See also: events
See also: articles
Shared wiki helpers
The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.
Template:LSL Function/inventory
Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<includeonly>{{#if:
{{:DEBUG_CHANNEL}}
{{#vardefine:p_{{{1|none}}}_desc|{{AAn|{{#if:{{{insert|}}}|{{{insert}}}|{{#if:{{{type|}}}|{{{type}}}|item}}}}}} in the {{LSLGC|Inventory|inventory}} {{#if:{{{remote|}}}|of the {{#if:{{{target|}}}|[[{{{target|}}}|target]]|target}} prim|of the prim this script is in}}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|{{#if:{{{empty|}}}|,| or}} a {{HoverLink|UUID|Universally Unique IDentifier}}{{#if:{{{type|}}}| of {{AAn|{{{type}}}}}}}}}{{#if:{{{empty|}}}| or an empty string{{#ifeq:{{{empty}}}|*|| {{{empty}}}}}}}{{#var:p_{{{1|none}}}_desc}}}}
{{#vardefine:p_{{{1|none}}}_hover|{{AAn|{{#if:{{{insert|}}}|{{{insert}}}|{{#if:{{{type|}}}|{{{type}}}|item}}}}}} in the inventory {{#if:{{{remote|}}}|of the target prim|of the prim this script is in}}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|{{#if:{{{empty|}}}|,| or}} a UUID{{#if:{{{type|}}}| of {{AAn|{{{type}}}|{{{type_hover|{{{type}}}}}}}}}}}}{{#if:{{{empty|}}}| or an empty string{{#ifeq:{{{empty}}}|*|| {{{empty_hover|{{{empty}}}}}}}}}}{{#var:p_{{{1|none}}}_hover}}}}
{{#vardefine:caveats{{#var:direction}}|{{#if:{{#if:{{{no_caveat|}}}||{{{1|}}}}}|{{#var:caveats{{#var:direction}}}}
{{#if:{{{empty|}}}|* If {{LSLP|{{{1}}}}} is not an empty string and...
**{{LSLP|{{{1}}}}} is missing from the prim's inventory {{#if:{{{full|}}}|or not {{HoverLink|:Category:LSL_Permissions/Asset|copy, mod and transfer|full permissions}}}} {{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|and it is not a {{HoverLink|UUID|Universally Unique IDentifier}}}} {{#if:{{{type|}}}|or it is not {{AAn|{{{type|item}}}}}}} then {{#if:{{{silent|}}}|it fails silently|an error is shouted on {{#var:DEBUG_CHANNEL}}}}.
|* If {{LSLP|{{{1}}}}} is missing from the prim's inventory {{#if:{{{full|}}}|or not {{HoverLink|:Category:LSL_Permissions/Asset|copy, mod and transfer|full permissions}}}} {{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|and it is not a {{HoverLink|UUID|Universally Unique IDentifier}}}} {{#if:{{{type|}}}|or it is not {{AAn|{{{type|item}}}}}}} then {{#if:{{{silent|}}}|it fails silently|an error is shouted on {{#var:DEBUG_CHANNEL}}}}. }}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|
* If {{LSLP|{{{1}}}}} is a {{HoverLink|UUID|Universally Unique IDentifier}} then there are no new [[:Category:LSL_Permissions/Asset|asset permissions]] consequences for the object.
** The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.}}|{{#var:caveats{{#var:direction}}}}}}}}
{{{{#if:{{{volume|}}}|LSL Function/volume}}|{{{volume|}}}|}}
}}</includeonly><noinclude>
{{Multi-lang}}
{{UpdateLink}}
{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=true}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=true}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}
{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=false}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=false}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}
{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=landmark|uuid=true|empty=(for teleporting within the same region)}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=landmark|uuid=true|empty=(for teleporting within the same region)}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}
</noinclude>Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.