Page 1 of 1

Game options

Posted: 26 September 2013, 21:41
by emanueles
Hello everybody,
I want to add an option to my game.

I modified the gameoptions.inc.php file in adding these lines:

Code: Select all

$game_options = array(

	100 => array(
		'name' => totranslate('Number of decks'),
		'values' => array(
			1 => array( 'name' => totranslate('2') ),
			2 => array( 'name' => totranslate('3') ),
			3 => array( 'name' => totranslate('4') ),
			4 => array( 'name' => totranslate('5') )
		)
	)

);
Then I modified the game.php file adding these lines to the function MyGameName():

Code: Select all

self::initGameStateLabels( array( 
		"decks_no" => 100
        ) );
and this line to the function setupNewGame():

Code: Select all

$decks_no = self::getGameStateValue( 'decks_no' ) + 1;
But it doesn't work. I don't see the option when creating a new game and there's an error in database creation.

Can anyone help me?

Re: Game options

Posted: 28 September 2013, 22:11
by sourisdudesert
Hello,

Did you use the "Reload game options configuration" button from "Control Panel"/"Manage Games" ?

If not, this could be the reason.

Cheers,

Re: Game options

Posted: 29 September 2013, 21:15
by emanueles
Yes, it was the reason.
Thank you very much!

Re: Game options

Posted: 03 October 2013, 21:38
by emanueles
Another question about game options: how can I set the default value for a game option?

Re: Game options

Posted: 03 October 2013, 21:47
by sourisdudesert
Hello,

The default option is always the first one.

Note that the default option is the first one in the array, not the option with the lowest number.

Cheers,