The _Main.cfg What exactly is happening?

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
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

The _Main.cfg What exactly is happening?

Post by The_Gnat »

Hello. I have determined after my long struggle with the unit database that fundamentally i have been loading my units incorrectly in the main.cfg file. So i was wondering if any dev's would be willing to point out my mistake. (it must be obvious because it is so huge an error that stops every single unit from loading in the unit database)

Here is my main.cfg file. My main questions are:

- If i put the [+units] only outside the #ifdef MULTIPLAYER is that good
- Do i need my /eras folder to be outside the #ifdef MULTIPLAYER
- My era file loads my factons (with the code in the spoiler below) is that sufficient or should i load the factions in the main.cfg file
Spoiler:
- Will the stuff inside the [+unit] effectively load all my units?
- Do i even need the [textdomain] if i have no translations?

Code: Select all

#textdomain wesnoth-ROTL

[textdomain]
    name="wesnoth-ROTL"
    path="data/add-ons/Reign_of_the_Lords/translations"
[/textdomain]

[binary_path]
    path=data/add-ons/Reign_of_the_Lords/
[/binary_path]

{~add-ons/Reign_of_the_Lords/utils/macros/}
{~add-ons/Reign_of_the_Lords/utils/}

    [+units]
	    {~add-ons/Reign_of_the_Lords/units/base_units/}
   	    {~add-ons/Reign_of_the_Lords/units/}
	    {~add-ons/Reign_of_the_Lords/units/outlaws/}
	    {~add-ons/Reign_of_the_Lords/units/undead/}
	    {~add-ons/Reign_of_the_Lords/units/orcs/}
	    {~add-ons/Reign_of_the_Lords/units/loyalists/}
	    {~add-ons/Reign_of_the_Lords/units/magi/}
	    {~add-ons/Reign_of_the_Lords/units/dwarves/}
	    {~add-ons/Reign_of_the_Lords/units/trolls/}
	    {~add-ons/Reign_of_the_Lords/units/elementals/}
	    {~add-ons/Reign_of_the_Lords/units/elves/}
	    {~add-ons/Reign_of_the_Lords/units/fake/}
   	    {~add-ons/Reign_of_the_Lords/units/other/}
    [/units]


#ifdef MULTIPLAYER
    [+units]
	    {~add-ons/Reign_of_the_Lords/units/base_units/}
   	    {~add-ons/Reign_of_the_Lords/units/}
	    {~add-ons/Reign_of_the_Lords/units/outlaws/}
	    {~add-ons/Reign_of_the_Lords/units/undead/}
	    {~add-ons/Reign_of_the_Lords/units/orcs/}
	    {~add-ons/Reign_of_the_Lords/units/loyalists/}
	    {~add-ons/Reign_of_the_Lords/units/magi/}
	    {~add-ons/Reign_of_the_Lords/units/dwarves/}
	    {~add-ons/Reign_of_the_Lords/units/trolls/}
	    {~add-ons/Reign_of_the_Lords/units/elementals/}
	    {~add-ons/Reign_of_the_Lords/units/elves/}
	    {~add-ons/Reign_of_the_Lords/units/fake/}
   	    {~add-ons/Reign_of_the_Lords/units/other/}
    [/units]

    {~add-ons/Reign_of_the_Lords/eras/}

    [modification]
	id=ROLAdvancement_Modification
	name=_"Reign of the Lords Advancement Modification"
	require_modification=yes
	{MODIFICATION_STRING}
	description=_"This Modification allows the base wesnoth units to advance into the new added units from the Reign of The Lords era. This modification is recommended when playing the Reign of the Lords era, but also works for any other era with mainline units. This modification does not effect singleplayer in any way." 
	{ROL_ADVANCEMENT_EVENTS}
    [/modification]
#endif
I appreciate any comments and i hope to fix this! Thank you!
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: The _Main.cfg What exactly is happening?

Post by Pentarctagon »

Moved to WML Workshop.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: The _Main.cfg What exactly is happening?

Post by gfgtdf »

why do you want to put anything outside of your #ifdef MULTIPLAYER .... #endif block in the first place?
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
Lord-Knightmare
Discord Moderator
Posts: 2340
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: The _Main.cfg What exactly is happening?

Post by Lord-Knightmare »

Code: Select all

#textdomain wesnoth-ROTL

[textdomain]
    name="wesnoth-ROTL"
    path="data/add-ons/Reign_of_the_Lords/translations"
[/textdomain]

#ifdef MULTIPLAYER
[binary_path]
    path=data/add-ons/Reign_of_the_Lords/
[/binary_path]

