Update scoreboard using dictionary

Hi everyone!

I'm trying to make a game with a scoreboard and I've encountered a problem that I can't solve....

How to change (update by added points) the value of the key "score", in a player based on the value of the key "name" which is, for example, "Player 1"?

I have such a data structure:

This is how I add a player to the dictionary:

LBoard3

I know that I should first extract the current "score" value, and then add a new one to it and update it.
I have a problem with how to find the player by name - what to enter in "get value at key path"?

Or do I have the wrong data structure?
Could any of you help me find a solution?
Greetings and thanks in advance!

You are over complicating this.
Your dictionary only needs the player name as a key, and the running total for that player as that key's value.

To add points to a player's score,
set value for key(name) in dict to (score + get value in dict for key(name) default(0)).

If you need to show scores in descending order, convert the dict to a 2 column table (name,score) using one of the dict blocks, and use one of the sorting techniques from

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.