[SOLVED] Option only usable when Elo is off

Game development with Board Game Arena Studio
User avatar
Een
Posts: 1973
Joined: 16 June 2010, 19:52

Re: Option only usable when Elo is off

Postby Een » 17 May 2018, 17:10

Victoria_La wrote:Did not work like that. Anything else is missing?

Code: Select all

        100 => array(
                'name' => totranslate('Learning Game (No Research)'),
                'values' => array(
                       
                        1 => array( 'name' => totranslate('Off'), 'tmdisplay' => totranslate('') ),
                        2 => array( 'name' => totranslate('On'), 'tmdisplay' => totranslate('Learning Game') ),
                       
                ),
                'displaycondition' => array(
                        // Note: user cannot use this option unless these conditions are met
                        array( 'type' => 'otheroption',
                                'id' => 201, // ELO OFF hardcoded framework option
                                'value' => 1, // 1 if OFF
                                'notdisplayedmessage' => totranslate('Learning variant available only with ELO off')
                        )
                ),
                ),


You have to put it at the same level as 'displaycondition', it's a propriety for the option, not a propriety for the condition (sorry I should have provided an example).

User avatar
Tchebychev
Posts: 127
Joined: 08 March 2014, 00:53

Re: Option only usable when Elo is off

Postby Tchebychev » 17 May 2018, 17:59

Hi Een,

Thanks for this update but I can't use it in my situation, since the "Friendly game" is just a single entry inside "Game length" (see my first message in this thread). I would not like to change this because it is pretty straightforward.

Nevertheless, I tried to separate and put that in another drop-down list, but it's pretty clumsy because if this "Friendly game" option is on, "Game length" is then irrelevant (since the point of the Friendly mode is to stop when somebody wants). I tried to add another display condition on that second option but I'm not satisfied of the result: the user would be lost among the possibilities.

Could you just extend the possibilities of the 'startcondition', beyond the condition on the number of players, so that it accepts Elo off as a valid condition? This would enable to spot a single entry instead of the whole drop-down list.

If you are willing to do that, I think I won't change the options structure for the moment and just wait until this update is available.

Thanks a lot :)

See you,

Tcheby

User avatar
Een
Posts: 1973
Joined: 16 June 2010, 19:52

Re: Option only usable when Elo is off

Postby Een » 18 May 2018, 16:52

Tchebychev wrote:Could you just extend the possibilities of the 'startcondition', beyond the condition on the number of players, so that it accepts Elo off as a valid condition? This would enable to spot a single entry instead of the whole drop-down list.


Ok, done. You can use:

Code: Select all

array( 'type' => 'otheroption', 'id' => 201, 'value' => 0, 'message' => totranslate( 'This option is not available with ELO on' ) )


or

Code: Select all

array( 'type' => 'otheroptionisnot', 'id' => 201, 'value' => 1, 'message' => totranslate( 'This option is only available with ELO off' ) )


Hope this fits :)

User avatar
Tchebychev
Posts: 127
Joined: 08 March 2014, 00:53

Re: Option only usable when Elo is off

Postby Tchebychev » 21 May 2018, 20:03

Thanks a lot Een!

This works perfectly right. Here is my final complete configuration if one needs a full example:

Code: Select all

$game_options = array(
    100 => array(
        'name' => totranslate('Game length'),
        'values' => array(
            8 => array('name' => totranslate('8 hands'), 'tmdisplay' => totranslate('8 hands')),
            1 => array('name' => totranslate('1 single hand'), 'tmdisplay' => totranslate('1 single hand')),
            4 => array('name' => totranslate('4 hands'), 'tmdisplay' => totranslate('4 hands')),
            12 => array('name' => totranslate('12 hands'), 'tmdisplay' => totranslate('12 hands')),
            16 => array('name' => totranslate('16 hands'), 'tmdisplay' => totranslate('16 hands')),
            20 => array('name' => totranslate('20 hands'), 'tmdisplay' => totranslate('20 hands')),
            99 => array('name' => totranslate('Friendly mode: as long as everybody wants'), 'tmdisplay' => totranslate('Friendly game: the game lasts as long as everybody wants'))
        ),
         'startcondition' => array(
             1 => array(), // No specific condition here
             4 => array(),
             8 => array(),
             12 => array(),
             16 => array(),
             20 => array(),
             99 => array(
                 array(
                     'type' => 'otheroption',
                     'id' => 201,
                     'value' => 0,
                     'message' => totranslate('ELO off is required to play in friendly mode')
                 )
             )
         )
    )
)


I have updated the related wiki too: http://en.doc.boardgamearena.com/Game_options_and_preferences:_gameoptions.inc.php

Thanks again :)

Tcheby


Return to “Developers”

Who is online

Users browsing this forum: No registered users and 2 guests