Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Getting Sim from Landmark for llMapDestination

Jezbella Maidstone
Registered User
Join date: 9 Nov 2006
Posts: 54
09-12-2007 17:53
Can anyone nudge me in the general direction to figure out how to programmetically get the Sim that a landmark belongs to, so that I can use it in llMapDestination()? I have only been able to extract the x,y,z, position.

Thanks in advance,

Jez
Partington Gould
Registered User
Join date: 15 Sep 2005
Posts: 94
09-12-2007 20:53
This is a llMapDestination that I use, I believe it's free. The llGetRegionName is what you asked about I think...

CODE

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 for information and to jump to" + "\n" + "Dreamland Suites in Chamisak",<0.8, 0.6, 0.2>,1.0);
}
}
touch_start(integer a)
{
if(name != "")
llGiveInventory(llDetectedKey(0), "Dreamland Suites Info");
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));
}}
_____________________
PG - Permanently Confused and prone to Wandering
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
09-12-2007 21:49
There isn't a way to obtain the actual region name corresponding to coordinates from a landmark. You CAN put the region name in the landmark's name, though.
Jezbella Maidstone
Registered User
Join date: 9 Nov 2006
Posts: 54
09-13-2007 10:07
Thanks guys, but I need the Sim name the landmark was created in, not the current region I'm in. The Sim name is in the landmarks description. I know it can be done somehow, because the Mysti-Tool land mark /teleport manager does just that. You drag a landmark into the attachment, and can teleport from anywhere, to anywhere by bringing up the attachments menu.

It appears that when you take a landmark, the Land Name is concatenated with the sim name and region coordinates, and placed in the Name and Description fields of the landmarks properties. It could be obtained from the Name property, but often these get changed. If I could get it from the description property, I'd be all set, but I see no functions that will allow me to access the description property of an inventory item. The region coordinates are accessable with: llRequestInventoryData(LANDMARK_NAME). I was hoping I just missed the function that let me retrieve the Region Name of the landmark.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
09-13-2007 15:30
A landmark's description can be changed, too, by editing its properties. So, after changing one of those and adding it to Mysti-Tool, it would be interesting to know if it uses that description, or if it somehow knows the region at a global position; I'm not seeing a way to figure that out, myself.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
09-13-2007 17:49
You don't need the region name to teleport using llMapDestination and the landmark coordinates. The only reason you might need the Region name is for your own edification.

If the Mysti-Tool does it, it does it based on accessing an external database of sim locations by name. There are no ways via LSL to do that otherwise without building that data set.

If you are thinking you need the destination sim name for the simname parameter in llMapDestination, that is incorrect. You pass the CURRENT sim name you are in as that parameter. Read the code snippets in the Wiki for verification (and try it out yourself! :D).