php Deck: createCards and location_arg

Game development with Board Game Arena Studio
Post Reply
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

php Deck: createCards and location_arg

Post by RicardoRix »

Using the php deck component, when trying to initialise the location_arg with a large number, like the player_id, it corrupts the number, I was getting values between 50 and 70.

I initialise the type_arg with the same number as that is fine.

Code: Select all

		
$actionCards = [];
foreach( $players as $player_id => $player )
{
	for( $value=100; $value<=103; $value++ )   
        {
		$actionCards[] = array( 'type' => $value, 'type_arg' => $player_id, 'location_arg' => $player_id, 'nbr' => 1);
	}	
}		
 $this->cards->createCards( $actionCards, 'action_hand' );			
If afterwards I do this:

Code: Select all

		self::DbQuery( "UPDATE card SET card_location_arg=card_type_arg WHERE card_location='action_hand'");	
then the card_location_arg is now OK.
User avatar
Loreroth
Posts: 18
Joined: 05 August 2014, 07:28

Re: php Deck: createCards and location_arg

Post by Loreroth »

I'm not sure that you can set the location_arg through the array, the documentation only provides for setting it through the create cards method.

Code: Select all

createCards( $cards, $location='deck', $location_arg=null )
https://en.doc.boardgamearena.com/Deck# ... _component
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: php Deck: createCards and location_arg

Post by RicardoRix »

yes, you are right, Thanks.

I have used the argument in create cards instead and that works fine.

I got slightly hung-up on this statement:
Note: createCards is optimized to create a lot of cards at once. Do not use it to create cards one by one.
Post Reply

Return to “Developers”