Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sim Corner from Name

Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
03-29-2005 15:07
Is is possible to get the global corner coordinates of a sim based on the name? I looked all over the wiki, and found nothing, and I don't exactly want to make ten lists full of names and coordinates for the script to search through. I want to be able to say "DaBoom, <128,128,0>" and have the script convert it to 255128,255128,0. A possibility?
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.
Chandra Page
Build! Code. Sleep?
Join date: 7 Oct 2004
Posts: 360
03-29-2005 15:58
Yes, though the function you need looks as if it won't be available until the 1.6 update. When that goes live (hopefully Thursday this week, last announcement I read), you'll want to use the function llRequestSimulatorData, passing it the name of the sim and the constant DATA_SIM_POS. You'll get the sim's global corner coordinates back in the dataserver event. The code ought to look something like this (pulled directly from the LSL Wiki):

CODE
key ahernStatusQuery;
key ahernPosQuery;
default
{
touch_start(integer total_number)
{
ahernStatusQuery = llRequestSimulatorData("ahern", DATA_SIM_STATUS);
ahernPosQuery = llRequestSimulatorData("ahern", DATA_SIM_POS);
}
dataserver(key queryId, string data)
{
if (queryId == ahernStatusQuery) {
ahernStatusQuery = "";
llSay(0, "Status of Ahern: " + data);
} else if (queryId == ahernPosQuery) {
ahernPosQuery = "";
llSay(0, "Ahern's position: " + data);
}
}
}


Given that the dataserver returns the coordinate as a string instead of a vector, you'll probably want to typecast the results to vector form so you can do useful math with them:

CODE
vector myCoordinates = (vector)data;
_____________________
Come visit the In Effect main store and café
Drawbridge (160, 81)
Particle effects, fashion, accessories, and coffee!
On the Web at SL Exchange and SL Boutique
Zindorf Yossarian
Master of Disaster
Join date: 9 Mar 2004
Posts: 160
03-29-2005 16:07
Thanks. I was hoping I wouldn't have to wait until that was implemented. For now I'll just have to find the coordinates with slmaps.com
_____________________
Badass Ninja Penguin: Killing stuff it doesn't like since sometime in May 2004.