Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Access to client asset keys for maps

SignpostMarv Martin
Registered User
Join date: 8 Oct 2005
Posts: 68
05-01-2006 08:11
A post on Torley Linden's blog reminded me of something I asked about not long ago- why isn't there a way to grab the client asset key for map images ?

llGetRegionMap("Ahern";); // returns the client asset key of the texture displayed on the world map if the owner of the script can see it on the world map, NULL_KEY if the region does not exist or they don't have access to it (through banning etc). Syncs up with whatever is displayed on the world map.

llGetRegionTerrain("Ahern";); // returns the client asset key of the texture displayed on the mini map if the owner of the script can see it on the world map, NULL_KEY if the region does not exist or they don't have access to it (through banning etc). Reflects state of terrain when the function is called (not sure if it'd be possible to call it once then have the texture change automatically without having to recall llSetTexture() so I'll assume it isn't for now).

These functions would allow residents to make their own world maps and mini-map HUD attachments without having to upload the textures every time the regions changed significantly.

The functions I suggested on another post would allow for greater creativity as well.

Thoughts/comments ?


Vote on Prop 1343
Sky McGann
Light Jogauni
Join date: 9 Nov 2005
Posts: 80
Liking the Idea
05-02-2006 10:28
One thing that I would like to see to is a "You've Been Here" mark, either a color change of the sim or a list that you can edit.
_____________________
From: someone
Never Regret. When you do, you're saying you didn't learn from your mistakes.

From: someone

Being part of the problem is easy. Being a part of the solution is the tricky part.
SignpostMarv Martin
Registered User
Join date: 8 Oct 2005
Posts: 68
05-04-2006 12:43
CODE
if(llListFindList(visitedRegions),llGetRegion()) >= 0)
{
llSetTextureParams([TEXTURE_COLOR_MODE,TEXTURE_COLOR_GREYSCALE,ALL_SIDES]);
}
else
{
llSetTextureParams([TEXTURE_COLOR_MODE,TEXTURE_COLOR_FULL,ALL_SIDES]);
visitedRegions += [llGetRegion()];
}


Something along those lines would do the job.
SignpostMarv Martin
Registered User
Join date: 8 Oct 2005
Posts: 68
05-04-2006 17:35
Here's another way:

CODE

list visitedRegions = [];
list timeSpent = [];

integer firstUseTime;
integer arrivalTime;

string lastRegion;

setup()
{
firstUseTime = llGetUnixTime();
}
arrive()
{
arrivalTime = llGetUnixTime();
lastRegion = llGetRegionName();
}
depart()
{
integer regionLocationInList = llListFindList(visitedRegions,[lastRegion]);
if(regionLocationInList == -1)
{
visitedRegions += [llGetRegionName()];
timeSpent += [llGetUnixTime() - arrivalTime];
}
else
{
timeSpent = llListReplaceList(timeSpent,[(llGetUnixTime() - arrivalTime) + llList2Integer(timeSpent,regionLocationInList),],regionLocationInList,regionLocationInList)
}
// The following segment isn't complete- it'd have to be passed to the relevant object/side etc.
llSetTextureParams([TEXTURE_UUID,llGetRegionMap(),TEXTURE_COLOR_MODE,TEXTURE_COLOR_FULL,TEXTURE_SATURATION,saturationLevel(lastRegion)]);
// End of incomplete segment.
arrive();
}
float averageTimeSpent()
{
integer x;
integer length = llGetListLength(timeSpent);
integer total = 0;
for(x = 0;x<length;x++)
{
total += llList2Integer(timeSpent,x);
}
return (float)(total / length);
}
float saturationLevel(string region)
{
integer timeVisited = llList2Integer(timeSpent,llListFindList(visitedRegions,[region]));
float avgTime = averageTimeSpent();
return ( (timeVisited/avgTime) * 0.5); // Note that I suggested 0.5 be the default level of saturation, to allow over exposure effects to be generated on the fly etc. I hadn't thought of using it in this manner when I proposed it.
}
state default
{
state_entry()
{
setup();
}
change(integer change)
{
if(change & CHANGED_OWNER)
{
llResetScript();
}
if(change & (CHANGED_REGION | CHANGED_TELEPORT))
{
if(arrivalTime == 0)
{
arrivalTime = llGetUnixTime();
lastRegion = llGetRegionName();
}
else if(lastRegion != llGetRegionName())
{
depart();
}
}
}
}



The above code- although messy- is meant to convey the possibililty that the user could be wearing a custom mini and world map HUD- the saturation of the map texture being directly proportionate to the amount of time spent there. The way the maths work with the
CODE
float saturationLevel(string region)
{
integer timeVisited = llList2Integer(timeSpent,llListFindList(visitedRegions,[region]));
float avgTime = averageTimeSpent();
return ( (timeVisited/avgTime) * 0.5); // Note that I suggested 0.5 be the default level of saturation, to allow over exposure effects to be generated on the fly etc. I hadn't thought of using it in this manner when I proposed it.
}
function, the textures for regions close to the average time spent in the regions would be near normal saturation levels, regions below the average time spent in a region would be basically grey and lifeless, whereas regions where a lot of time spent would gradually become overly saturated- a visual hint to go explore some more of the ever-expanding world.
SignpostMarv Martin
Registered User
Join date: 8 Oct 2005
Posts: 68
05-09-2006 06:52
It's been brought to my attention that these functions should trigger a datasever event, whereas llGetMap() and llGetTerrain() should just fetch the current region's map data (without the dataserver query).

In conversation with Seronis, the problem of too-many prims to make a map came up.

Another alternative would be to make an LSL (and then Mono) version of the Map API available- so regions can be grouped together on one texture etc.

Personally, I think it's unfair that "the internet" has more control over what can be done with the map data than "the residents" can- since they don't have to pay to get a copy of the texture that would be returned by llGetRegionMap() into their application.

It also came up that the UUIDs for the region maps might not be static, so I'm proposing the additional function "llHasRegionUpdatedSince(string regionName,integer unixTimestamp)" (rename to suit :-P) returning a boolean (integer) of TRUE or FALSE via the dataserver event

If the texture UUIDs are dynamic, the textures are archived, and the functionality of having multiple regions on one texture is made available through LSL, then things like the "then and now" map on Help Island would be easier to do. No re-uploading the textures time after time- possibly just a self replicating map that clones itself once a month or once a year to reflect changes in the grid.