setting player_score / star on player panel
Posted: 21 September 2024, 07:06
So I thought I had this figured out:
I'm using this code to calculate a player's score (simple chess-like game - score = pts of captured pieces).
and this works while in development .. however, just gone to ALPHA .. and it "seems" like this isn't working? I'm in a game with a friend testing things out, and I noticed our scores are both "0" despite both having captured pieces.
Did some searching, found this thread:
https://boardgamearena.com/forum/viewto ... ar#p151036
But that logic doesn't seem to update anything on the player's panel.
So why does original logic work in dev, but not in Alpha (ie production) ?
and how "SHOULD" I be coding it ?
(again, all I'm trying to do is update the score in the player panel next to the golden Star)
I'm using this code to calculate a player's score (simple chess-like game - score = pts of captured pieces).
Code: Select all
// update score
$value = $this->pieceValue[$captured_piece['piece_type']];
$sql = "UPDATE player SET player_score_aux = player_score_aux + $value WHERE player_id = $player_id";
self::DbQuery( $sql );
$newScores = self::getCollectionFromDb( "SELECT player_id, player_score_aux score FROM player", true );
self::notifyAllPlayers( "newScores", '', array( 'newScores' => $newScores ) );Did some searching, found this thread:
https://boardgamearena.com/forum/viewto ... ar#p151036
Code: Select all
$sql = "SELECT player_id id, player_score score, player_no, player_name name, player_color color FROM player";
$result["players"] = self::getCollectionFromDb($sql);But that logic doesn't seem to update anything on the player's panel.
So why does original logic work in dev, but not in Alpha (ie production) ?
and how "SHOULD" I be coding it ?
(again, all I'm trying to do is update the score in the player panel next to the golden Star)