Campaign Problems

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
turret544
Posts: 13
Joined: May 5th, 2007, 12:31 am

Campaign Problems

Post by turret544 »

Okay, so I've been working on a practice campaign before attempting to make a real one. I've been able to get up to the difficulty choice screen, but when I choose one, i get an error.
First off: the campaign file

Code: Select all

[campaign]
	#textdomain wesnoth-Simple_Campaign

	id=SIMPLE_CAMPAIGN
	name=_ "A Simple Campaign"
  	define=CAMPAIGN_SIMPLE_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)"}

	icon="units/human-loyalists/spearman.png~TC(1,magenta)"
	image="units/human-loyalists/speraman.png~TC(1,magenta)"
	description=_ "This is the description ahah"

	first_scenario=the_first_scenario
[/campaign]

[binary_path]
	path=data/campaigns/Simple_Campaign/external_binary_data/
[/binary_path]

#ifdef CAMPAIGN_SIMPLE_CAMPAIGN
	[binary_path]
		path=data/campaigns/Simple_Campaign
	[/binary_path]
	{@campaigns/Simple_Campaign/scenarios}
	{@campaigns/Simple_Campaign/maps}
#endif
Now here is the error i receive:
Image

It would be highly appreciated if someone could help me. Thanks
User avatar
governor
Posts: 267
Joined: December 8th, 2006, 12:32 am

Post by governor »

There is a very good possibility the problem resides in SimpleCampaign.cfg.

Please post the contents of that file.
turret544
Posts: 13
Joined: May 5th, 2007, 12:31 am

Post by turret544 »

Heh, what i posted earlier were the contents of Simple_Campaign.cfg
ILikeProgramming
Posts: 837
Joined: April 14th, 2005, 4:17 am

Post by ILikeProgramming »

You should also post the CFG file of the first scenario. These types of errors are often triggered by mistakes in the scenario.
turret544
Posts: 13
Joined: May 5th, 2007, 12:31 am

Post by turret544 »

I was aiming for a very simple scenario, just to get the campaign running. I might have made it too simple, perhaps leaving something out.

Code: Select all

[scenario]
#textdomain wesnoth-Simple_Campaign
id=the_first_scenario
next_scenario=the_second_scenario
name=The First Scenario
map_data="{campaigns/Simple_Campaign/maps/testmap1
turns=30

{DAWN}
{MORNING}
{AFTERNOON}
{DUSK}
{FIRST_WATCH}
{SECOND_WATCH}

music=wesnoth-1.ogg

[event]
name=prestart
	[objectives]
	side=1
		[objective]
			description=_ "Defeat Enemy Leader"
			condition=win
		[/objective]
		[objective]
			description=_ "Death of Maple"
			condition=lose
		[/objective]
		[objective]
			description=_ "Turns Run Out"
			condition=lose
		[/objective]
	[/objectives]
[/event]

[side]
side=1
controller=human
team_name=maple

type=Elvish Hero
description=Maple
canrecruit=1

recruit=Horseman,Mage,Bowman,Spearman

{GOLD 300 250 200}
{INCOME 10 5 0}
[/side]

[side]
side=2
controller=ai
team_name=Orcs

type=Orcish Warrior
description=Urug-Telfak
canrecruit=1

recruit=Orcish Grunt,Orcish Archer,Wolfrider,Troll Whelp

{GOLD 50 75 100}
{INCOME 0 1 2}
[/side]
[/scenario]
User avatar
governor
Posts: 267
Joined: December 8th, 2006, 12:32 am

Post by governor »

My mistake (duh), for some reason I thought SimpleCampaign.cfg was the first scenario.

What we are looking for is the scenario.cfg file with [scenario] tag and with id=the_first_scenario. This is so that we can exclude the scenario file as the source for the error. BfW usually incorrectly reports closing tag errors when other syntax errors are present.

Edit: And of course as I type this you already respond. =)
User avatar
governor
Posts: 267
Joined: December 8th, 2006, 12:32 am

Post by governor »

Here is the likely cause of your problems:

Code: Select all

map_data="{campaigns/Simple_Campaign/maps/testmap1
This is also the most common cause for receiving an incorrect missing closing tag error. You open a string and never close it so the parser thinks all the remaining text in all subsequent files are part of the above parameter - possibly even the [/campaign] tag in SimpleCampaign.cfg.

To resolve this:

Code: Select all

map_data="{@campaigns/Simple_Campaign/maps/testmap1}"
or (preferred solution)

Code: Select all

map_data={@campaigns/Simple_Campaign/maps/testmap1}
User avatar
Headache
Posts: 40
Joined: December 30th, 2006, 7:04 pm
Location: Finland

Post by Headache »

Perhaps I should post this to elswere, but...
governor wrote: You open a string and never close it so the parser thinks all the remaining text in all subsequent files are part of the above parameter
Couldn't the string be limited to let's say 9000 chars? The screen cannot even display long texts. If there are more than 9000 chars the parser would cast an error. Perhaps not a good way, but at least you would get an error message, where is mentioned that you have a problem with a string at line X.

(The number above is just my fast guess. I don't know if eg. story can have longer strings)
I'm using version 1.6
User avatar
governor
Posts: 267
Joined: December 8th, 2006, 12:32 am

Post by governor »

What I posted was not entirely correct. The parser would parse a string until it sees " again, and from this points onward the the interpreter will fail as the contents of the file are no longer properly formatted WML.

Take the above example:

Code: Select all


[scenario]
#textdomain wesnoth-Simple_Campaign
id=the_first_scenario
next_scenario=the_second_scenario
name=The First Scenario
map_data="string"Defeat Enemy Leader"string"Death of Maple"string"Turns Run Out"string_starts_and_doesnt_end
Last edited by governor on May 5th, 2007, 5:47 pm, edited 1 time in total.
turret544
Posts: 13
Joined: May 5th, 2007, 12:31 am

Post by turret544 »

Ah, now it works. Thank you very much! I can't believe i overlooked that. Thanks again
User avatar
Headache
Posts: 40
Joined: December 30th, 2006, 7:04 pm
Location: Finland

Post by Headache »

governor wrote:What I posted was not entirely correct.
Oh, right. The error would be that 'Defeat' is not valid syntax. But shouldn't the parser still recognize that the string for map_data is not valid?

BTW: is the parser made with C++ or Python?
I'm using version 1.6
Post Reply