Jump to content

Region Corordinates from a landmark?


Tabris Daxter
 Share

You are about to reply to a thread that has been inactive for 4438 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi all,

just a quickie (that will probably snowball)

is it possible to get either the Parcel Key or the region & parcel cordinates from a Landmark.

this i related to my combat game because some Land Owners might object to having combat on their land and i will have to set the HUD to DMZ (non-combat mode) on their land so the players don't get banned.

i would like to set an automated system so that i don't have to visit every sim(some that may have scripts disabled) and get them manually.

 

Ty in advance.

Link to comment
Share on other sites

The only way I know to get the parcel key is llGetParcelDetails, and that only works in the same region.  

You can, however, get the coordinates for a landmark with a bit of difficulty, compounded by the fact that the normal way of doing it is broken at the moment, and you have to use a work round.   Rather than go into the details here, I'll just point to the thread over at SLU where we were talking about it -- Tyche Shepherd kindly offers a work-round.   If I may suggest it, it might be an idea to ask over there, since I know Tyche follows the SLU scripting threads and she's going to know, if anyone does.

You might also find Ugleh Ulrik's collection of parsers there interesting, though I'm not sure -- after a quick look -- if any of them can be made to do what you want.

 

Link to comment
Share on other sites

i tried a Frank 'n' Stiened version of this:

//-- Open map for owner to 1st landmark in object inventory on touch//-- *MUST* be in an attached object (llMapDestination Requirement for non-touch use)key vgKeyOwner; default{  touch_start( integer vIntNull )  {    if (llDetectedKey( 0 ) == vgKeyOwner)    {      integer vIntLMcount = llGetInventoryNumber( INVENTORY_LANDMARK );       //-- make sure we have a landmark in invetory      if (vIntLMcount)      {        llRequestInventoryData( llGetInventoryName( INVENTORY_LANDMARK, 0 ) );      }    }  }   dataserver( key vKeyNull, string vStrData )  {     //-- because we don't know who touched us in this event, this     //-- only works for the owner when called from the dataserver    llMapDestination( llGetRegionName(), (vector)vStrData, ZERO_VECTOR );  }   on_rez( integer vIntNull )  {    llResetScript();  }   state_entry()  {    vgKeyOwner = llGetOwner();  }}

 and

//calculates your position relative to <0,0,0> of 'Da Boom' in meters when you touch itvector vecrel; //a sum of llgetpos and llgetregioncorner (and another vector). Saving time doing vector math. default{    state_entry()    {        llSetText("Touch me to get your position", <1,1,1>, 2.0);    }    touch_start(integer total_number)    {        vecrel = llGetRegionCorner() + llDetectedPos(0);        llWhisper(0, "llGetRegionCorner() is:"+(string)vecrel ); //for debugging before vector addition        vecrel -= <256000.0, 256000.0, 0.0>;//Da Boom's region corner is at <256000.0, 256000.0, 0.0>        llWhisper (0, "Position relative to <0,0,0> of 'Da Boom': "+ (string)llRound(vecrel.x) +",\t\t\t"+ (string)llRound(vecrel.y) +",\t\t\t"+ (string)llRound(vecrel.z) + ".");        llWhisper(0, "Position relative to <0,0,0> of 'Da Boom':"+(string)vecrel ); //faster but unformatted output    }}

 and i think it gave me the right cordinates but had no way of checking because llMapDestination needs a name.

i'm thinking of butchering in this:

// Pass a global position to this function, and the object// will move there. setGlobalPos(vector globalDest) {    vector localDest;    do {        localDest = globalDest - llGetRegionCorner();        llSetPos(localDest);    } while (llVecDist(llGetPos(), localDest) > 0.1);}default {    state_entry() {        vector DABOOM_CORNER = <256000, 256000, 0>; // DaBoom's region corner.        setGlobalPos(DABOOM_CORNER + <128, 128, 128>); // Travel to <128,128,128> in DaBoom.    }}

 make the prim move between locations and record the info, sending it to my DB each time.

 

Side note: Void replied but i can't view the reply.

Link to comment
Share on other sites

Here's something I made using Tyche's Gridsurvey.com api.   I don't know if it's any help in what you're doing, but it might be.

 

