money Crannock Posted May 14, 2011 Share Posted May 14, 2011 Hi, I was wondering if there is a zero lag way to turn region coordinates into global? Link to comment Share on other sites More sharing options...
Void Singer Posted May 14, 2011 Share Posted May 14, 2011 region coodinate ARE global coordinate, unless you mean gridwide coordinates (as can be use by llMapDestination) in which case you add the region coordinates to llGetRegionCorner. yeah the language used overlaps a bit, that's why I asked Link to comment Share on other sites More sharing options...
money Crannock Posted May 14, 2011 Author Share Posted May 14, 2011 Yea, i meant that can be used on a map, thank you for clarifying* how can i change it though? Link to comment Share on other sites More sharing options...
Opensource Obscure Posted May 15, 2011 Share Posted May 15, 2011 I'm not expert at this, but I'd try using DATA_SIM_POS and llRequestSimulatorData. slightly related: a script I use to get URL of region map https://wiki.secondlife.com/wiki/User:Opensource_Obscure/ShowMap Link to comment Share on other sites More sharing options...
money Crannock Posted May 15, 2011 Author Share Posted May 15, 2011 I have no idea how to use those D: Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 15, 2011 Share Posted May 15, 2011 Did you take a look at the example in the LSL wiki at http://wiki.secondlife.com/wiki/LlGetRegionCorner ? Link to comment Share on other sites More sharing options...
money Crannock Posted May 15, 2011 Author Share Posted May 15, 2011 yes, but I don't know how to translate that to what I want to do Link to comment Share on other sites More sharing options...
Cerise1488303085 Posted May 15, 2011 Share Posted May 15, 2011 money Crannock wrote: yes, but I don't know how to translate that to what I want to do Maybe you can write about what you want to do? Then we can understand what information you are trying to get from these functions. Link to comment Share on other sites More sharing options...
money Crannock Posted May 15, 2011 Author Share Posted May 15, 2011 basically, I want to make a teleporter using rlv, which uses @tpto:x/y/z=force (or something along those lines), however their in global coordinates, so lets say i wanted to go to laval island at <40,40,2000>, i would need to convert it for the rlv function. I did find an example script online here: http://wiki.secondlife.com/wiki/LSL_Protocol/RestrainedLoveAPI but it lags a few seconds before teleporting. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 16, 2011 Share Posted May 16, 2011 Marine's example shows you the method, though. You get the global (i.e.. position on the grid) coordinates of the sim with llRequestSimulatorData("sim name",[DATA_SIM_POS]). When the dataserver replies, it gives you the position on the grid of the Sim's SW corner. You break down the reply in exactly the way she does it there, into the x, y and z coordinates, and then add to those, the coordinates on the sim you need -- in your example, <40.0,40.0,2000.0>, as she does in that example, and turn them into a string for the teleporter to say. Any lag is almost certainly caused by the delay in the dataserver responding and the script processing all this. But you can avoid that, since you know your destination(s) beforehand, by using the method Marine demonstrates there to build a list of the coordinates in which you're interested when the script first starts running. The sims aren't going to move, after all, so there's absolutely no need to recalculate the target position every time you use the device. Then when I come along and set off your teleporter, the thing knows what it's supposed to say, and the only delay in teleporting me is going to be if my relay is set to ask me before accepting commands from strange objects and I take a few seconds to agree. Link to comment Share on other sites More sharing options...
money Crannock Posted May 16, 2011 Author Share Posted May 16, 2011 Thanks for the explination, the problem is that I was using <40,40,2000> as an example, the position changes everytime its used though, so it will lag. I guess if there's no way to get around it, I'l try another way of doing it. Link to comment Share on other sites More sharing options...
Cerise1488303085 Posted May 16, 2011 Share Posted May 16, 2011 That is OK if the position inside the sim changes, you can still cache the base region coordinates to use again, so you can skip the dataserver part. Regions do not move often, so a flush at on_rez or attach time should be good enough to catch stale ones. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 16, 2011 Share Posted May 16, 2011 money Crannock wrote: Thanks for the explination, the problem is that I was using <40,40,2000> as an example, the position changes everytime its used though, so it will lag. I guess if there's no way to get around it, I'l try another way of doing it. I'm afraid that if you need to find the sim's grid location, the only way to do it -- at least the only way I know -- is to call llRequestSimulatorData. You could trying storing the coordinates -- or, rather, the string @tpto is to use -- for specific locations when you look them up, I guess, and then, when you tell it you want to go somewhere, first have the script look in the list to see if it's a location it already knows. If it is, then use the appropriate string, and if not, ask the dataserver where to go. My Dari's Haus collar stores locations I use frequently, and I never seem to need more than 10 or so. That might be an idea to explore. Link to comment Share on other sites More sharing options...
Void Singer Posted May 17, 2011 Share Posted May 17, 2011 I seem to be confused.... what's wrong with llGetRegionCorner? Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 17, 2011 Share Posted May 17, 2011 Void Singer wrote: I seem to be confused.... what's wrong with llGetRegionCorner? Nothing, so long as you're in the region in whose coordinates you're interested when you call it. But the OP wants, I think, to calculate the target coordinates at run-time and can't rely on being in the same region as the target when it's necessary to do the calculation. Link to comment Share on other sites More sharing options...
Void Singer Posted May 17, 2011 Share Posted May 17, 2011 ah, ok, that makes sense, I missed that... yeah unfortunately there may be a slight lapse between requesting data for another region and actually getting, if it's the region you are in though, it tends to be near instant (but then they could have used the other function which is instant). as noted the only work around is to request it in advance and store it. Link to comment Share on other sites More sharing options...
Ciaran Laval Posted May 17, 2011 Share Posted May 17, 2011 Wrong thread sorry! Link to comment Share on other sites More sharing options...
money Crannock Posted May 17, 2011 Author Share Posted May 17, 2011 Thanks (everyone) for replying. I guess I can just try to do it a different way. P.S. still don't understand how to use llGetRegionCorner Link to comment Share on other sites More sharing options...
Void Singer Posted May 18, 2011 Share Posted May 18, 2011 you literally add it to the in region coodinates you want to use A + B style =) Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 18, 2011 Share Posted May 18, 2011 Maybe an example will help. vector sim_pos;vector local_pos;vector target_pos;string to_say;default{ state_entry() { sim_pos = llGetRegionCorner(); // grid co-ordinates of the SW corner of the sim I'm on llOwnerSay((string)sim_pos); local_pos = <148.0,42.0,22.0>; // target position on the sim -- change this, unless you're i) on the Freedonia sim and ii) want to visit my shop target_pos = sim_pos+local_pos; to_say = (string)((integer)target_pos.x)+"/"+(string)((integer)target_pos.y)+"/"+(string)((integer)target_pos.z); llOwnerSay(to_say); } touch_start(integer total_number) { //whoosh! llOwnerSay("@tpto:"+to_say+"=force"); //only works if the owner uses rlv, obviously }} Note, though, that I could use this to get the global coordinates of my shop and then use them anywhere on the grid. Link to comment Share on other sites More sharing options...
Recommended Posts
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