llMapDestination(string simname, vector position, vector lookat)

Shows a given location on the map.
Works in attachments, or during touch events. Currently the function will open the map window whenever it is called. There is no way to simply set the map position without opening the window.

The vertical (.z) axis of position is constrained to the 0 – 1000 range.
The lookat value is currently not in use, but will be in a later version.

GlobalMapDestination(vector position, vector lookat)
{
    vector c = llGetRegionCorner();
    llMapDestination(llGetRegionName(), position - c, lookat - c);
}

 

default
{
    touch_start(integer moocow)
    {
        llMapDestination("Coda", <128, 128, 25>, ZERO_VECTOR); // this loads the map to region "Coda" at the position <128,128,25>.
    }
}

 

key request;
string name;
string sim_name;
vector pos;

default
{
    state_entry()
    {
        llAllowInventoryDrop(1);
        if(llGetInventoryNumber(INVENTORY_LANDMARK))
        {
            name = llGetInventoryName(INVENTORY_LANDMARK,0);
            request = llRequestInventoryData(name);
        }
        else
            llWhisper(0,"Please drop a landmark on me");
    }
    dataserver(key id, string data)
    {
        if(id == request)
        {
            pos = (vector)data;
            sim_name = llGetRegionName();
            llSetText("Touch to show \""+name+"\" on the map.",<1.0,1.0,1.0>,1.0);
        }
    }
    touch_start(integer a)
    {
        if(name != "")
            llMapDestination(sim_name, pos, pos);
    }
    changed(integer a)
    {
        if(a & (CHANGED_INVENTORY | CHANGED_ALLOWED_DROP))
            if(llGetInventoryNumber(INVENTORY_LANDMARK))
                request = llRequestInventoryData(name = llGetInventoryName(INVENTORY_LANDMARK,0));
    }
}