vector Absolute;key query;key Request;string strReplace(string str, string search, string replace) {	return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace);}default{	state_entry()	{		//llSay(0, "Hello, Avatar!");	}	touch_start(integer total_number)	{		string s = llGetInventoryName(INVENTORY_LANDMARK,0);		if(s){			query = llRequestInventoryData(s);		}	}	dataserver(key requested, string data)	{		if(requested==query){			Absolute = llGetRegionCorner() + (vector) data;			vector grid = Absolute / 256.0;			Request =				llHTTPRequest("http://api.gridsurvey.com/simquery.php?xy="+(string)((integer)grid.x)+","+(string)((integer)grid.y)+"&item=name",[],"");		}	}	http_response(key id, integer status, list metadata, string body) {		if (id == Request) {			if (status != 200) {				llOwnerSay					("Failure! Sorry.. can't retrieve the region name");				return;			}					body = strReplace(body,"+"," ");						llOwnerSay("Please open your chat history -- CTRL H -- and click the slurl");			llOwnerSay(llDumpList2String				(["http://slurl.com/secondlife/", llEscapeURL(body), llFloor(Absolute.x - (llFloor(Absolute.x / 256.0) << 8)),				llFloor(Absolute.y - (llFloor(Absolute.y / 256.0) << 8)), llFloor(Absolute.z), ""], "/"));		}	}}

 I wanted to create slurls from LMs, but if you just want the region name, then that's the body in the http_response.

Link to comment
Share on other sites

  • 2 weeks later...

i had an idea.

i could use the RLV force TP system to tp my avi(or an alt, probably an alt) around unassisted.

so i butchered the code located at the above link with Example 1 on llRequestInventoryData

Butchered code below:

key vgKeyOwner; default{  touch_start( integer vIntNull )  {    if (llDetectedKey( 0 ) == vgKeyOwner)    {      integer vIntLMcount = llGetInventoryNumber( INVENTORY_LANDMARK );       //-- make sure we have a landmark in invetory      if (vIntLMcount)      {        llRequestInventoryData( llGetInventoryName( INVENTORY_LANDMARK, 0 ) );      }    }  }   dataserver( key vKeyNull, string vStrData )  {     //-- because we don't know who touched us in this event, this     //-- only works for the owner when called from the dataserver        llOwnerSay(vStrData);    list tokens = llParseString2List (vStrData, ["<", ",", ">"], []);      string pos_str = "";      vector global_pos;       // The coordinates given by the dataserver are the ones of the      // South-West corner of this sim      // => offset with the specified local coordinates      global_pos.x = llList2Float (tokens, 0);      global_pos.y = llList2Float (tokens, 1);      global_pos.z = llList2Float (tokens, 2);       // Build the command      pos_str =      (string)((integer)global_pos.x)                +"/"+(string)((integer)global_pos.y)                +"/"+(string)((integer)global_pos.z);      llOwnerSay ("Global position : "+(string)pos_str); // Debug purposes       // Fire !      llOwnerSay ("@tpto:"+pos_str+"=force");      //llMapDestination( llGetRegionName(), (vector)vStrData, ZERO_VECTOR );  }   on_rez( integer vIntNull )  {    llResetScript();  }   state_entry()  {    vgKeyOwner = llGetOwner();  }}

 

now it reads from the landmark fine. the llMapDestination() works and shows the correct location.

i think i fubb'd something in the re-assembling of the co-ordinates needed for RLV as the force TP won't find the destination

Link to comment
Share on other sites

Try this:

 

dataserver(key requestID, string data) {		// llOwnerSay(data);		if (requestID == LMid) {			list tokens = llParseString2List(data,["<", ",", ">"],[]);			pos_str = "";			vector global_pos;			global_pos.x = llList2Float(tokens, 0);			global_pos.y = llList2Float(tokens, 1);			global_pos.z = llList2Float(tokens, 2);			global_pos += llGetRegionCorner();//NB!			pos_str = (string) ((integer) global_pos.x)				+ "/" + (string) ((integer) global_pos.y)				+ "/" + (string) ((integer) global_pos.z);			llOwnerSay("@tpto:" + pos_str + "=force");		}	}

 

As the wiki explains, "The vector data received by dataserver is an offset from <0,0,0> of the current region. To obtain the global position of a landmark add llGetRegionCorner()".    The wiki example is a bit confusing because, since it's using llMapDestination, that calculates the offset for you using llGetRegionName().   But @tpto wants the actual grid coordinates, so you have to add in the offset yourself.

Link to comment
Share on other sites

it worked. ty

now just to dump in a loop to cycle through the landmarks & return "home" when done.

after that putting it in a nice body.

 

EDIT:

extra thoughts,

is it better to "inline" a loop creating a list of the LM names or as a seperate function.

i'm going to be putting a CHANGED_TELEPORT in which will start a timer untill the next "jump". how long is a good amount of time. 15sec, 30?

also i have to figure out how to block ALL other features of the RLV system (i don't want my "ship" getting trapped by an auto-scanning RLV trap)

 

Link to comment
Share on other sites

Hmm.   The easy question is how to block stuff -- the short answer is, you don't need to worry about that.  

RLV viewers respond only to commands in the form llOwnerSay("@something").   For a trap, or anything that doesn't belong to you, to control you, you have to be wearing something -- typically a relay or collar -- that can understand the trap's commands, see if the trap is allowed to control you, and, if it is, issue commands on its behalf.   

So if you're not wearing a relay or collar, there's no possibility of anything that doesn't belong to you doing things to you.   Just be careful about accepting gifts from strangers and then wearing or rezzing them (which most of us are, anyway, of course).

I'm not completely sure what you're planning but I think, if you're doing a tour of your landmarks, I would start by counting the landmarks, call llRequestInventoryData (llGetInventoryName(INVENTORY_LANDMARK,counter), and force tp myself to the first destination in the dataserver event, as you're doing in your example.   

I'd call llSetTimerEvent(n) in CHANGED_REGION -- that is, when I arrive at my destination, with n being long enough to do whatever I  want do there, including rez -- and then, in the timer event, turn the timer off, advance the counter, get the details of the next landmark, and repeat until i was finished.   Once I reach the end of my landmarks, tp myself home (possibly having stored my start point as a variable).

I suppose that means I should check either the  counter, or where I am,  in the changed event, so I don't restart my tour after tp-ing myself home.  

I think that's how I would approach it initially, but that's all of the top of my rather tired head.

I guess, too, you probably want to stop the timer on_rez, in case you crash part way through, so you don't find yourself in difficulties when you log back in.  And a mechanism to stop and restart the timer (on touch, maybe) would probably be a sensible safeguard.

 

Best of luck!

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4438 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...