Page 1 of 1

Issue creating deck of cards

Posted: 09 April 2021, 09:49
by Ottoreg
Hello,

I'm having troubles creating a deck of cards for my game.

The Error is "Propagating error from GS 1 : BGA service error" (so probably database side if i understand well)

I found that the issue comes from "$this->cards->createCards( $cards, 'deck' );"

I followed hearts tutorial to set up the code and adapt it to my needs.

I tried to check database creation logs, but i couldn't find '/admin/studio' to check that out.

In PhpMyAdmin there are14 different databases created (I don't know if it's a normal behavior) but none of them contains the correct table "weapon_card".

I probably need a better understanding of databases but for now i can't find anything to solve my issue ! please help ! :D

Game name : Bossquest

In bossquest.game.php :

function construct

Code: Select all

        $this->cards = self::getNew("module.common.deck");
        $this->cards->init("weapon_card");
function setupNewGame

Code: Select all

        $cards = array();
        foreach($this->colors as $color_id => $color)
        {
            // red yellow green blue purple
            for($value = 1; $value <= 7; $value++ ){
                $cards [] = array ('type' => $color_id, 'type_arg' => $value, 'nbr' => 1);
            }  
        }
        $this->cards->createCards( $cards, 'deck' ); // the error comes from this line
in dbmodel.sql :

Code: Select all

CREATE TABLE IF NOT EXISTS `weapon_card`(
 `wcard_id` int(10) NOT NULL  AUTO_INCREMENT,
 `wcard_type` varchar(16) NOT NULL,
 `wcard_type_arg` int(11) NOT NULL,
 `wcard_location` varchar(16) NOT NULL,
 `wcard_location_arg` int(11) NOT NULL,

PRIMARY KEY (`wcard_id`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
In material.inc.php :

Code: Select all

 $this->colors = array(
   1 => array('name' => clienttranslate('red'),
              'nametr' => self::_('red')),         
   2 => array('name' => clienttranslate('yellow'),
   'nametr' => self::_('yellow')),
   3 => array('name' => clienttranslate('blue'),
              'nametr' => self::_('blue')),         
   4 => array('name' => clienttranslate('green'),
   'nametr' => self::_('green')),
   5 => array('name' => clienttranslate('purple'),
              'nametr' => self::_('purple'))
 );

Re: Issue creating deck of cards

Posted: 09 April 2021, 10:57
by thoun
Have you tried to remove "w" from your DB column names ? Deck component is searching for card_id and probably don't find it because of this prefix.

Re: Issue creating deck of cards

Posted: 12 April 2021, 09:35
by Ottoreg
Yep it worked. Thanks thoun !