Problem with my addon's _main.cfg

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
Flameslash
Posts: 633
Joined: December 21st, 2008, 12:29 pm

Problem with my addon's _main.cfg

Post by Flameslash » April 6th, 2018, 1:43 pm

Okay, so I've been stumped by this for ages now. I've compared my campaign's _main.cfg to other campaigns, from mainline and addons, and I just can't work out what the problem is.

When I use this code:

Code: Select all

#ifdef CAMPAIGN_TALE_OF_THE_DUNES

	{~add-ons/Tale_of_the_Dunes/scenarios}
	{~add-ons/Tale_of_the_Dunes/maps
	
	[+units]
		{~add-ons/Tale_of_the_Dunes/units}
	[/units]
	
#endif
I get an error about an unexpected endif.

However, if I don't include the #endif, I get an error about a missing endif. I simply can't work it out. I would be very grateful if someone could pount out to me where I'm going wrong.
Last edited by Ravana on April 6th, 2018, 2:36 pm, edited 1 time in total.
Reason: Use [code] BBCode tags in your posts for embedding WML snippets.

User avatar
shadowm
Site Administrator
Posts: 6486
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: Problem with my addon's _main.cfg

Post by shadowm » April 6th, 2018, 5:18 pm

You might have an unterminated preprocessor block (#ifdef, #define, most likely the latter) in one of the files in the paths you’re including there.

Or even in your _main.cfg, really, since we can’t see the rest of the contents of it.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
Elsewhere: shadowmBlogFollow me on Twitter

Wussel
Posts: 592
Joined: July 28th, 2012, 5:58 am

Re: Problem with my addon's _main.cfg

Post by Wussel » April 6th, 2018, 6:04 pm

The information about the problem file is good. Then you have to look for the first line number in the error code. There will be you mistake to fix. The rest is rubbish. You might get a new error code again. Continue this process until it works.

User avatar
Flameslash
Posts: 633
Joined: December 21st, 2008, 12:29 pm

Re: Problem with my addon's _main.cfg

Post by Flameslash » April 6th, 2018, 6:56 pm

Actually, it's a lot simpler than that. I forgot to close a bracket "{~add-ons/Tale_of_the_Dunes/maps" which is kind of embarrassing. Doing that fixed it.

But now the graphics of the "custom" units (I copied over the Nagas from UtBS, basically) won't show up, even though I've included them in the folder. I honestly can't figure out where the problem is, so if anyone wants to take a look, I've included a .zip fo the lot.

Basically, the images are in the folder Tale_of_the_Dunes/images/units/nagas/. The units' .cfgs have lines like "image="units/nagas/warden.png"". But the units just show up as invisible.
Attachments
Tale_of_the_Dunes.zip
(73.33 KiB) Downloaded 30 times

User avatar
zookeeper
WML Wizard
Posts: 9739
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Problem with my addon's _main.cfg

Post by zookeeper » April 6th, 2018, 7:16 pm

Look at the way every campaign with custom images uses a [binary_path]. That's what lets your custom images be found, nothing else.

User avatar
Flameslash
Posts: 633
Joined: December 21st, 2008, 12:29 pm

Re: Problem with my addon's _main.cfg

Post by Flameslash » April 6th, 2018, 7:27 pm

You're absolutely right about needing a [binary_path]. I had one at one point, but ended up getting rid of it when fiddling about trying to get rid of the earlier error. However, adding it back in doesn't seem to fix the error, unfortunately.

I've included how I've added the binary path, just in case I'm missing something obvious like I often do.

Code: Select all

#ifdef CAMPAIGN_TALE_OF_THE_DUNES

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

	{~add-ons/Tale_of_the_Dunes/scenarios}
	{~add-ons/Tale_of_the_Dunes/maps}
	{~add-ons/Tale_of_the_Dunes/images/units/nagas} 
	
	[+units]
		{~add-ons/Tale_of_the_Dunes/units/nagas}
	[/units]
	
#endif
Note - I don't think "{~add-ons/Tale_of_the_Dunes/images/units/nagas}" needs to be there or does anything, but I included it just to try it.

Wussel
Posts: 592
Joined: July 28th, 2012, 5:58 am

Re: Problem with my addon's _main.cfg

Post by Wussel » April 7th, 2018, 9:38 am

If art does not show, it sometimes is not in the right folder or is wrongly spelled. Big and small letter matter here too.

For this there will be no error code.

Of course there might be an issue with your path. For this you have to copy the code of a working campaign faithfully.

User avatar
Pentarctagon
Forum Administrator
Posts: 3543
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Problem with my addon's _main.cfg

Post by Pentarctagon » April 7th, 2018, 4:01 pm

With adding the [binary_path], the naga images do show up(spawned a couple from debug mode):

Code: Select all

#textdomain wesnoth-totd
[textdomain]
    name="wesnoth-totd"
[/textdomain]
	
[campaign]
	#textdomain wesnoth-totd
	id=Tale of the Dunes
	name= _ "Tale of the Dunes"
	abbrev= _ "TotD"
	define=CAMPAIGN_TALE_OF_THE_DUNES
	
	id=Tale_of_the_Dunes
    rank=230
    name= _ "Tale of the Dunes"
    icon=
    image=
    abbrev= _ "TotD"
    first_scenario=01_Strangers_in_the_North
	
	{CAMPAIGN_DIFFICULTY EASY   "" ( _ "Fighter") ( _ "Easy")}
    {CAMPAIGN_DIFFICULTY NORMAL "" ( _ "Commander") ( _ "Normal")} {DEFAULT_DIFFICULTY}
    {CAMPAIGN_DIFFICULTY HARD   "" ( _ "Lord") ( _ "Challenging")}
	
	description= _ "Test"
[/campaign]

#ifdef CAMPAIGN_TALE_OF_THE_DUNES

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

	{~add-ons/Tale_of_the_Dunes/scenarios}
	{~add-ons/Tale_of_the_Dunes/maps}
	
	[+units]
		{~add-ons/Tale_of_the_Dunes/units/nagas}
	[/units]
	
#endif
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
Flameslash
Posts: 633
Joined: December 21st, 2008, 12:29 pm

Re: Problem with my addon's _main.cfg

Post by Flameslash » April 7th, 2018, 5:43 pm

Ah, it seems it was just the Warden which wasn't working with the binary path included - which just so happened to be the one I was spawning to check. Oops. Thank you.

Post Reply