Can i do this list?

Hello

Can I make list which looks like this
Name 1 (score)
Name 2 (score)
Name 3 (score)
.
.
.
.
Name X (score)

I want the game to keep sort them according to the score

Yes, you can, but that demands a bit of programming.

You essentially need two master lists that you keep synchronized, one for the names and one for the score (synchronized means that the first name in the list of name corresponds to the first score in the list of score. It does not matter what order they are in). The reason to keep them separate is not only that it is easier to update the score list with a new score of it contains only numbers, but also because it would be difficult to sort a list that mixes names (that should not be sorted) with numbers.

There is, in the list toolbox, an operation to sort numeric, and you can request descending, meaning that the largest score would come first. You therefore create a new list, which is the sorted score.
Once this list is sorted, then you can grab the sorted score entry #1, and look for its value in the unsorted master score list, using the “find first occurrence of item” function. This will return the index in the master list.

For instance you have the following
Bob 188
Anna 214
Charlie 94

The sorted score list would be in order 214,188,94
With the high score (entry #1 in sorted score) 214, we look in the list [188,214,94] and find the index 2.
Therefore, the name that should appear as top scorer is entry #2 in list [Bob,Anna,Charlie] and that is Anna. And the score to be shown will be entry #2 which we already established to be 214.
Now, it is up to you to populate the list putting name and score together.

Warning: the function 'find first occurrent of item" will be defeated in the case two or more players have the same score. You will have to develop a logic to cater for this, like having a duplicate copy of the master score list that you empty of the value found after it has been identified, so that it cannot be found a second time.

1 Like

Based on the example @CBVG I created blocks. To solve your problem, use the Local DB component

https://x.thunkable.com/projects/5dac875aa74c9f81958cc3dd/project/properties/designer/

1 Like

Thank you very much for the idea

Thank you very much @actech but the problem is that i did not understand it well

How can i understand it fully and completely so I apply it in my app ?

You understand something by making an effort.
No one can ‘understand’ something for you.