can't get my campaign to load to the wesnoth "campaign" list

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
falcon500
Posts: 13
Joined: October 26th, 2016, 7:28 pm

can't get my campaign to load to the wesnoth "campaign" list

Post by falcon500 »

I am a beginner at this whole add-ons thing, and can't get my campaign to show up in the list of campaigns. (not the "add-ons" list)

Code: Select all

[textdomain]
    name="wesnoth-Second_Front"
    path="data/add-ons/Second_Front/translations"
[/textdomain]
   
[campaign]
     #textdomain wesnoth-Second_Front
    
     id=SECOND_FRONT
     name= _ "Second Front"
     abbrev= _ "SF"
     define=CAMPAIGN_SECOND_FRONT
   
     icon=peasant.png
     image= second_front_logo.png
     description= _ "Some text about my campaign!"
    
     difficulties=EASY,NORMAL,HARD
     difficulty_descriptions={MENU_IMG_TXT2 *&units/human-loyalists/peasant.png~TC(1,magenta) _"Civilian" _"(trivial)"} +
";" + {MENU_IMG_TXT2 units/human-loyalists/spearman.png~TC(1,magenta) _"Soldier" _"(simple)"} +
";" + {MENU_IMG_TXT2 units/human-loyalists/pikeman.png~TC(1,magenta) _"Veteran" _"(easy)"}
   
     first_scenario=raiders
    
[/campaign]
    
#ifdef CAMPAIGN_SIMPLE_CAMPAIGN
    
{~add-ons/Second_Front/scenarios}
{~add-ons/Second_Front/maps}

[+units]
    {~add-ons/Second_Front/units}
[/units]
 
#endif
That's my code.
Last edited by Pentarctagon on October 11th, 2018, 5:47 am, edited 1 time in total.
Reason: Please edit your previous post instead of multiposting.
User avatar
beetlenaut
Developer
Posts: 2812
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by beetlenaut »

