I am trying to make a scoreboard that saves peoples top score in order from highest to lowest. Just like the image below.
Things I need to know:
1. How to actually get the score to save onto a scoreboard
2. How to get the top 100 in order from highest to lowest
3. How to make it change a person say from 1st to 2nd if he/she gets beat
Please don't give me a link to a library of a scoreboard. If you post code, only do daft little snippets that would show me how it's done. If you just give me the whole code, I wouldn't learn anything from copying and pasting.
ID:160364
Sep 25 2008, 4:23 am
|
|
1. How to actually get the score to save onto a scoreboard 1) This is where lists, indexes, and associations are useful. Scoreboard = one huge list, ordered by score. I'll just use text strings rather than 2 text strings and list; you have to do a little parsing, but it's infinitely better (resource wise). 2 and 3) Sort them by index: var/list/HS[100] //create a new list, with a len of 100 EDIT: Did I mention Air Mapster (Mike H) or Airjoe or someone like that has a DMCGI scoreboard demo? |
In response to Jeff8500
|
|
Make sure players can't have " - " in their name.
|
In response to Jeff8500
|
|
findtext() returns the position of the beginning of the word if found; 0 otherwise.
|
In response to Jemai1
|
|
I'll fix it, then.
|
What I did there was use an associative list, removing the entry of the person if they were already there and checking where to insert the entry based on other people's scores.
So to answer your questions based on the examples of [link]:
1. The example uses an associative list to enter the score data (and two procedures to load/save it).
2. Already explained in the 2nd (or 1st big) paragraph.
3. This is done in the example by removing the persons data for cases like this.
Note that the example is not the top 100, to do that: