Jump to content
Sign in to follow this  
JohnathanMacBride

Saving data

You are about to reply to a thread that has been inactive for 1624 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

As long as you can be fairly sure that you will not need to restart the HUD's script, you can store quite a long list of locations in lists, until you hit the 64K memory limit.  If you're worried about data losss if to do restart the script, you can save a limited amount of data in prim descriptions or in other non-volatile parameters, although you may need to encode some of them.  You can encode vectors as a hex integers, for example, to save space.  Still, you can't save much data that way, compared to what you can save in the script itself.  If you really want to save large amounts of information, send it somewhere else -- to a remove server in world or outside SL altogether.  Or, most promising (and easiest, if you are writing scripts in an Experience), save the information in KVP records.  There are storage limits even there, but they are on the order of hundreds of thousands of records or more.

Share this post


Link to post
Share on other sites

This would be grid wide and external to experiences, so kvp records are probably out. however I could do lists with an import/export function for data safety. I am dealing with either landmark locations e.g.: simname/x/y/z or global coordinates for each location. So I am looking at either a string, string vector combination or strictly vector data per location. whichever turns out to be less storage intensive.

where can i find more about encoding to hexadecimal?

Share this post


Link to post
Share on other sites

After doing additional research, it seems that as long as the script is not reset, I can even us Strided lists to store the data. again, I will be checking to see which is most cost efficient.

 

Thanks for the advice and I look forward to anything anyone else has to offer.

 

Share this post


Link to post
Share on other sites

 


JohnathanMacBride wrote:
where can i find more about encoding to hexadecimal? 


First hit when I type "lsl encode to hex" into google: http://wiki.secondlife.com/wiki/Float2Hex

That's a float though.

The google search term will provide more hits that might suit your need more.

 


JohnathanMacBride wrote:

I can even us Strided lists to store the data. 


 

It doesn't seem like the sort of data that would be useful to stride.

But it's hard to know your level, and what you want... am I teaching you to suck eggs describinf llCSV2List for example.

As a crude, unoptimised example and there are better ways, but this is very quick and simple:

 

string test = "Simname,10,150,20.2";list regionDetails = llCSV2List(test);

And to use those......

 

string SimName = llList2String(regionDetails,0); // -> Simnameinteger xPos = llList2Integer(regionDetails,1);  // -> 10integer yPos = llList2Integer(regionDetails,2);  // -> 150
float zPos = llList2Float(regionDetails,3); // -> 20.2

You wouldn't of course use a float for z, but it's showing you can store anything in a CSV string.

 

buuuuuttttttttt

Considering you are thinking using hex... and possibly the lag cost with converting that.... if you drop z. to drop a few bytes then the commas won't be desirable.

Buuuuutttttt then again You do know you can hold a tonne of data in memory don't you so a delimiter shouldn't even be a blip on the radar.

Share this post


Link to post
Share on other sites

How many do you need to store, and what are you doing with them once stored? I mean, if it's "write-only memory" you can pretend to store an infinite number, right?

The real question is how you'll need to access them -- just a dump maybe in the order they were stored, or by some query? And if query, by name? by quadtree?

Assuming the simplest case, just a huge list of global coordinate vectors is a reasonable compromise among size, performance, and precision. (That is, you could re-code those into integers to save space, but only by sacrificing a lot of precision, or recode the whole list into one monstrous bit-coded string, but with a heavy performance penalty for doing anything much with the contents.)

You can get back and forth between global coordinates and region names using the Map API's utility caps and (in one direction) with llRequestSimulatorData(..., DATA_SIM_POS).

On the off-chance that these locations could correspond to manually-collected landmarks in object inventory, llRequestInventoryData() could be useful.

Share this post


Link to post
Share on other sites

As one example of coding vectors as integers, I point to Void Singer's final contributions to these forums in https://community.secondlife.com/t5/LSL-Scripting/Finity-s-End/m-p/1254169 , I have retooled her code for several applications.  It's particularly helpful for passing a vector as an on_rez start parameter which, of course, must be an integer.

Share this post


Link to post
Share on other sites

Thanks, yes I am aware of that limitation. Attributions will be included. As of yet everything i have is hand coded by myself, but anything borrowed will be attributed.

 

The idea is to save a location, make it retrievable and selectable by menu, then a teleport ensues from the 'active' or 'selected' destination. Global coordinates would make the most sense, however, an identifiable name for each location would be a must for retrieval also.

 

This has been a lot of help, I am glad to have such knowledgeable people so close at hand.

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 1624 days.

Please take a moment to consider if this thread is worth bumping.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...