falcon500 wrote: October 11th, 2018, 2:42 am can't get my campaign to show up in the list of campaigns.
There should be an error message directing you to a problem with the {MENU_IMG_TXT2} macro. Did you see that? Anyway, parentheses have a special meaning inside of macros calls, and the parentheses in your image paths are causing this error. If you put the complete image path in quotes in the macro call, that would fix it. (Get rid of the extra *& while you're at it.)

After that, you will also have a problem with mismatched defines, and an incomplete campaign image path, but you can worry about those after it shows up.

Also, are you working with BfW 1.12? That's old and not supported any more, so it's not a good idea. We are on 1.14.5 at the moment.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
ghype
Posts: 1069
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by ghype »

last night I just made my first campaign load without errors for the first time. so I know your struggle. I guess we all do.

However. I used a much simpler definition for the difficulties. This is taken out of the main.cfg from mainline campaign "Liberty". I just changed the names for the files and difficulies.

Code: Select all

    {CAMPAIGN_DIFFICULTY EASY   "units/human-peasants/peasant.png~RC(magenta>red)" ( _ "Peasant") ( _ "Easy")} {DEFAULT_DIFFICULTY}
    {CAMPAIGN_DIFFICULTY NORMAL "units/human-outlaws/outlaw.png~RC(magenta>red)" ( _ "Outlaw") ( _ "Normal")}
    {CAMPAIGN_DIFFICULTY HARD   "units/human-outlaws/fugitive.png~RC(magenta>red)" ( _ "Fugitive") ( _ "Difficult")}
User avatar
beetlenaut
Developer
Posts: 2812
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by beetlenaut »

ghype wrote: October 11th, 2018, 3:28 pm I used a much simpler definition for the difficulties.
That's one of the reasons I asked about the version. CAMPAIGN_DIFFICULTY is an easier macro, but it doesn't work in 1.12. (MENU_IMG_TXT2 works in both versions, but will be removed at some point.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
falcon500
Posts: 13
Joined: October 26th, 2016, 7:28 pm

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by falcon500 »

I have version 1.14.5
falcon500
Posts: 13
Joined: October 26th, 2016, 7:28 pm

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by falcon500 »

Thanks for your help. I did what ghype said, and the campaign still didn't show up in the list. BTW, where is the gamedata directory?
User avatar
beetlenaut
Developer
Posts: 2812
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by beetlenaut »

falcon500 wrote: October 12th, 2018, 1:30 am the campaign still didn't show up in the list.
I saved your code as _main.cfg, and put it in my add-ons folder inside a folder called Second_Front. It showed up in my campaign list as soon as I put quotes around the image path. I'm using 1.14.5 too, so it should work for you. What does your code look like now? Also tell us what files and folders you have because that might be the problem.
falcon500 wrote: October 12th, 2018, 1:30 am where is the gamedata directory?
It depends on your operating system:
http://wiki.wesnoth.org/EditingWesnoth# ... _directory
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
falcon500
Posts: 13
Joined: October 26th, 2016, 7:28 pm

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by falcon500 »

This is my current code.

Code: Select all

[textdomain]
    name="wesnoth-Second_Front"
    path="data/add-ons/Second_Front/translations"
[/textdomain]
   
[campaign]
     #textdomain wesnoth-Second_Front
    
     id=SECOND_FRONT
     name= _ "Second Front"
     abbrev= _ "SF"
     define=CAMPAIGN_SECOND_FRONT
   
     icon=peasant.png
     image= second_front_logo.png
     description= _ "Some text about my campaign!"
    
     difficulties=EASY,NORMAL,HARD
     difficulty_descriptions=
    {CAMPAIGN_DIFFICULTY EASY   "units/human-peasants/peasant.png~RC(magenta>red)" ( _ "Peasant") ( _ "Easy")} {DEFAULT_DIFFICULTY}
    {CAMPAIGN_DIFFICULTY NORMAL "units/human-loyalists/spearman.png~RC(magenta>red)" ( _ "Soldier") ( _ "Normal")}
    {CAMPAIGN_DIFFICULTY HARD   "units/human-loyalists/pikeman.png~RC(magenta>red)" ( _ "Orc hunter") ( _ "Difficult")}
   
     first_scenario=raiders
    
[/campaign]
    
#ifdef CAMPAIGN_SIMPLE_CAMPAIGN
    
{~add-ons/Second_Front/scenarios}
{~add-ons/Second_Front/maps}

[+units]
    {~add-ons/Second_Front/units}
[/units]
 
#endif
Beetlenaut, maybe you can post your code so I can use it?
User avatar
beetlenaut
Developer
Posts: 2812
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by beetlenaut »

falcon500 wrote: October 12th, 2018, 2:23 pm Beetlenaut, maybe you can post your code so I can use it?
But...my code was your code! (Just with quotation marks.) The code you just posted also works for me--exactly as it is this time. I asked about your directory structure because it seems like that must be the problem.

I made the folder userdata/data/add-ons/Second_Front. (Check the blue "i" icon at the bottom left of the BfW main screen to make sure you are using the correct userdata folder.) I made a file called _main.cfg in that folder, and copied the exact code from your last post into that file. Second Front showed up in my campaign list:
campaign_list.png
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
falcon500
Posts: 13
Joined: October 26th, 2016, 7:28 pm

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by falcon500 »

here is my path: Documents\My Games\Wesnoth1.14\data\add-ons\Second_Front This is exactly what the "i" button tells me to do.
User avatar
beetlenaut
Developer
Posts: 2812
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by beetlenaut »

falcon500 wrote: October 20th, 2018, 2:29 am here is my path: Documents\My Games\Wesnoth1.14\data\add-ons\Second_Front This is exactly what the "i" button tells me to do.
Okay, and what exactly is in that folder?
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
falcon500
Posts: 13
Joined: October 26th, 2016, 7:28 pm

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by falcon500 »

images, maps, scenarios, translations, units, and _main.cfg.
User avatar
beetlenaut
Developer
Posts: 2812
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: can't get my campaign to load to the wesnoth "campaign" list

Post by beetlenaut »

Okay, but I meant everything, and what's inside of each and the code. Could you do this? Zip up the whole Second_Front folder into a zip file and post it. Then I know we will have enough information to fix your problem.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Post Reply