There's all sorts of tools and tricks (I often use the one of having Zardia stand with the gift, I'll stand at the sign, and we'll check how far apart we are on the Phoenix radar) but I decided to knock up a quick script for my own use next time.
If it's of help to anyone else: Z&A As the Crow Flies.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////// | |
// Z&A As the Crow Flies -- Find the distance between two points. | |
// By Antony Fairport | |
// | |
// Rez one or more prims around a place where you want to know how | |
// far away they are. Name each prim to something that will mean | |
// something to you. Now drop this script in each of them. Finally, | |
// touch the prim that you consider to be the point from which you | |
// want to measure. | |
// | |
// This is handy for things like ensuring that your hunt objects | |
// are within a specific distance of your sign or landing point if | |
// you're taking part in a hunt with a rule about how far an object | |
// can be from where hunters land. | |
////////////////////////////////////////////////////////////////////// | |
// Globals. | |
integer g_iChannel; | |
integer g_iListen; | |
////////////////////////////////////////////////////////////////////// | |
// Default state. | |
default | |
{ | |
////////////////////////////////////////////////////////////////// | |
// Configure the script. | |
state_entry() | |
{ | |
// Create the channel based on the owner's UUID. | |
g_iChannel = ( -1 * (integer) ( "0x" + llGetSubString( (string) llGetOwner(), -5, -1 ) ) ); | |
// Offset the channel a little so we don't obviously clash with anything else | |
// that has the same idea. Not really needed but... meh, why not, eh? | |
g_iChannel += 23; | |
// Listen for a call. | |
g_iListen = llListen( g_iChannel, "", NULL_KEY, "" ); | |
} | |
////////////////////////////////////////////////////////////////// | |
// On touch, send out the information for this prim. | |
touch_start( integer total_number ) | |
{ | |
llRegionSay( g_iChannel, "AsTheCrowFlys|" + ( (string) llGetOwner() ) + "|" + ( (string) llGetPos() ) + "|" + llGetObjectName() ); | |
} | |
////////////////////////////////////////////////////////////////// | |
// React to a message coming in on a listen event. | |
listen( integer channel, string name, key id, string message ) | |
{ | |
// If it's on the right channel... | |
if ( channel == g_iChannel ) | |
{ | |
// Split the message up | |
list lMessage = llParseString2List( message, [ "|" ], [] ); | |
// Is it a ping from another AtCF object? | |
if ( llList2String( lMessage, 0 ) == "AsTheCrowFlys" ) | |
{ | |
// From the owner? | |
if ( llList2String( lMessage, 1 ) == ( (string) llGetOwner() ) ) | |
{ | |
// Get the information we need about the other object. | |
vector vPos = (vector) llList2String( lMessage, 2 ); | |
string sName = llList2String( lMessage, 3 ); | |
float nDistance = llVecDist( llGetPos(), vPos ); | |
// Send a message to the owner, telling them how far away it is. | |
llInstantMessage( llGetOwner(), "Distance to object '" + sName + "': " + ( (string) nDistance ) + "m" ); | |
} | |
} | |
} | |
} | |
////////////////////////////////////////////////////////////////// | |
// Look for a change event. | |
changed( integer change ) | |
{ | |
// If the owner has changed... | |
if ( change & CHANGED_OWNER ) | |
{ | |
// ...do a reset. | |
llResetScript(); | |
} | |
} | |
} |
much easier - just assign the object a unique name and use area search it gives the distance as you move.
ReplyDeleteThat'd work, although there's three issues I can see with that:
ReplyDelete1) You need a viewer with area search
2) I personally find area search horribly slow to the point that, often, it's unusable
3) I've seen examples of it being very inaccurate. We had an issue at one location where area search seemed to be reporting values out by at least 20m