|
Zing Ping
Registered User
Join date: 3 Jul 2006
Posts: 8
|
07-24-2006 09:48
I'm trying to create a scoreboard that will update as people answer questions correctly, and keep track of who got answers right, along with the number of right answers, etc...
I've been trying to do it with strided lists, but must admit I'm a doofus when it comes to lists. Is there an open source full working example script of strided lists, or an open source scoreboard script or anything like that any where?
If not, I have a modest amount of L$ I can hire someone to write the code for me.
Thanks, Zing Ping
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
07-24-2006 09:53
Since any list update means pretty much rebuilding its content, you'll probably want to have two (or more) separate lists to hold character names and other data, respectively, than a strided list. If just to keep memory use and speed at more reasonable level x.x;
|
|
Thraxis Epsilon
Registered User
Join date: 31 Aug 2005
Posts: 211
|
07-24-2006 15:34
list scores; // Strided list of 3 elements. Score, Name and Key
integer scoreValue = 10;
increseScore(key id) { integer index = llListFindList([id]); if(index != -1) { integer scoreTemp = llList2Integer(scores,index - 2); scores = (scores=[]) + llDeleteSubList(scores,index - 2,index) + [scoreTemp + scoreValue,llKey2Name(id),id]; } else { scores = (scores=[]) + scores + [scoreValue,llKey2Name(id),id]; } scores = (scores=[]) + llListSort(scores,3,FALSE); }
decreseScore(key id) { integer index = llListFindList([id]); if(index != -1) { integer scoreTemp = llList2Integer(scores,index - 2); scores = (scores=[]) + llDeleteSubList(scores,index - 2,index) + [scoreTemp - scoreValue,llKey2Name(id),id]; } else { scores = (scores=[]) + scores + [0 - scoreValue,llKey2Name(id),id]; } scores = (scores=[]) + llListSort(scores,3,FALSE); }
listScores() { integer length = llGetListLength(scores) for (integer x = 0; x < length; x = x + 3) { llSay(0,llList2String(scores,x+1) + " " llList2String(scores,x)); } }
default { state_entry() { scores = []; } on_rez(integer num) { // Reset the script llResetScript(); }
}
There is a rough framework....
|