SOLVED - Error: Table doesn't exist (newbie here!)

Game development with Board Game Arena Studio
Post Reply
User avatar
arbocenc
Posts: 13
Joined: 11 June 2024, 11:30

SOLVED - Error: Table doesn't exist (newbie here!)

Post by arbocenc »

Hi,

I got this error:
Unexpected error: Propagating error from gameserver 1 (method: createGame): Fatal error during dinkydungeon setup: Error while processing SQL request (mysql via TCP/IP): SELECT MAX( card_location_arg ) res FROM dungeon WHERE card_location='deck' Table 'ebd_dinkydungeon_634364.dungeon' doesn't exist (reference: GS1 16/10 23:38:58) (reference: GS0 16/10 23:38:58
But in my dbmodel.sql it is:

Code: Select all

CREATE TABLE IF NOT EXISTS `dungeon` (
   `card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `card_type` varchar(16) NOT NULL,
   `card_type_arg` int(11) NOT NULL,
   `card_location` varchar(16) NOT NULL,
   `card_location_arg` int(11) NOT NULL,
   PRIMARY KEY (`card_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
Then, at dinkydungeon.game.php it is:

Code: Select all


class DinkyDungeon extends Table
{
	function __construct( )
	{

	    $this->dungeons = self::getNew( "module.common.deck" );
	    $this->dungeons->init( "dungeon" );   
        
	    $this->adventurers = self::getNew( "module.common.deck" );
	    $this->adventurers->init( "adventurer" );    

...

    protected function setupNewGame( $players, $options = array() )
    {    
    
   ...
   
           $this->monster_levels = [
            1 => 20,
            2 => 10,
            3 => 4,
            4 => 2,            
        ];

        $dungeons = array();
        foreach( $this->monster_levels as $level => $amount )
        {
            for( $i = 0; $i < $amount; $i++ ){
                $dungeons[] = array ('type' => $level,'nbr' => 1 );
            }
         }

        $this->dungeons->createCards( $dungeons , 'deck');

...
   
I'm newbie here! Any suggestion/idea? Thanks in advance!
Last edited by arbocenc on 17 October 2024, 16:55, edited 1 time in total.
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: Error: Table doesn't exist (newbie here!)

Post by thoun »

Is the sql file correctly uploaded to your FTP folder ?
You can also try to comment the game.php part so it can start, check the DBD with the phpMyAdmin button, and investigate from here.
User avatar
arbocenc
Posts: 13
Joined: 11 June 2024, 11:30

Re: Error: Table doesn't exist (newbie here!)

Post by arbocenc »

Hi @thoun,

I'm going to check your message advices right now but first some more info.

I get out of the error if I use this test code:

Code: Select all

	    //$this->dungeons = self::getNew( "module.common.deck" );
	    //$this->dungeons->init( "dungeon" );   
        $this->cards = self::getNew( "module.common.deck" );
	    $this->cards->init( "card" ); 
	    
	    ...
	    
	    //Test Joan
$cards = array();
$cards[] = array ('type' => '1','type_arg' => 1,'nbr' => 1 );
$this->cards->createCards( $cards , 'deck');
I've created a third table, just for testing:

Code: Select all

-- Test Joan
CREATE TABLE IF NOT EXISTS `card` (
   `card_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
   `card_type` varchar(16) NOT NULL,
   `card_type_arg` int(11) NOT NULL,
   `card_location` varchar(16) NOT NULL,
   `card_location_arg` int(11) NOT NULL,
   PRIMARY KEY (`card_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
I wonder if

Code: Select all

'type_arg' => 1
is mandatory... I'm going to test it...
User avatar
arbocenc
Posts: 13
Joined: 11 June 2024, 11:30

Re: Error: Table doesn't exist (newbie here!)

Post by arbocenc »

thoun wrote: 17 October 2024, 14:58 Is the sql file correctly uploaded to your FTP folder ?
It is
You can also try to comment the game.php part so it can start, check the DBD with the phpMyAdmin button, and investigate from here.
Yes, if I comment it or I made the test changes I've just written, the game starts...

Could you tell me where is the phpMyAdmin button?? I'm looking for it but I can't see it!
User avatar
arbocenc
Posts: 13
Joined: 11 June 2024, 11:30

Re: Error: Table doesn't exist (newbie here!)

Post by arbocenc »

arbocenc wrote: 17 October 2024, 15:09
I wonder if

Code: Select all

'type_arg' => 1
is mandatory... I'm going to test it...
type_arg is mandatory, if I supress it I get:
Unexpected error: Wrong formatted data from gameserver 1 (method: createGame): JSON_ERROR_SYNTAX
Warning: Undefined array key "type_arg" in /var/tournoi/release/tournoi-241017-1517-gs/www/game/module/common/deck.game.php on line 63
{"status":1,"data":true} (reference: GS0 17/10 16:19:30)
But I suppose my issue is not related with it...

By the way, where can I have the BGA core code to check class definitions, etc? For example the Desk module, Table class...
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: Error: Table doesn't exist (newbie here!)

Post by thoun »

The first button here : https://imgur.com/a/fMGMtOt

(don't hesitate to join the Dev Discord for more efficient help from the community)
User avatar
arbocenc
Posts: 13
Joined: 11 June 2024, 11:30

Re: Error: Table doesn't exist (newbie here!)

Post by arbocenc »

Thank you!

I've found the reason, type_arg is mandatory

I wonder if I can edit the wiki to notice it: https://en.doc.boardgamearena.com/Deck

Another wiki possible change. Now wiki uses:

Code: Select all

        $this->cards = $this->getNew( "module.common.deck" );
But Hearts source code uses:

Code: Select all

        $this->cards = self::getNew( "module.common.deck" );
I wonder if these 2 options are the same or one is better than the other.
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: SOLVED - Error: Table doesn't exist (newbie here!)

Post by thoun »

Anyone can edit the wiki.
Prefer $this->, as self:: has no real sense here even if it works.
Post Reply

Return to “Developers”