Campaign Coding Question: Problem with .cfg file

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

Post Reply
Devrailis Colandore
Posts: 76
Joined: April 22nd, 2007, 3:16 am
Location: Canada

Campaign Coding Question: Problem with .cfg file

Post by Devrailis Colandore »

Hi everyone, I'm a long time lurker on these boards. First off, I'd like to thank the developers for creating a great game. I've definitely spent too many hours playing Wesnoth in the wee hours of the night, fallen in love with too many elven shamans, and of course, cursed at too many a lucky goblin. For someone with my tragically short attention span, that's quite an accomplishment!

I've been working on a campaign of my own for some time now; I plan on it being my own little contribution to the community. Well, mostly, I've been focusing on writing the script and overall story, since I'm definitely a writer above all else. Unfortunately, I'm rather new at this coding thing. I've spent a week trying to hammer out the basic structure of the campaign file - from the WML tutorials and by shamelessly copying the coding structure of the usermade campaigns (thank you turin!).

I think I've made a rather clean campaign cfg file. I'm running Windows XP and all usermade campaign cfgs are in my userdata/data/campaigns folder. When I add my own cfg file to the folder however, I get the following message:

"The following add-on campaign(s) had errors and could not be loaded: /Wesnoth/userdata/campaigns//Autumn_Kingdoms_Prologue.cfg

Error Details: Unexpected characters at line start at <unknown> :1

This message pops up in the initial loading screen. I can skip it but I can't access multiplayer the option afterwards.

I'm not quite sure what this means as I've gotten it every single time. I checked my cfg file initially and caught a few typos here and there. I also made sure that the cfg file was saved as a txt file with the cfg extension. I'm using WordPad and there doesn't seem to be a difference between my cfg file and other campaign files, so I think that the file type and my use of WordPad should be fine.

I also tried to avoid any image conflicts by referencing only basic unit images that I could copy from the main data folder. I copied those images directly into the campaign image folder (.../campaign/Autumn_Kingdoms_Prologue/images) so I could refer to them directly. I'm not sure if this would cause a problem or not, though I don't believe that it should.

Is it possible that an error in the scenario file could cause this problem as well? I made sure that the scenario file and id names matched with the name in the campaign file. I also double-checked to make sure that the map name matched up as well. However, I'm still getting the same error message everytime I try to load up Wesnoth with my campaign file in my folder.

I'd appreciate it if someone could take a quick look at the file and let me know if there is a problem with the code, or if the problem is with the campaign cfg file at all. I'd go into details about what the campaign is about and all that good stuff but at the moment, I'm more concerned about getting it off first-base with the coding. At this point, I'm hoping that it's something small and stupid that I should have seen already, since I've spent way too much time trying to get this to work.

Thanks in advance for the help, and may your horsemen stay away from the goblin hordes!
Attachments
Autumn_Kingdoms_Prologue.cfg
Autumn_Kingdoms_Prologue.cfg
(1.08 KiB) Downloaded 160 times
User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

Post by Mist »

Can you post first sceario file as well? (actualy zipped campaign directory would be the best) WML error message are cryptic and rarely related to the file they tend to throw out.
Somewhere, between the sacred silence and sleep.
Disorder.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Funnily enough, it is a problem in the campaign file. More specifically, in the difficulty_descriptions= (since removing that fixes the problem). I'm not sure what is wrong since I didn't really start to debug it in-depth, but you should be able to figure it out with some experimentation and investigation of how other campaigns do it exactly.
Devrailis Colandore
Posts: 76
Joined: April 22nd, 2007, 3:16 am
Location: Canada

Post by Devrailis Colandore »

Thank you both for the quick replies. It turns out that it was a small line of text in the Normal difficulty line.

I had typed it as this:

Code: Select all


";*" + {MENU_IMG_TXT "../data/campaigns/Autumn_Kingdoms_Prologue/images/lieutenant.png" (_"Lieutenant") (_"(Normal)")} + 

The (_"(Normal)") tag seems to be the cause of the problem since when I remove it, the problem disappears.

Code: Select all


";*" + {MENU_IMG_TXT "../data/campaigns/Autumn_Kingdoms_Prologue/images/lieutenant.png" (_"Lieutenant")} + 

I'm not quite sure why this would cause a problem. I checked the other campaigns and some defined the Normal difficulty level and others didn't. But at least the campaign file is working properly now.

Thank you both again for your help.
Post Reply