Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

WANTED: Map TP

Shayna Korobase
Registered User
Join date: 8 May 2007
Posts: 454
10-07-2009 12:41
I need a script that opens the map for TP. I'm creating a TP display for my sim. Thanks :)
Rhonda Huntress
Kitteh Herder
Join date: 21 Dec 2008
Posts: 1,823
Fast and easy
10-07-2009 13:18
// Change this to the name of your sim.
string sSimName = "Allana";
//Change this to the x, y, z coordinants you want then to land
vector vPosition = <123.4, 123.4, 50.0>;

default{
touch_end(integer total_number){
llMapDestination(sSimName, vPosition, vPosition);
}
}
Rhonda Huntress
Kitteh Herder
Join date: 21 Dec 2008
Posts: 1,823
10-07-2009 13:20
See also:

For a script to pull landmarks from inventory and map destination
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
Pullng up a TP map for any landmark
10-09-2009 03:28
The wiki examples don't show you this, but here's how I do it for an ad board of mine...

Consider that each landmark is in the following format... name, region (x, y, z). Every landmark should have this format. If not then this code won't work. Most landmarks do. The only time you run into a problem is when the vector data is cut off at the end because the landmark name is too long. It's not too hard to ensure your landmark is formatted correctly.

NOTE: The code below uses llGetSubString and pulls data based on where the ";(" is. If the sim name is not in the SL map database, the teleport map will pop up but will fail to find the location. If the vector can't be pulled from the landmark name, it will also fail.

// Get a teleport map from the name of the first landmark in inventory.
// NOTE: Requires a landmark that contains name, region and position data.
// The correct format is "name, region (x, y, z)". If a landmark's
// name is too long the position data is truncated from the end,
// which will cause the position to be wrong.
default
{
touch_start(integer num)
{
// Parse the name of the first landmark found in inventory into a list using
// commas as separators.
list lstTemp = llParseString2List(llGetInventoryName(
INVENTORY_LANDMARK,0),[","],[]);

// Get list length and subtract 3 to get the correct element containing
// the region name. Moving backward from the end of the list keeps
// commas in the landmark name from giving us grief with misaligned
// and incorrect data.
integer intElement = llGetListLength(lstTemp)-3;

// Get the region name from the list element, eliminating unneeded
// characters in the string and trimming leading/trailing spaces.
string strSimname = llStringTrim(llGetSubString(llList2String(lstTemp,
intElement),0,llSubStringIndex(llList2String(lstTemp,intElement),";(";)-1),
STRING_TRIM);

// The vector is pulled from the landmark name, based on the
// position of ";(" in the string starting with the next
// character and ending with the second to the last character.
vector vecVector = (vector)("<"+llGetSubString(llGetInventoryName(
INVENTORY_LANDMARK,0),llSubStringIndex(llGetInventoryName(
INVENTORY_LANDMARK,0),";(";)+1,-2)+">";);

// Bring up the teleport map using the data we extracted.
llMapDestination(strSimname,vecVector,ZERO_VECTOR);
}
}
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
10-09-2009 07:16
For completeness and because the OP said she is creating a TP display for her sim, I offer the following script for putting a sim map on the face of a prim for a display. I modified it quite a while ago from something that was posted in this form -- I cannot remember when or by whom, or I would give proper credit. The script grabs a sim map from an SL API and updates it once a day, so you always have a current map. In the sim that I manage, I have added llDetectedTouchST functions to create hot areas on the map that will hand out a LM to any targeted area on touch, but that is not in this basic script....

CODE

key http_request_id;
string URL = "http://www.subnova.com/secondlife/api/map.php";
string SIM_NAME;
integer iLine = 0;
integer CHANNEL = 1000;
string name = "Info Island"; // Here's where you put the name of the sim you want a map of
default
{
on_rez(integer n)
{
llResetScript();
}
state_entry()
{
vector temp;
list temp_name;
integer i=0;
temp = llGetScale();
http_request_id = llHTTPRequest(URL + "?" + "sim" + "=", [], "");
iLine = 0;
temp_name = llParseString2List(name,[],[" "]);
for (i = 0; i < llGetListLength(temp_name); i++)
{
if (llList2String(temp_name,i) == " ")
{
temp_name = llListReplaceList(temp_name,["_"],i,i);
}
}
SIM_NAME = llDumpList2String(temp_name,"");
http_request_id = llHTTPRequest(URL + "?" + "sim" + "=" + SIM_NAME, [], "");
llSetTimerEvent(86400);
}

timer ()
{
llResetScript();
}

http_response(key request_id, integer status, list metadata, string body)
{
if (request_id == http_request_id)
{
llSetTexture(body, 0);
}
}
}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at