this.scoreCtrl

Game development with Board Game Arena Studio
Post Reply
User avatar
pickardj79
Posts: 17
Joined: 26 July 2020, 04:34

this.scoreCtrl

Post by pickardj79 »

http://en.doc.boardgamearena.com/Game_i ... amename.js has docs on how to increase the player's score (the stars on the player board). Which seems to be used through notif's. On page load, are these stars automatically set to player.player_score from the database? I've played games where everyone's score is "-", how is that done? For games with hidden scores, is there a way to show only this.player_id's score (the player id of the browser running the code) leaving the other player scores as "?" or "-"?
User avatar
Lymon Flowers
Posts: 195
Joined: 01 April 2020, 21:14

Re: this.scoreCtrl

Post by Lymon Flowers »

Either you overwrite this.scoreCtrl (which is a bit kludgy because it is set AFTER your setup function, but it works, I've done that on downforce in order to localize a score with currency).

Or you do not update player_score until the final scoring and update a hidden custom score field during the game. You show this score in player's panel as something else.
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: this.scoreCtrl

Post by RicardoRix »

For the currency symbol I found this css snippet:

Code: Select all

.player_score_value::before {
  content: '£';
}
User avatar
Lymon Flowers
Posts: 195
Joined: 01 April 2020, 21:14

Re: this.scoreCtrl

Post by Lymon Flowers »

Unfortunately, this has to be more complicated, because Americans use for instance the notation "-$1,234" and Frenchmen use "-1 234€". That is even WORSE in Downforce, since we are talking about M$ (million-dollars). The joys of i18n :mrgreen:
User avatar
pickardj79
Posts: 17
Joined: 26 July 2020, 04:34

Re: this.scoreCtrl

Post by pickardj79 »

Nice css snippet:). Luckily I'm working with a game that made up its own currency icon, so i18n ain't a problem. Score hiding though... I'm going the separate indicator with end-game score update option.

I'll make a note to check out how it's done in downforce (presuming the code/project is publicly readable). I love the downforce implementation btw - well done!!
Post Reply

Return to “Developers”