Don't click here unless you want to be banned.

LSL Wiki : llRequestInventoryData

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl805.us.archive.org
key llRequestInventoryData(string name)

Requests data from object inventory item name. When data is available, the dataserver event will be raised with the key returned from this function in the requested parameter.

The only request currently implemented is to request data from landmarks, where the data returned is in the form "<float, float, float>" which can be directly cast to a vector. This position is in region local coordinates (that means it's the distance from the region corner) so to convert it into a global position, just add the result of llGetRegionCorner.

Note: This function delays the script for 1 second.

For a another example using this function see: llMapDestination

Example:
// llRequestInventoryData Example
// This script gets the distance from the object
// this script is in to the landmark defined by LANDMARK_NAME.
// This landmark must be in the same object as the script.
// Written by Christopher Omega

// Name of landmark.
string LANDMARK_NAME = "**landmark name here**";

// Stores the request identifyer (return value of llRequestInventoryData) 
// this value is equal to the first parameter of the dataserver event
// when the dataserver event is returning the data requested.
key inventoryRequestID = NULL_KEY;

default {
    state_entry() {
        inventoryRequestID = llRequestInventoryData(LANDMARK_NAME);
    }
    
    dataserver(key requestID, string data) {
        // If dataserver event is the responce to the request
        // whose key is stored in the variable inventoryRequestID:
        if (requestID == inventoryRequestID) {
            // This prevents any dataserver "hiccups":
            inventoryRequestID = NULL_KEY;
            
            // When passing landmark names to llRequestInventoryData,
            // the resulting dataserver event's string parameter contains the 
            // location of the landmark in coordinates relative to the region the script
            // is currently in. (see wiki page on RegionCoordinates)
            vector regionCoords = (vector) data;
            vector myPosition = llGetPos();
            
            // Get the distance from my position to the landmark's position.
            float distance = llVecDist(myPosition, regionCoords);
            llSay(0, LANDMARK_NAME + " is " + (string) distance + " meters away from me.");
        }
    }
}


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Inventory | Dataserver
Comments [Hide comments/form]
If you have multiple scripts in the same prim that use the dataserver, make sure you check the dataserver key! I got burned by this because I'd never actually read the dataserver event handler wiki page, and so didn't realize that the dataserver triggers *all* dataserver event handlers in the prim, not just the one in the script that caused it. (which should have been apparent if I'd thought about it a little bit, but I didn't).
-- NeoRebus (2006-08-20 20:24:10)
So I take it there's no way to find out the sim name out of a landmark? I saw the example script in the llMapDestination() page but that's not useful if you want to store the sim name of a landmark in a variable.
-- Jadz0rConover (2006-09-01 23:13:20)
Not in LSL currently, though you could extract that data from the mapapi.
-- BlindWanderer (2006-09-02 09:04:27)
Attach a comment to this page: