Page 1 of 1

Accessing a module

Posted: 06 November 2020, 18:12
by tchobello
Hello, I've added a php file in modules folder and I get this message when I try to use it

Unexpected error: Wrong formatted data from BGA gameserver 1 (method: createGame): JSON_ERROR_SYNTAX
Warning: require_once(/var/www/tournoi/include/DTGamePreparation.inc.php): failed to open stream: No such file or directory in /var/tournoi/release/tournoi-201105-1746-gs/www/index.php on line 101

Fatal error: require_once(): Failed opening required '/var/www/tournoi/include/DTGamePreparation.inc.php' (include_path='.:/usr/share/php') in /var/tournoi/release/tournoi-201105-1746-gs/www/index.php on line 101

this is the beginning of the main php file

Code: Select all

require_once( APP_GAMEMODULE_PATH.'module/table/table.game.php' );
include('modules/DTGamePreparation.php');
and when i add this :

Code: Select all

    function stGamePreparation()
    {
	$gamePreparation = new DTGamePreparation($this);
        $this->gamestate->nextState( 'goforit' );
    }
I get the error message

can you help me ?

Re: Accessing a module

Posted: 06 November 2020, 18:15
by Tisaac
That's an autoloader error. It's trying to auto require the class is not declared so my guess would be that your module file has a error inside, can you share the first few line of it ?

Re: Accessing a module

Posted: 06 November 2020, 18:51
by tchobello

Code: Select all

 DTGamePreparation.php

 function __construct( $targan )
 {

 }
	
 function createMap()
 {
         $players = $this->targan->loadPlayersBasicInfos();
         ...
the main file is targan.php
I've tried without the construct, with no argument in the construct also...

OMG, I've forgotten class DTGamePreparation... I'm so blind

now, the loadPlayersBasicInfos doesn't work... hard to find some infos on how to integrate modules

Re: Accessing a module

Posted: 06 November 2020, 19:39
by Tisaac
tchobello wrote: 06 November 2020, 18:51

Code: Select all

 DTGamePreparation.php

 function __construct( $targan )
 {

 }
	
 function createMap()
 {
         $players = $this->targan->loadPlayersBasicInfos();
         ...
the main file is targan.php
I've tried without the construct, with no argument in the construct also...

OMG, I've forgotten class DTGamePreparation... I'm so blind

now, the loadPlayersBasicInfos doesn't work... hard to find some infos on how to integrate modules
That's true. You can Take a look at one of my games if you want some examples. Feel also free to join the discord server, it might be easier to help you debugging modules