Opens a map so the user can teleport to the landmark given. Works in both SL and Opensim.
// SCRIPT - TELEPORT VIA LANDMARK IN OBJECT
//FREE SCRIPTS - TESTED AND WORKING ON KITELY
// If you paid for this script, you were ripped off.
// You may use in your creations.
// You may not sell it as a script or in a script collection.
//Copy and paste the contents of this notecard into a new script.
// Instructions:
// Drop this script and one Landmark into an Object/Prim.
// Script will only use the first landmark in Object contents.
// USER OPTIONS (OK TO EDIT)
integer showText = FALSE; //TRUE or FALSE (displays Landmark Name above Object)
// DON'T EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING!
key request;
string name;
string sim_name;
vector pos;
default
{
state_entry()
{
llSetText(" ",<1,1,1>,1.0); //clears any float text
llAllowInventoryDrop(1);
if(llGetInventoryNumber(INVENTORY_LANDMARK))
{
name = llGetInventoryName(INVENTORY_LANDMARK,0);
request = llRequestInventoryData(name);
if (showText == TRUE)
llSetText("Touch for Telport Map to\n"+name + " \n ",<1.0,1.0,1.0>,1.0); // Sets float text if "true"
else
llSetText(" ", <1,1,1>,1.0); //clears float text
}
else
llOwnerSay("Please drop a Landmark into this object's Contents. Only the first landmark in the Contents will be detected.");
}
dataserver(key id, string data)
{
if(id == request)
{
pos = (vector)data;
sim_name = llGetRegionName();
}
}
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(llGetInventoryName(INVENTORY_LANDMARK,0));
}
if (a & CHANGED_OWNER)
llResetScript();
}
on_rez(integer start_param)
{
llSetText("",<1,1,1>,1.0);
llOwnerSay("Please edit script if you want float text above your object.");
llResetScript();
}
}