wmllint tutorial
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.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: wmllint tutorial
Even on a slow machine it should end after some minutes.
That's the bug I mentioned previously, it's an infinte loop.
You can use --nospellcheck or deinstall enchant or apply the fix...
That's the bug I mentioned previously, it's an infinte loop.
You can use --nospellcheck or deinstall enchant or apply the fix...
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: wmllint tutorial
I manually stopped it during the loop...
the campaign now starts (I can play the first scenario), but my custom units refuse to show up and so on
Should I just run wmllint again, with --nospellcheck, and hope it is fixed?
I had the same problem while I was writing the campaign, and still don't know how I got over it.
the campaign now starts (I can play the first scenario), but my custom units refuse to show up
Code: Select all
unknown unit type: "Dragon Rider"
Should I just run wmllint again, with --nospellcheck, and hope it is fixed?
I had the same problem while I was writing the campaign, and still don't know how I got over it.
working on the greek translation
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: wmllint tutorial
The spellcheck has no effect on syntactic correctness so turn it off. You'll get a message about unknown unit type (from wmllint) then, probably. Just fix everything reported by wmllint. If I have to guess it's the unit->unit_type thing, but wmllint does that conversion automatically iirc.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: wmllint tutorial
I ran it with --nospellcheck. I really love wmllint now.
It pointed out lots of stuff. After I changed the unit tags to unit_type I could see my custom units. However I still can't convince the Era_of_Magic units to show up. Anyway, thanks for the help. I think that's enough of a tutorial 


working on the greek translation
Re: wmllint tutorial
I ran wmllint (successfully) for the first time yesterday.
It helped me resolve a few minor things, which is nice. Luckily, Elvish_Hunter was kind enough to run an earlier version of my campaign thru wmllint so I knew there shouldn't be anything major in there.
I do get a pile of errors that look like this:
By the way, these are the kind of 'error's that don't seem to affect anything I can see when I playtest the game, everything looks fine with good old Headbag and he's doing exactly what's expected of him.
I wish wmllint could catch variables that are never cleared or used. I went through all my wml yesterday and found ... well, a lot of those. But it takes forever and I'll probably never do it again, instead I'll do what I should have done in the first place, which is to keep track of these variables and clear them when I'm done with them.
I ran wmlscope today. ... I think. I got a log file back that tells me it took 58 seconds to run. Is it offtopic to ask about wmlscope in the wmllint tutorial thread?
What about these other tools, wmllint_gui? wmlvalidator?

