Page 1 of 1

Set up initial scores

Posted: 07 July 2020, 13:59
by DargorX
Hello!

First of all I'm newbie and I'm suffering with my first development :(

I'm totally blocked trying to set up players scores on table refreshing, it must be a very simple thing that all the games do but I'm not able to find the place to do that :oops: :cry:

I thought that the initial state (the first one after state 1) was the place but I am observing that some code in that state function (stNewRound in my case) are not executing (like a simple self::debug) and other parts yes.

Thanks in advance.

Re: Set up initial scores

Posted: 07 July 2020, 15:53
by RicardoRix
Not 100% sure what you're asking:

You need to update the player_score field in the player DB.

I think you mean the php game function. getAlldatas() (this is the F5 page refresh and/or start of the game).
you'll have something like $result['players']
but normally this is all setup for you, and it's automatically applied client side.

otherwise, for the client during the game with notifications:
http://en.doc.boardgamearena.com/Game_i ... yers_score

Re: Set up initial scores

Posted: 07 July 2020, 16:26
by DargorX
OMG! :lol:

I splitted players in $result['player'] and $result['opponents'] for different player boards view and other data, and I've not noticed I was breaking this automatic behaviour :D

Sorry for the newbie question.

Re: Set up initial scores

Posted: 07 July 2020, 16:41
by RicardoRix
I would expect everything inside the player table to be global information for all, so no need to change it. There's more boiler plate code supplied for things like favourite player colours.

client side as another freebie you'll have

this.player_id to identify the current player.

you'll often see things like,
if (player_id == this.player_id) inside a loop.

you also have
if ( this.isCurrentPlayerActive() )