Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple data storage

Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
10-10-2009 10:25
/54/3d/310002/1.html

I have a hud that tracks distance travelled.
I want one of the HUDs option to store that distance in a file(?).
I want to manipulate that data and store it as such:

NAME OF OWNER
TOTAL DISTANCE TRAVELLED TO DATE
DISTANCE TRAVELLED THIS JOURNEY

I currently send this information to an external database and use PHP to do all the work but I think it would be more efficient if I kept it internal to the HUD.

I have looked at the link above for ideas but would like to get your input or a simple code clip. thanks
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
10-10-2009 10:30
I should mention that I am guessing only 1 row is required as this information is only for that one owner. And its only a few fields, each being updated after every journey. For example

1st Journey:
______________________
Owner Name : Joe Doe
Distance Traveled this Journey : 320
Total Distance Traveled to Date: 320
______________________

2nd Journey


______________________
Owner Name : Joe Doe
Distance Traveled this Journey : 4000
Total Distance Traveled to Date: 4320
______________________
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
10-10-2009 11:45
If you already have the data elements defined for export, then you have 90% of the work finished already. Since you've already discovered Very's system, you have the other 10% mostly in hand also.

If you want to do your own scripting, this project doesn't sound like it's too challenging. LSL is not designed well for data storage... certainly not for the sort of database manipulation and report generation that other languages are great at. Whatever you do internally is going to feel clunky compared to what you can do with PHP and SQL on a server that is meant to handle lots of data. Still, so long as you don't overload your script's memory a project like this is not hard in LSL. You can store your three data per record as elements in a strided list and then read them back out in sets of three when you want to generate a report. Take a look at the discussion of strided lists at http://lslwiki.net/lslwiki/wakka.php?wakka=list.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
10-11-2009 05:32
Another option to strided lists is just using multiple lists, in your case three, as this can be more memory efficient for larger result sets, but will be more complicated if you want to sort them somehow.

But it also has the added advantage of being able to use llListStatistics() to more quickly total a column if you wish.
_____________________
Computer (Mac Pro):
2 x Quad Core 3.2ghz Xeon
10gb DDR2 800mhz FB-DIMMS
4 x 750gb, 32mb cache hard-drives (RAID-0/striped)
NVidia GeForce 8800GT (512mb)
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
10-11-2009 13:09
great thanks. I think I will stick with sending it to an external db and manage it via php
Nita Paule
Registered User
Join date: 27 Jul 2008
Posts: 2
no database needed
10-30-2009 23:26
From: Nichiren Dinzeo
great thanks. I think I will stick with sending it to an external db and manage it via php


just store the info in a prim's DESCRIPTION field and use a seperator character between the values. then all you need to do is parse that string back into your variables, adjust them and then at journey's end, write them back.