{~add-ons/Reign_of_the_Lords/utils/macros/}
{~add-ons/Reign_of_the_Lords/utils/}

    [+units]
       {~add-ons/Reign_of_the_Lords/units/base_units/}
          {~add-ons/Reign_of_the_Lords/units/}
       {~add-ons/Reign_of_the_Lords/units/outlaws/}
       {~add-ons/Reign_of_the_Lords/units/undead/}
       {~add-ons/Reign_of_the_Lords/units/orcs/}
       {~add-ons/Reign_of_the_Lords/units/loyalists/}
       {~add-ons/Reign_of_the_Lords/units/magi/}
       {~add-ons/Reign_of_the_Lords/units/dwarves/}
       {~add-ons/Reign_of_the_Lords/units/trolls/}
       {~add-ons/Reign_of_the_Lords/units/elementals/}
       {~add-ons/Reign_of_the_Lords/units/elves/}
       {~add-ons/Reign_of_the_Lords/units/fake/}
          {~add-ons/Reign_of_the_Lords/units/other/}
    [/units]

    {~add-ons/Reign_of_the_Lords/eras/}

    [modification]
   id=ROLAdvancement_Modification
   name=_"Reign of the Lords Advancement Modification"
   require_modification=yes
   {MODIFICATION_STRING}
   description=_"This Modification allows the base wesnoth units to advance into the new added units from the Reign of The Lords era. This modification is recommended when playing the Reign of the Lords era, but also works for any other era with mainline units. This modification does not effect singleplayer in any way." 
   {ROL_ADVANCEMENT_EVENTS}
    [/modification]
#endif
Here's your fix.

Including the unit directories outside the #ifdef and #endif will cause it "pollute" mainline. Many players won't like it. So, just don't do that...
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: The _Main.cfg What exactly is happening?

Post by The_Gnat »

Thank you Lord-Knightmare! I will do that.

The only problem i have is that i want to also be able to use my units in campaigns if the add-on 5 Lords Default Advancement is installed.

What could i add to the other add-on's _main.cfg file (the 5 Lords Default Advancement add-on) in order to load the units in singleplayer - from it.

Should that be done by adding in the 5 Lords Default Advancement _main.cfg file this:

Code: Select all

[binary_path]
    path=data/add-ons/Reign_of_the_Lords/
[/binary_path]

{~add-ons/Reign_of_the_Lords/utils/macros/}
{~add-ons/Reign_of_the_Lords/utils/}

    [+units]
       {~add-ons/Reign_of_the_Lords/units/base_units/}
          {~add-ons/Reign_of_the_Lords/units/}
       {~add-ons/Reign_of_the_Lords/units/outlaws/}
       {~add-ons/Reign_of_the_Lords/units/undead/}
       {~add-ons/Reign_of_the_Lords/units/orcs/}
       {~add-ons/Reign_of_the_Lords/units/loyalists/}
       {~add-ons/Reign_of_the_Lords/units/magi/}
       {~add-ons/Reign_of_the_Lords/units/dwarves/}
       {~add-ons/Reign_of_the_Lords/units/trolls/}
       {~add-ons/Reign_of_the_Lords/units/elementals/}
       {~add-ons/Reign_of_the_Lords/units/elves/}
       {~add-ons/Reign_of_the_Lords/units/fake/}
          {~add-ons/Reign_of_the_Lords/units/other/}
    [/units]
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: The _Main.cfg What exactly is happening?

Post by Pentarctagon »

Would #ifhave work?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: The _Main.cfg What exactly is happening?

Post by The_Gnat »

Yes i know about #ifhave however gfgtdf and lord-knightmare suggested that i put all the things inside the #ifdef MULTIPLAYER and so i was wondering what effects it will have if it is outside?

Thank you! :D
Last edited by The_Gnat on May 20th, 2017, 1:24 am, edited 1 time in total.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2340
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: The _Main.cfg What exactly is happening?

Post by Lord-Knightmare »

The only problem i have is that i want to also be able to use my units in campaigns if the add-on 5 Lords Default Advancement is installed.
:lol: :lol: :lol:
You remind of myself when I joined in 2010. I actually did this on the first version of GLE. Do you know what happened? Zookeeper removed it from the add-on server. Twice. He had good reason too. My add-on was causing OOS errors to any one who had it installed. That's why I mentioned to avoid doing that.

However, if you want... You can do this to your _main.cfg.

Code: Select all

#textdomain wesnoth-ROTL

[textdomain]
    name="wesnoth-ROTL"
    path="data/add-ons/Reign_of_the_Lords/translations"
[/textdomain]

#ifdef MULTIPLAYER
[binary_path]
    path=data/add-ons/Reign_of_the_Lords/
