Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Plotting a list of locations on a sim map

Reverend Upshaw
Registered User
Join date: 5 May 2007
Posts: 14
10-15-2008 09:57
Hi Folks,

Just wondering if it's possible to plot a location on a sim map from a list of locations. Any thoughts?
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
10-15-2008 10:36
Not sure what you mean by 'plot'.

Got an example?
Reverend Upshaw
Registered User
Join date: 5 May 2007
Posts: 14
10-15-2008 12:14
Display. I'd like to rez a small prim over the map for each location.
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
10-15-2008 13:05
You can use http://wiki.secondlife.com/wiki/LlRezObject to rez stuff from an objects inventory, though it will fail if you try to rez something more than 10m away.

To get around the 10m limit, you could have the rezzer object tell the rezzee object where to go then use something like this to move it into position:

while (llVecDist (llGetPos(), targetVector) > 0.01) llSetPos(targetVector);
Reverend Upshaw
Registered User
Join date: 5 May 2007
Posts: 14
10-15-2008 13:08
Thanks. I think i've got that part figured out. I'm looking for a formula to figure out how to rez the prim over the map in it's position on the sim.
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
10-15-2008 13:11
Map?

You're trying to make something that people can see when they open the grid map or (if it ever gets updated) on slurl?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-15-2008 13:13
From: Reverend Upshaw
Thanks. I think i've got that part figured out. I'm looking for a formula to figure out how to rez the prim over the map in it's position on the sim.

You are going to have to scale the vectors. You could use my 3D Radar as a reference:

http://wiki.secondlife.com/wiki/3D_Radar
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
10-15-2008 13:21
From: Jesse Barnett
http://wiki.secondlife.com/wiki/3D_Radar

integer name = TRUE;
if (name) {
avName = llDetectedName(0);
name = FALSE;
}

Think there's a tiny bug there.. Maybe "if (avName == "";)" would work.

Just out of curiousity, why not use llGetObjectDetails on a timer?
Reverend Upshaw
Registered User
Join date: 5 May 2007
Posts: 14
10-15-2008 13:41
Thanks, I'll check that out.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-15-2008 14:28
From: Sindy Tsure
Think there's a tiny bug there.. Maybe "if (avName == "";)" would work.

Just out of curiousity, why not use llGetObjectDetails on a timer?

Yep I hate old code. It did work but rewriting now to make it more efficient.
EDIT: Updated
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-15-2008 14:50
From: Reverend Upshaw
Thanks, I'll check that out.

But basically it works like this; Say your sim map is 2 meter square, a simulator is 256 meters square so to show a representation of an avatar for instance =

CODE

default {
state_entry() {
vector mapPos = <125, 125, 125 >; //llGetPos();
vector avPos = <250, 250, 250 >;
vector rezPos = (avPos - mapPos);
rezPos = rezPos / (256 / 2); //(256/2) = sim size / map size
rezPos.z = mapPos.z + .25; //1/4 meter above sim map surface
llOwnerSay((string) rezPos);
}
}

This returns:
"temp: <0.97656, 0.97656, 125.25000>"
AV is nearly at edge of sim and map!!
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-16-2008 20:26
This should be something you can use as a template to start with:

Place this script in an invisible prim just above the highest point of your map. Edit the map and select this prim last and link:
CODE

//////////////////////////////////////////////////////////////////////////////////////////////////////
// Map Rezzer 1.0
// "Oct 16 2008", "23:23:34"
// Creator: Jesse Barnett
// Released into the Public Domain
//////////////////////////////////////////////////////////////////////////////////////////////////////

float mapSize = 6; //Set length of map side here
integer xyAxis = 256; //Set length of target area side here(simulator would be 256)
float maxHeight = 5.0; //Adjust rez height here (maximum 10)
list locList =[<256, 256, 50 >, <10, 250, 100 >, <125, 125, 250 >, <100, 200, 1200 >];
//Populate the locList however you want

///////////////////////////DO NOT CHANGE THESE///////////////////////////////////////////////
vector mapPos;
integer p;
integer locListLength;
list rezList;
integer rezListLength;
float zScale;
string rezObj;

createList(){
rezList =[];
for (p = 0; p < locListLength; ++p) {
vector rezPos = (vector) llList2String(locList, p);
rezPos = (rezPos - <128, 128, 0 >) / (xyAxis / mapSize);
rezPos.z = (rezPos.z * zScale);
if (rezPos.z > maxHeight) {
zScale = zScale * (maxHeight / rezPos.z);
createList();
return;
}
rezPos += mapPos;
float dist = llVecDist(rezPos, mapPos);
if (dist > 10) {
zScale = zScale * .998;
createList();
return;
}
rezList += rezPos;
}
rezListLength = llGetListLength(rezList);
}

default {
state_entry() {
zScale = 1;
mapPos = llGetPos();
rezObj = llGetInventoryName(INVENTORY_OBJECT, 0);
locListLength = llGetListLength(locList);
createList();
}
touch_start(integer n) {
for (p = 0; p < rezListLength; ++p) {
llRezObject(rezObj, llList2Vector(rezList, p), ZERO_VECTOR, ZERO_ROTATION, 1);
}
}
}

Create the object that you wish to rez and place this script in it. (This will keep the prims from counting against your limit) Whenever anyone touches the map, the objects will rez and display for approximately 55 seconds.:
CODE

default {
state_entry() {
llSetPrimitiveParams([PRIM_TEMP_ON_REZ, TRUE]);
llRemoveInventory(llGetScriptName());
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Reverend Upshaw
Registered User
Join date: 5 May 2007
Posts: 14
10-18-2008 14:35
WOW, perfect. Thanks.