It helped me resolve a few minor things, which is nice. Luckily, Elvish_Hunter was kind enough to run an earlier version of my campaign thru wmllint so I knew there shouldn't be anything major in there.
I do get a pile of errors that look like this:
Code: Select all
Support/Wesnoth_1.8/data/add-ons/Swamplings/scenarios/11_Thunderstruck.cfg", line 481: unknown 'Headbag' referred to by id
I wish wmllint could catch variables that are never cleared or used. I went through all my wml yesterday and found ... well, a lot of those. But it takes forever and I'll probably never do it again, instead I'll do what I should have done in the first place, which is to keep track of these variables and clear them when I'm done with them.
I ran wmlscope today. ... I think. I got a log file back that tells me it took 58 seconds to run. Is it offtopic to ask about wmlscope in the wmllint tutorial thread?
What about these other tools, wmllint_gui? wmlvalidator?
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
- Elvish_Hunter
- Posts: 1600
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: wmllint tutorial
Compliments!boru wrote:I ran wmllint (successfully) for the first time yesterday.
If you open the wmllint file with a text editor, or with IDLE, you can see, at the start, how to control its behaviour. Not that I tried yet, and feel free to correct me - but, for example, your above error can be fixed by placing aboru wrote:By the way, these are the kind of 'error's that don't seem to affect anything I can see when I playtest the game, everything looks fine with good old Headbag and he's doing exactly what's expected of him.
#wmllint: recognize Headbag
Not really, since we talked a bit about it already. Did you ran it with any option? To make it looking for cross-references and unresolved references you need to add -u or --unresolved between the wmlscope command and the file paths. And, since you're using 1.8, backport the new wmltools.py file from trunk: it was the only way, for me, to run wmlscope correctly on Windows (always do a backup before).boru wrote:I ran wmlscope today. ... I think. I got a log file back that tells me it took 58 seconds to run. Is it offtopic to ask about wmlscope in the wmllint tutorial thread?
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
Re: wmllint tutorial
So "unknown 'Headbag' referred to by id" means a misspelling?Elvish_Hunter wrote:If you open the wmllint file with a text editor, or with IDLE, you can see, at the start, how to control its behaviour. Not that I tried yet, and feel free to correct me - but, for example, your above error can be fixed by placing a
#wmllint: recognize Headbag
I added -w 1. I just tried it with -u instead. It gave me feedback on every .cfg file on my hard drive. And didn't put it in a log, but that's okay. But I'm not using wmltools from trunk as you recommended, so I'll go do that when I have a chance. I'm just getting a sense of what these tools can do, for the moment.Elvish_Hunter wrote:Did you ran it with any option? To make it looking for cross-references and unresolved references you need to add -u or --unresolved between the wmlscope command and the file paths. And, since you're using 1.8, backport the new wmltools.py file from trunk: it was the only way, for me, to run wmlscope correctly on Windows (always do a backup before).
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: wmllint tutorial
Afaik wmllint checks whether all units referred to by id somewhere in the scenario are actually there. In case that the unit was created in that scenario it knows it automatically, if it was recalled or unstored instead, it does not and needs to be told about it using # wmllint: recognize ...boru wrote:So "unknown 'Headbag' referred to by id" means a misspelling?
As for wmlscope, I suspect that only --unresolved works correctly, on win at least, or I don't understand the crossreference thing, but I suspect the former since even on Linux it didn't work completely correctly. The less frequently used the tools are the more buggy they are I'm afraid, especially on win. Tried wml validator yesterday and I called it correctly I think but it crashed...
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: wmllint tutorial
So we all add these # wmllint: recognize x lines to our code, not because anything's wrong, but just to make wmllint happy?
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
Re: wmllint tutorial
Not to make wmllint happy, but to allow wmllint to show where you really misspelled some unit ID.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: wmllint tutorial
It's much easier to spot the mistakes if you usually have 0 errors and warnings in your "build log", so to say...
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: wmllint tutorial
@pauxlo- these are not misspellings, otherwise the campaign would not function properly.
@Anonymissimus - I agree it would be nice to run this and get zero errors.
@Anonymissimus - I agree it would be nice to run this and get zero errors.
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
Re: wmllint tutorial
Yes, I know (and you), but wmllint does not.boru wrote:@pauxlo- these are not misspellings, otherwise the campaign would not function properly.
Wmllint is too dumb to recognize names from one scenario in the next one, and complains for every ID it does not know. So you "help it" by declaring the ones for which you know that they are no misspellings, and then wmllint can tell you when you really misspelled something.
Alternatively you could tell it not to check for spellings at all, there is a command line parameter, I think.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: wmllint tutorial
No, this issue is unrelated to spellchecking. Boru hasn't enabled it as far as I understand it. Spellchecking is only transformed on translatable strings such as values of attributes message=, description, name= etc. "unknown <someone> referenced by id" is a syntactic check (although the problem could still be caused by misspelling...)pauxlo wrote: Alternatively you could tell it not to check for spellings at all, there is a command line parameter, I think.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: wmllint tutorial
boru wrote:So we all add these # wmllint: recognize x lines to our code, not because anything's wrong, but just to make wmllint happy?
if you don't like it, you can always open wmllint with a text editor, search for the line that prints out that undesired error message, and simply comment it out or change it to "pass" (which means to do nothing).
That will make it shut up about whatever error messages you find useless.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."