[/binary_path]

{~add-ons/Reign_of_the_Lords/utils/macros/}
{~add-ons/Reign_of_the_Lords/utils/}

    [+units]
       {~add-ons/Reign_of_the_Lords/units/base_units/}
          {~add-ons/Reign_of_the_Lords/units/}
       {~add-ons/Reign_of_the_Lords/units/outlaws/}
       {~add-ons/Reign_of_the_Lords/units/undead/}
       {~add-ons/Reign_of_the_Lords/units/orcs/}
       {~add-ons/Reign_of_the_Lords/units/loyalists/}
       {~add-ons/Reign_of_the_Lords/units/magi/}
       {~add-ons/Reign_of_the_Lords/units/dwarves/}
       {~add-ons/Reign_of_the_Lords/units/trolls/}
       {~add-ons/Reign_of_the_Lords/units/elementals/}
       {~add-ons/Reign_of_the_Lords/units/elves/}
       {~add-ons/Reign_of_the_Lords/units/fake/}
          {~add-ons/Reign_of_the_Lords/units/other/}
    [/units]

    {~add-ons/Reign_of_the_Lords/eras/}

    [modification]
   id=ROLAdvancement_Modification
   name=_"Reign of the Lords Advancement Modification"
   require_modification=yes
   {MODIFICATION_STRING}
   description=_"This Modification allows the base wesnoth units to advance into the new added units from the Reign of The Lords era. This modification is recommended when playing the Reign of the Lords era, but also works for any other era with mainline units. This modification does not effect singleplayer in any way." 
   {ROL_ADVANCEMENT_EVENTS}
    [/modification]
#endif

#ifdef ROTLAM_UNITS_CAMPAIGN
[binary_path]
    path=data/add-ons/Reign_of_the_Lords/
[/binary_path]

{~add-ons/Reign_of_the_Lords/utils/macros/}
{~add-ons/Reign_of_the_Lords/utils/}

    [+units]
       {~add-ons/Reign_of_the_Lords/units/base_units/}
          {~add-ons/Reign_of_the_Lords/units/}
       {~add-ons/Reign_of_the_Lords/units/outlaws/}
       {~add-ons/Reign_of_the_Lords/units/undead/}
       {~add-ons/Reign_of_the_Lords/units/orcs/}
       {~add-ons/Reign_of_the_Lords/units/loyalists/}
       {~add-ons/Reign_of_the_Lords/units/magi/}
       {~add-ons/Reign_of_the_Lords/units/dwarves/}
       {~add-ons/Reign_of_the_Lords/units/trolls/}
       {~add-ons/Reign_of_the_Lords/units/elementals/}
       {~add-ons/Reign_of_the_Lords/units/elves/}
       {~add-ons/Reign_of_the_Lords/units/fake/}
          {~add-ons/Reign_of_the_Lords/units/other/}
    [/units]
#endif

So, any UMC author who mentions ROTLAM_UNITS_CAMPAIGN inside their campaign's primary #define will be able to access your add-on's units.

Here's an example to clarify:

Code: Select all

[campaign]
	id=FORWARD_THEY_CRIED
	name= _ "Forward They Cried"
	abbrev="FTC"
	icon="units/human-loyalists/lieutenant.png~RC(magenta>red)"
	image="portraits/humans/transparent/lieutenant.png~SCALE(300,300)"
	define=FORWARD_THEY_CRIED
	description= _ "You are the leader of an advanced detachment that has been tasked with capturing a bridgehead while the main army prepares to attack. It should be a simple enough assignment."+ _ "
(Novice Level, 1 scenario.)"

	first_scenario="Forward"
[/campaign]

#ifdef FORWARD_THEY_CRIED

{ROTLAM_UNITS_CAMPAIGN}

{~add-ons/Forward_They_Cried/scenarios/}

#endif

This will allow the scenario to support your add-on's units. The only limitations of this is that to get them in mainline as well, you have to hack the _main.cfg for every campaign.

If you wanna be dirty.. you can include them outside the #ifdef MULTIPLAYER, and get your desired result....but your add-on's gonna get removed... #BeenThereDoneThat
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: The _Main.cfg What exactly is happening?

Post by The_Gnat »

Thank you! :D I will add that code to my _main.cfg file so that campaigns can use my units. But i will also put a #ifhave condition so that if players want they can override campaigns and force units to load by downloading the 5 Lords Default Unit Advancement add-on.

(As a mater of fact zookeeper must not be so active now-adays, my add-on (now with over 2000 downloads) has been dirtily loading all the units for every campaign for almost a year) :lol:
Post Reply