Idea: Add configuration option to Add-ons

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Idea: Add configuration option to Add-ons

Post by tekelili »

I know is quite late for 1.12 but just suggexting it as feature for 1.13

To allow user different grades of compatibility for different playing proposes, I am including a config.cfg file with macros defined as "no". User can define any them as yes editing file. My add-on uses #ifver to handle user configuration.

Would be nice if in the "Add-ons" option in main screen, were added a "configure add-ons" option that could define macros (as [multiplayer] defines #MULTIPLAYER) and handle them with #ifdef.

That way Add-ons could be configured without user havind to find Add-ons folder and editing files. :)
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Idea: Add configuration option to Add-ons

Post by gfgtdf »

in mp (in eras, scenarios and modifications ) it is possible to have [option]s that can be adjusted at the start of a game. And there is a plan to enable the same in SP as part of the "unify SP and MP" project if i am correct.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: Idea: Add configuration option to Add-ons

Post by tekelili »

I tried use [modification] for my proposes, but after read it in wiki, I becomed to think it can not serve. As example, one of my configurable options enable or disables translation.

#ifver then load different files with different definition for same string macros and then they are used in my custom era (as era.name). I dont see how do that with a [modification] :|

Edit: Just in case I am wrong, here is my _main.cfg

Code: Select all

# MP Campaign

{~add-ons/World_Conquest_II/config.cfg}

#ifver WC_II_TRANSLATED == yes
    [textdomain]
        name="wesnoth-World_Conquest_II"
        path=data/add-ons/World_Conquest_II/translations
    [/textdomain]
#endif

#ifdef MULTIPLAYER
    [binary_path]
        path=data/add-ons/World_Conquest_II
    [/binary_path]
    {~add-ons/World_Conquest_II/utils/strings}
    {~add-ons/World_Conquest_II/utils/era}
#ifver WC_II_CUSTOM_TERRAIN == yes
    {~add-ons/World_Conquest_II/terrain-graphics}
#endif
    {~add-ons/World_Conquest_II/utils/era/factions}
    {~add-ons/World_Conquest_II/utils}
    {~add-ons/World_Conquest_II/utils/maps}
    {~add-ons/World_Conquest_II/scenarios/3p}
    {~add-ons/World_Conquest_II/scenarios/2p}
    {~add-ons/World_Conquest_II/scenarios/1p}

    [era]
        id= {STR_ERA_ID_WC_II}
        name= {STR_ERA_NAME_WC_II}
        require_era={WC_II_CUSTOM_TERRAIN}
        description={STR_ERA_DESCRIPTION_WC_II}
        allow_scenario={STR_SCENARIO_CAMPAIGN_ID 3},{STR_SCENARIO_CAMPAIGN_ID 2},{STR_SCENARIO_CAMPAIGN_ID 1}

        {MULTIPLAYER_SIDE_RANDOM_WC_II}
        {MULTIPLAYER_SIDE_THE_HORDE}
        {MULTIPLAYER_SIDE_THE_ALLIANCE}
        {MULTIPLAYER_SIDE_THE_GUILD}
        {MULTIPLAYER_SIDE_THE_TRUST}
        {MULTIPLAYER_SIDE_THE_GANG}
        {MULTIPLAYER_SIDE_THE_CULT}
        {MULTIPLAYER_SIDE_THE_MILITIA}
        {MULTIPLAYER_SIDE_THE_SCOURGE}
        {MULTIPLAYER_SIDE_THE_HAND}

        # events fixed for WC, defined for players 1,2,3
        {WORLD_CONQUEST_II_ERA_CREATE_RANDOM_LIST_EVENT}
        {WORLD_CONQUEST_II_ERA_MODIFY_RECRUITING_EVENT}
    [/era]
#endif
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Idea: Add configuration option to Add-ons

Post by gfgtdf »

as somone who uses lua for nearly everything in add-ons i don't have this problem for my strings. But yes that seems not to be possible with [option].

If you want more controll over wml you might want to try the new (1.13) "core modification" feature, i dont exactly know how to uses but it looks liek it can give you what you want.

Is there a special reason why do you want to disable translation and see the the "female^quick" and similar string ?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: Idea: Add configuration option to Add-ons

Post by tekelili »

gfgtdf wrote: Is there a special reason why do you want to disable translation and see the the "female^quick" and similar string ?
Im not disabling wesnoth usual translations, just translations over strings defined by me that becomed stored in variables. In mp server, after save/reload game those strings are translatated to host language settings, wich can be worse for other players than just English untranslated.

When I disable translations, I define some strings macros in different way to avoid the ugly "femmale^" 8)
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Idea: Add configuration option to Add-ons

Post by gfgtdf »

so if one stores translated strings in a variable and unstoes then after a reload in another language they are still translated in the original language? That sounds like a wesnoth bug to me.

And this happens only in mp?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
tekelili
Posts: 1039
Joined: August 19th, 2009, 9:28 pm

Re: Idea: Add configuration option to Add-ons

Post by tekelili »

gfgtdf wrote:so if one stores translated strings in a variable and unstoes then after a reload in another language they are still translated in the original language? That sounds like a wesnoth bug to me.

And this happens only in mp?
It also sound as a bug to me. To reproduce it, just define [objectives] wtih a translatable unit name string inside and define apropiate textdomain. After save reload you can check that string wont change in ojectives display even if you change your language settings.

I guess it also happens in sp, or multiplayer hot seat, but should be very rare that users even notice it in such enverioments.
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Idea: Add configuration option to Add-ons

Post by iceiceice »

gfgtdf wrote:That sounds like a wesnoth bug to me.
tekelili wrote:It also sound as a bug to me.
It sounds like this bug to me. :hmm:

Coincidence, I think not!
Post Reply