|
bucky Barkley
Registered User
Join date: 15 May 2006
Posts: 200
|
09-21-2006 17:07
Drat. I want to cache multiple notecards (say, half dozen of up to 10 lines each) upon script startup.
Bearing in mind that dataserver events can return results out of order, I am wondering what the best approach would be for building a list of strings (each element represents the contents of a notecard).
I understand the use of requestid's. I'm just pining for something like:
llListSetElement(list, elemNum, data)
(elemNum, in this case, would correspond to which notecard I am getting data from)
I suppose I am asking for a sparse array.
(the application is a picture frame, where each photo has a few lines of description in a notecard that is named similiarly)
|
|
Aakanaar LaSalle
Registered User
Join date: 1 Sep 2006
Posts: 132
|
09-21-2006 18:16
Make sure the lists starts with empty elements.. e.g. list myvar = [ "", "", "", ""]; and use llListReplaceList. I made a funciton that does something similar for strided lists. The rest of the strided functions are Here. // Replace a Stride in a List list fncReplaceStride(list lstSource, list lstStride, integer intIndex, integer intStride) { integer intNumStrides = fncStrideCount(lstSource, intStride); if (llGetListLength(lstStride) != intStride) { return ["-1"]; } if (intNumStrides != 0 && intIndex < intNumStrides) { integer intOffset = intIndex * intStride; return llListReplaceList(lstSource, lstStride, intOffset, intOffset + (intStride - 1)); } return ["-1"]; }
// Update a single item in a Stride within a List list fncUpdateStride(list lstSource, list lstItem, integer intIndex, integer intSubIndex, integer intStride) { integer intNumStrides = fncStrideCount(lstSource, intStride); if (llGetListLength(lstItem) != 1) { return ["-1"]; } if (intNumStrides != 0 && intIndex < intNumStrides) { integer intOffset = (intIndex * intStride) + intSubIndex; return llListReplaceList(lstSource, lstItem, intOffset, intOffset); } return ["-1"]; }
I'm sure you can compare those two and figgure out what i'm doing.
|