SQL help? It's only pulling unique rows when I want everything

Game development with Board Game Arena Studio
User avatar
Benoit314
Posts: 82
Joined: 02 April 2020, 22:12

Re: SQL help? It's only pulling unique rows when I want everything

Post by Benoit314 »

If you are in your first state, I doubt you need to pass these infos to the client.
After game setup, the framework already calls getAllDatas and sends it to the client. Do some digging on the available client side variables in your browser console.

Also, read a bit on the difference between current player and active player. You cannot use the current player in a Arg function as it does exists and if it did it wouldn't return something useful.
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: SQL help? It's only pulling unique rows when I want everything

Post by Victoria_La »

Try to read the docs or at least skim though it, there is function to load player info which is cache and save to call from everwhere $players = $this->loadPlayersBasicInfos();
Ciffy wrote: 28 February 2021, 06:17 How do I get to the player data from within PHP? I'm trying the following. I'm in an arg Function is that matters. First state of the game after setup.

$player_id = self::getActivePlayerId();

$gamedata = self::getAllDatas();

$players = $gamedata['players'];

Code is crashing on either of the first two lines. I've tried getCurrentPlayerId as well and it doesn't seem to help. Odd thing is, I had it all working and then went to test it again and it gave me the "you got a php error" nonsense (according to the frequent errors doc).

And to answer Tisaac, where is this flashing light? I'm trying to RTFM but there's a LOT and I'm not even sure what I'm looking for half the time.
User avatar
Ciffy
Posts: 30
Joined: 18 August 2015, 21:59

Re: SQL help? It's only pulling unique rows when I want everything

Post by Ciffy »

Victoria_La wrote: 28 February 2021, 16:05 Try to read the docs or at least skim though it, there is function to load player info which is cache and save to call from everwhere $players = $this->loadPlayersBasicInfos();
is that in php or js?

I was able to ignore the arg function entirely and just get the info i needed in JS with the gamedatas; had to do some digging to see how it was all formatted. Lots of "this.gamedatas.players[this.player_id].field"s. Seems needlessly complicated but I got what I needed done. Now onto making things clickable and interactive!! weeeee.
User avatar
Archduke
Posts: 128
Joined: 05 June 2011, 21:58

Re: SQL help? It's only pulling unique rows when I want everything

Post by Archduke »

getCollectionFromDB returns an associative array on the first column.

Try getObjectListFromDB which returns a simple list.
Post Reply

Return to “Developers”