Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Limiting the entries in a strided list

Rock Ryder
Registered User
Join date: 6 Oct 2006
Posts: 384
12-14-2007 18:33
Hi guys,

I am making something similar to a clocking-in / clocking-out system so that a group of us knows when the others in the group have been online in our sim, and when they left.

I have made the scanner part, and so the data it generates does not exceed memory limits I was thinking of storing it in a strided list, as this is well suited to storing data in the form of "Name", "Time in", "Time out", but I can't figure how to limit the number of records in the list, to, say, 20 entries, then as the 21st entry is made the first (earliest, or FIFO) in the list is deleted. Anyone know how to do this?

My last step will be to display the 20 entries on a prim (noticeboard), and to be truthful I have not yet looked into this, but if anyone as any advice, or caveats, it would be most appreciated.

TIA

Rock
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
12-14-2007 19:03
From: Rock Ryder
I can't figure how to limit the number of records in the list, to, say, 20 entries, then as the 21st entry is made the first (earliest, or FIFO) in the list is deleted. Anyone know how to do this?

Assuming you're adding new entries to the end of data_list:

if( llGetListLength( data_list ) > 60 )
data_list = llDeleteSubList( data_list, 0, 2 );

Edit:
Or, every time you add data, use:

data_list = llList2List( data_list + [ new_name, new_in, new_out ], -60, -1 );
Rock Ryder
Registered User
Join date: 6 Oct 2006
Posts: 384
12-15-2007 09:08
From: Deanna Trollop
Assuming you're adding new entries to the end of data_list:

if( llGetListLength( data_list ) > 60 )
data_list = llDeleteSubList( data_list, 0, 2 );

Edit:
Or, every time you add data, use:

data_list = llList2List( data_list + [ new_name, new_in, new_out ], -60, -1 );


Many thanks Deanna, just what i was looking for.

Rock