I run a ferryboat that runs a set of nine islands.
The boat reports its location every 10 seconds. Here's the LSL that gets the location and then gets coordinates relative to the southwest corner of the islands cluster (Marylis is the SW corner):
vector worldlocation;
float frequency= 10.0;
float boatx;
float boaty;
integer maryliszerox= 241408;
integer maryliszeroy= 278016;
integer mapx=125;
integer mapy=134;
default
{
state_entry()
{
llSetTimerEvent(frequency);
}
timer()
{
worldlocation = llGetRegionCorner() + llGetPos();
boatx= (llRound(worldlocation.x) - maryliszerox);
boaty= (llRound(worldlocation.y) - maryliszeroy);
llRegionSay (-101010, "X"+(string)boatx +" "+(string)boaty);
}
}
This is reported through a set of chat relays back to a map, which then plots the location of the boat with a temporary prim relative to the size of the map and the corner:
The script :
float delay = 10.0;
float mapx;
float mapz;
integer listen_Channel = -101010; //change this to your channel
integer broadcast_Channel = -202020; //change this to your channel
default
{
state_entry()
{
llSetText("", <1.0,1.0,1.0>, 1);
llListen(listen_Channel,"",NULL_KEY,"");
}
listen(integer channel, string name, key id, string message)
{
llRegionSay(-303030, message);
if (llGetSubString(message, 0, 0) == "X")
{
mapx=(float)llGetSubString(message, 1, 10);
mapz=(float)llGetSubString(message, 12, 21);
mapx= mapx / 1280;
mapz= mapz / 1280;
mapx= 113.040 + mapx;
mapz= 24.362 + mapz;
llRezObject("Display Prim",<mapx,150.65,mapz>, ZERO_VECTOR, ZERO_ROTATION, 1);
}
}
}
Things get odd when the boat reaches the middle of Mare Draconus sim, as demonstrated with this YouTube video:
http://www.youtube.com/watch?v=2L57Zad7biY
The incident happens about 1 minute and 50 seconds into the video. While looping around a pirate ship on Mare Draconus. The tracking map thinks the boat has leaps down to Marylis sim, jumps further south, then pops back to its actual position.
Have I discovered The Bermuda Triangle of SL?
Thanks,
-ls/cm