Accessing a module

Game development with Board Game Arena Studio
Post Reply
User avatar
tchobello
Posts: 526
Joined: 18 March 2012, 13:19

Accessing a module

Post 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 ?
User avatar
Tisaac
Posts: 2350
Joined: 26 August 2014, 21:28

Re: Accessing a module

Post 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 ?
User avatar
tchobello
Posts: 526
Joined: 18 March 2012, 13:19

Re: Accessing a module

Post 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
User avatar
Tisaac
Posts: 2350
Joined: 26 August 2014, 21:28

Re: Accessing a module

Post 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
Post Reply

Return to “Developers”