Billboard (AllPlayers + score), not only one player

Hi,

I would like to show the list of the Players in the game with a persistant score.

The billboard is updated like that :

    UpdateStatsBillboard(Agent:agent):void=

        if:
            # Get the current stats of the given agent.
            CurrentPlayerStats := PlayerStatsManager.GetPlayerStats[Agent]

        then:
            StatsBillboard.SetText(
                StatsMessage(
                    Player := Agent,
                    Score:=CurrentPlayerStats.Score
                )
            )

My issue :

It’s only for the Agent / Player who click on a Button or anyting else.

I would like the entire list of the Players …

I tried to increment a var (string) or anything like :

 UpdateStatsBillboard<public>(Players:[]agent):void=

        var PlayerAndStatsArray:[]player_and_stats =

                for:

                        Agent:Players
                        Player := player[Agent]
                        PlayerStats := PlayerStatsManager.GetPlayerStats[Player]

                do:

                        player_and_stats:
                            Player := Player
                            StatsTable := PlayerStats

But it does’nt work…

I think it’s easy for a lot of you … Sorry, I started Verse … :slight_smile:

Thx !

Hi again

I tried anything else ..

One billboard for each player :smiley:

I’m near that’s I want. My code is :

    StringToMessage<localizes>(String : string, Agent:agent) : message = "{String} {Agent}"

    UpdateStatsBillboardOK(Agent:agent): void=

   
                var AllScores :[]player_stats_table_test = array{}
                if:
                        CurrentPlayerStats := PlayerStatsManager.GetPlayerStats[Agent]

                then :
                        for(Player : GetPlayspace().GetPlayers()):
                                CurrentPlayerScore:=CurrentPlayerStats.Score
                                set AllScores += array{player_stats_table_test{Version := 0, Score := CurrentPlayerScore}}
                
                        for(idx -> S : AllScores, BB := Billboards[idx]):
                                BB.SetText(StringToMessage("#{idx+1} / {S.Score} / ", Agent))

My issue : The name is “Agent”, that’s logic …

I think it’s not logic to have the name of the Player in the Peristant … So How can i put the player’s name inside this for (idx → S : etc.)

Plzzzzzz and THX :slight_smile:

NB : my player_stats_table_test :

# Tracks different persistable stats for each player.
player_stats_table_test<public> := class<final><persistable>:

    # The version of the current stats table.
    Version<public>:int = 0

    # The score of a player.
    Score<public>:int = 0

Re….

Now I have the 2 nickname like that :

  StringToMessage<localizes>(String : string, String2 : message) : message = "{String} {String2}"

    var PlayerNames : []message  = array{}

    PlayerNameToMessage<localizes>(Agent:agent)<computes>: message = "{Agent}"
    UpdateStatsBillboardOK(Agent:agent): void=

        
                var AllScores :[]player_stats_table_test = array{}
                if:
                        CurrentPlayerStats := PlayerStatsManager.GetPlayerStats[Agent]

                then :

                        Players := GetPlayspace().GetPlayers()
                        for(found : Players):
                                CurrentPlayerName : message = PlayerNameToMessage(found)

      CurrentPlayerScore:=CurrentPlayerStats.Score
                                set AllScores += array{player_stats_table_test{Version := 0, Score := CurrentPlayerScore}}
                                set PlayerNames = PlayerNames + array{CurrentPlayerName}   

                
                        for(idx -> S : AllScores, BB := Billboards[idx], PN := PlayerNames[idx]):
                                BB.SetText(StringToMessage("#{idx+1} / {S.Score} / ", PN))

But …. The scores are the same (the score of who clicked…)

It’s logic, but I can’t Agent under ….

It tells me :

This invocation calls a function that has the ‘decides’ effect, which is not allowed by its context. The ‘decides’ effect indicates that the invocation calls a function that might fail, and so must occur in a failure context that will handle the failure. Some examples of failure contexts are the condition clause of an ‘if’, the left operand of ‘or’, or the clause of the ‘logic’ macro.(3512)

Help plzzzzzz