0.9.2+ New WML preprocessor
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.
-
- Posts: 873
- Joined: July 4th, 2004, 9:14 pm
- Location: My imagination
- Contact:
I'm having serious problems with apparently valid WML. For example, using the same CVS, and having no .cfg files in {~campaigns} except this (which there exactly one newline at the end of if you can't tell):, I get errors that don't happen if that file is not there:The last error is displayed in Wesnoth and the game does indeed exit.
A similar thing happens within that file instead. When trying to use some campaign cfg files, I get various errors whose cause I don't understand.
Code: Select all
#ifdef NEVER_DEFINED
#endif
Code: Select all
error config: #ifdef not terminated, started at 1 /Users/isaac//Library/Preferences/Wesnoth/data/campaigns/zfinal.cfg 30 data/game.cfg
Error loading game configuration files
error general: Error loading game configuration files: 'Missing closing tag for tag campaign at data/campaigns/The_Rise_of_Wesnoth.cfg:1 included from data/game.cfg:29 at data/scenario-test.cfg:254 included from data/game.cfg:1717' (The game will now exit)
A similar thing happens with
Code: Select all
#define A_DEFINE
#enddef
Play a Silver Mage in the Wesvoid campaign.
I can't reproduce it.
Nothing strange happens: the cache is rebuilt, the game starts fine. Same with #ifdef.
Code: Select all
$ cat ~/.wesnoth/data/campaigns/*.cfg
#define A_DEFINE
#enddef
-
- Posts: 873
- Joined: July 4th, 2004, 9:14 pm
- Location: My imagination
- Contact:
Very odd. It makes sense that you can't reproduce it, because then you already would have known about it. I suppose it's possible that I have something changed in my version that I'm not aware of.... is there a way I can check that?
Play a Silver Mage in the Wesvoid campaign.
Not necessarily. I didn't test the preprocessor with "empty" files. Since it was a corner-case situation, I wouldn't have been surprised if something wrong was happening.Invisible Philosopher wrote:Very odd. It makes sense that you can't reproduce it, because then you already would have known about it.
If you are using a CVS repository, you can do a "cvs diff", it will give the differences between your local files and the files of Wesnoth repository at the time you last updated them. So it will only show your modifications, not the ones that have been applied since then.Invisible Philosopher wrote:I suppose it's possible that I have something changed in my version that I'm not aware of.... is there a way I can check that?
-
- Posts: 873
- Joined: July 4th, 2004, 9:14 pm
- Location: My imagination
- Contact:
The only real difference I found doing that was my --preprocess command-line option, and there's no way that could be affecting normal Wesnoth use. Of course, there are other differences like OS (I use Mac OS X) and zipios (which I don't use), which shouldn't make a difference, but it's not so obvious when there are bugs...silene wrote:If you are using a CVS repository, you can do a "cvs diff", it will give the differences between your local files and the files of Wesnoth repository at the time you last updated them. So it will only show your modifications, not the ones that have been applied since then.
The thing is, I only made that file because I was experiencing errors elsewhere in normal user-made campaign cfg files. One thing I did try though (and getting more inexplicable results), was putting that problematic file in data/themes, the first place game.cfg includes. It didn't cause any error there.silene wrote:Not necessarily. I didn't test the preprocessor with "empty" files. Since it was a corner-case situation, I wouldn't have been surprised if something wrong was happening.Invisible Philosopher wrote:Very odd. It makes sense that you can't reproduce it, because then you already would have known about it.
EDIT: I found out that what my Wesvoid campaign file was doing "wrong" was having #ifdef on the last line without any newline after that. At least, Wesnoth didn't complain any more when I put a newline at the end of the file. At least it's some evidence, even if it doesn't explain why my simple test file fails.
EDIT 2: I'm having another problem. In abbreviated form (hopefully I didn't leave out anything important) (it's actually spread over multiple files):
Code: Select all
#define WESVOID_DATA_PATH
campaigns/Wesvoid#enddef
#define CAMPAIGN_INCLUDE PATH
{(@{WESVOID_DATA_PATH}/{PATH})}#enddef
{CAMPAIGN_INCLUDE utils}
#and some other things...
Also I found out that Wesnoth's cache sometimes doesn't get invalidated when it should: when I only rename files' extensions between .cfg and .cfgx to determine whether they get included, that doesn't invalidate Wesnoth's cache for me.
Play a Silver Mage in the Wesvoid campaign.
I was having trouble with the new preprocessor in a scenario that used EP's PSEUDORANDOM code from the wiki. The game gave a bogus error message complaining about expected characters after a variable name on a line in which there was no variable. When I cut out the following comments that included a macro name in curly braces, the game started and played the scenario without the error message:
Is it trying to recurse into the macro even in comments?
Code: Select all
#Instead of {RANDOM 0..155}, use {PSEUDORANDOM 156}. This is the only way to use it.
#You can use {VARIABLE_OP random add X} afterwards to get a higher range.
Try some Multiplayer Scenarios / Campaigns
You are right, it wouldn't have worked with the old preprocessor. And it works fine for me with the new preprocessor. I just put a file plouf.cfg in my data/campaigns directory and another one deeper in the Wesvoid/utils directory.Invisible Philosopher wrote:It's including data/game.cfg somehow, leading to infinite recursion. :( Although I doubt it worked under the old preprocessor either.Code: Select all
#define WESVOID_DATA_PATH campaigns/Wesvoid#enddef #define CAMPAIGN_INCLUDE PATH {(@{WESVOID_DATA_PATH}/{PATH})}#enddef {CAMPAIGN_INCLUDE utils} #and some other things...
Code: Select all
info filesystem: streaming data/campaigns/plouf.cfg for reading.
info config: defining macro WESVOID_DATA_PATH
info config: defining macro CAMPAIGN_INCLUDE
info config: substituting macro CAMPAIGN_INCLUDE
info config: substituting (slow) macro WESVOID_DATA_PATH
info filesystem: streaming data/campaigns/Wesvoid/utils/a.cfg for reading.
Something similar to what Invisible Philosopher is describing is occuring on my machine too:
"
Missing closing tag for tag scenario at /root/.wesnoth/data/campaigns/Northern_Rebirth/scenarios/Breaking_the_Chains.cfg:1 included from /root/.wesnoth/data/campaigns/Northern_Rebirth.cfg:32 included from data/game.cfg:25 at /root/.wesnoth/data/campaigns/Northern_Rebirth/scenarios/Breaking_the_Chains.cfg:43 included from /root/.wesnoth/data/campaigns/Northern_Rebirth.cfg:32 included from data/game.cfg:25
"
and it exits. It seems to happen with every user campaign. Gentoo Linux portage build
"
Missing closing tag for tag scenario at /root/.wesnoth/data/campaigns/Northern_Rebirth/scenarios/Breaking_the_Chains.cfg:1 included from /root/.wesnoth/data/campaigns/Northern_Rebirth.cfg:32 included from data/game.cfg:25 at /root/.wesnoth/data/campaigns/Northern_Rebirth/scenarios/Breaking_the_Chains.cfg:43 included from /root/.wesnoth/data/campaigns/Northern_Rebirth.cfg:32 included from data/game.cfg:25
"
and it exits. It seems to happen with every user campaign. Gentoo Linux portage build
2B |! 2B = 3F
This is because Northern Rebirth is buggy -- remove it, remove your cache files, restart, and you should be fine. If you are feeling energetic, you could try syntax checking the campaign and mailing the author with the fixes.ryn wrote:Missing closing tag for tag scenario at /root/.wesnoth/data/campaigns/Northern_Rebirth/scenarios/Breaking_the_Chains.cfg:1
This quote is not attributable to Antoine de Saint-Exupéry.
There were 2 wrongly terminated strings in Northern Rebirth that I have notified Taurus about, and that he is fixing, and preparing to upload a new version. Not sure if it will solve this problem or not, but trying his new version once it hits the campaign server might be a good idea.ott wrote:This is because Northern Rebirth is buggy -- remove it, remove your cache files, restart, and you should be fine. If you are feeling energetic, you could try syntax checking the campaign and mailing the author with the fixes.ryn wrote:Missing closing tag for tag scenario at /root/.wesnoth/data/campaigns/Northern_Rebirth/scenarios/Breaking_the_Chains.cfg:1
This topic has been changed from an announcement to a normal post. Please ensure the changes described here are properly documented in the wiki or elsewhere.
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.