Search This Blog

Monday, September 19, 2016

Teleport Script llMapDestination + llTeleportAgent

A teleport script which can open the map panel and detects landmark in the object.

------------------Map Destination-----------------
default 

  state_entry() 
  { 
    llSetText( "Teleport to Cirque du Self-Access",<1 1="">, 1 ); 
  } 
  touch_start(integer total_number) 
  { 
  llMapDestination( "HKPolyU Campus", <12>, 
   <0> ); 
  } 
}


------------------Detect Landmark-----------------

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);
        }
    }
    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));
    }
}



Ref:
http://www.aipiro.com/lsltips/index14.htm
http://lslwiki.net/lslwiki/wakka.php?wakka=HomePage

No comments:

Post a Comment