Skip to content

Total stats within play by play #454

@jdabapo

Description

@jdabapo

Attempting to do this from the TODO list:
show totals for pts/reb/ast/etc in play by play like "J. Brown Driving layup (12 pts) D. White (3 AST)" https://old.reddit.com/r/BasketballGM/comments/z99cby/monthly_suggestions_thread/j26zhxu/

Was looking in GameSim.basketball/index.ts, and thought it would make the most sense to insert it within the recordPlay function. I think that grabbing the player information (if available) then putting the correct information into the respective play type:
Ex:
texts = ["{0} grabbed the offensive rebound"];
would become
texts = ["{0} grabbed the offensive rebound {this.team[0].player[0].stat.orb}"];
But, since the way the names are inserted into the text is not a f-string, I was thinking of doing something similar to the code here, but using different keys other than 0 and 1 (like stl? or o_pts?)
(

if (names) {
for (let i = 0; i < names.length; i++) {
text = text.replace(`{${i}}`, names[i]);
}
}
)
However, a problem with this approach would be since that there are a number of different stats such as points, assists, etc. there would be quite a lot added with this, but if this was switched to using a f-string it would be easier to just change each of the texts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions