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.
wmllint tutorial
Hello everybody
wmllint is one of the best tools that come with wesnoth. It's a no-brainer to edit your campaign with this, instead of re-writing again manually in order to make it compatible with the new version. Now, not all of us (including me) have any kind of experience with Python, or Lua or C++ or any other programming language, so I think it would really be of service to all UMC authors (real and would-be) to post a tutorial about it (what it is, how you use it, why it must ignore some strings in campaign and scenario files etc) on the forum or even in the site.
ideas?
wmllint is one of the best tools that come with wesnoth. It's a no-brainer to edit your campaign with this, instead of re-writing again manually in order to make it compatible with the new version. Now, not all of us (including me) have any kind of experience with Python, or Lua or C++ or any other programming language, so I think it would really be of service to all UMC authors (real and would-be) to post a tutorial about it (what it is, how you use it, why it must ignore some strings in campaign and scenario files etc) on the forum or even in the site.
ideas?
working on the greek translation
- Elvish_Hunter
- Posts: 1600
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: wmllint tutorial
I posted the things below in Fossil thread, so I'm quoting myself here hoping to be useful:
Elvish_Hunter wrote:This is how I run wmllint:
- first, open Windows Command Prompt (on Linux, open a text shell)
- then, type the path to your python.exe file (mine is C:\Python26\pyton.exe; not needed on Linux) and a space
- then, the path to wmllint (something like "C:\Programs\Battle for Wesnoth 1.8\data\tools\wmllint"; if your path has spaces, place this between quotes, like I did) and a space
- if needed put here some parameters (the most important is --dryrun, that runs wmllint showing only the output on screen and not changing the files)
- then, the path to your Wesnoth core folder ("C:\Programs\Battle for Wesnoth 1.8\data\core\") and a space
- then, the path to your add-on ("C:\Programs\Battle for Wesnoth 1.8\userdata\data\add-ons\Fossil\")
- if you need a log file, add (without any space) >wmllint.log
- you can press Enter and enjoy! Wmllint will do the corrections, and inform you with messages on the command prompt about the changes that you'll need to do by hand.
In the same way, you can run also wmlscope. I hope that this will be useful.
Elvish_Hunter wrote:Wmllint is automatically installed when you install Wesnoth You should download Python from http://www.python.org. To include parameters, you just type them. The final command line is: C:\Python26\pyton.exe "C:\Programs\Battle for Wesnoth 1.8\data\tools\wmllint" --dryrun "C:\Programs\Battle for Wesnoth 1.8\data\core\" "C:\Programs\Battle for Wesnoth 1.8\userdata\data\add-ons\Fossil\">wmllint.log (if you want that wmllint changes the files, just remove --dryrun) Ah, the good old MS-DOS 6.22/Windows 3.11 times... (just joking, I never used them )
Elvish_Hunter wrote:I saved that string in a text file and, when I want to run wmllint, I just copypaste it, change the name of the addon folder and that's it. Or I drag and drop the folders (or the files) on the command prompt window and Windows types it for me. It's also possible to run it as a batch file, theoretically - but I never made a batch file.
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
yes i think that it helps a lot.galicae wrote:Hello everybody
wmllint is one of the best tools that come with wesnoth. It's a no-brainer to edit your campaign with this, instead of re-writing again manually in order to make it compatible with the new version. Now, not all of us (including me) have any kind of experience with Python, or Lua or C++ or any other programming language, so I think it would really be of service to all UMC authors (real and would-be) to post a tutorial about it (what it is, how you use it, why it must ignore some strings in campaign and scenario files etc) on the forum or even in the site.
ideas?
and i hope the site (or this page) includes the download links to old versions of wmllint and its dependency so that everyone can convert ancient scenarios made b4 1.6version of wesnoth without downloading whole packages of wesnoth.
Re: wmllint tutorial
just had a look at the changelog - seems only code for releases earlier than 1.4 has been removed. my guess would be that the current version should work fine for >1.4.
edit: there's an official note within the code itself:
edit: there's an official note within the code itself:
Code: Select all
# Note: Lift logic for pre-1.4 versions has been removed; if you need
# it, check out a copy of wmllint from the 1.4 stable branch and use
# that to lift before running this one.
- Elvish_Hunter
- Posts: 1600
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: wmllint tutorial
Download linksitota wrote:and i hope the site (or this page) includes the download links to old versions of wmllint and its dependency so that everyone can convert ancient scenarios made b4 1.6version of wesnoth without downloading whole packages of wesnoth.
For wmllint 1.4: http://svn.gna.org/viewcvs/wesnoth/bran ... ls/wmllint
For wmllint 1.6: http://svn.gna.org/viewcvs/wesnoth/bran ... ls/wmllint
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
Hmm, interesting... So basically, it debugs the code you write and finds the errors/possibly corrects them, or it just spots te stuff that has changed with each passing version?
Also, if anybody knows, would it be the same procedure for mac, but use Terminal instead of Windows Command Prompt?
Also, if anybody knows, would it be the same procedure for mac, but use Terminal instead of Windows Command Prompt?
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Current projects: Internet meme Era, The Settlers of Wesnoth
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: wmllint tutorial
yes (it's >= 1.4)Max2008 wrote:my guess would be that the current version should work fine for >1.4.
I've used 1.4 wmllint to convert old maps recently.
bothDixie wrote:So basically, it debugs the code you write and finds the errors/possibly corrects them, or it just spots te stuff that has changed with each passing version?
It's a convert-to-recent-standards and a sanity tool at the same time. With --dryrun it's only a sanity checker...
probably not exactlyAlso, if anybody knows, would it be the same procedure for mac,
yesbut use Terminal instead of Windows Command Prompt?
I can tell for windows<->Linux that it works in principle in the same way, while windows is a lot more difficult.
Note that wmllint's spellcheck (you notice it only when installing python enchant) and wmlscope are bugged in 1.8; both problems are only fixed in the 1.9 branch. The developers working on the python tools are mostly not using windows themselves, that's why there tend to be win-only bugs which don't get spotted and then people wonder why they can't get it to work...
I've created a patch for my private use that summarizes the neccessary fixes for both bugs, in case you find out what to do with it. You may apply those changes also manually.
Spoiler:
Last edited by Anonymissimus on July 16th, 2010, 2:34 pm, edited 1 time in total.
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
thank u Elvish_Hunter. i have tested the wmllint 1.4 with 1.8 dependencies(i.e. wmltools and so on in 1.8 packages), and have confirmed 1.2 map is correctly updated to 1.4 format.Elvish_Hunter wrote:Download linksitota wrote:and i hope the site (or this page) includes the download links to old versions of wmllint and its dependency so that everyone can convert ancient scenarios made b4 1.6version of wesnoth without downloading whole packages of wesnoth.
For wmllint 1.4: http://svn.gna.org/viewcvs/wesnoth/bran ... ls/wmllint
For wmllint 1.6: http://svn.gna.org/viewcvs/wesnoth/bran ... ls/wmllint
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: wmllint tutorial
Actually there was already some sort of tutorial that already covered most of what's needed.
http://wiki.wesnoth.org/Maintenance_tools
@Elvish_Hunter, feel free to improve my additional description...
http://wiki.wesnoth.org/Maintenance_tools
@Elvish_Hunter, feel free to improve my additional description...
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
- Elvish_Hunter
- Posts: 1600
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: wmllint tutorial
Anonymissimus, you did a good jobAnonymissimus wrote:@Elvish_Hunter, feel free to improve my additional description...

To use (at least partially) these bugfixes in 1.8 is needed to replace the wmltools.py with the one from trunk (that I did in my copy when the first part of the bug was fixed).esr, at https://gna.org/bugs/index.php?15996#discussion wrote:loonycyborg says the other bit of the bug is fixed at r44124.
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)
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: wmllint tutorial
It won't work for long, since e.g. a function gets renamed, leading to a broken reference. Later on in 1.9 you'll need to apply the fixes manually. I begged esr to apply the fixes to 1.8 too yet he didn't.Elvish_Hunter wrote:To use (at least partially) these bugfixes in 1.8 is needed to replace the wmltools.py with the one from trunk (that I did in my copy when the first part of the bug was fixed).
And I don't know what loony is referring to with the other bit, I'm happy with these fixes. On the other hand, the sense of that check for mismatched references is also rather mysterious to me...
EDIT
You could keep copies from the current wmllint and wmltools.py on your harddrive and use them when downloading 1.8.4+ ...
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 would it just be safer to do on Linux?
Anyway, thanks guys. I can see my old campaign in the 1.8 addon list!!
Anyway, thanks guys. I can see my old campaign in the 1.8 addon list!!
working on the greek translation
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: wmllint tutorial
Safer in terms of security ? Why should it ? (Despite that Linux is more secure in general.)galicae wrote:So would it just be safer to do on Linux?
wmllint doesn't do everything, there's this thread about import syntax changes, you also need to consult it.
btw if someone on Linux finds a mistake in the description point it out; I wrote it partly from memory.
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
no, I meant safer in terms of efficiency, because of the win-specific bugs reported before. Thanks, though, I'll try it ASAP
working on the greek translation
Re: wmllint tutorial
omg, how long is it supposed to take?
I installed the enchant library to allow spellchecking, and after I entered the lines and pressed enter the machine went on to growl for half an hour or so. I had to terminate it manually, because I wanted to sleep.
i'll try again, though
I installed the enchant library to allow spellchecking, and after I entered the lines and pressed enter the machine went on to growl for half an hour or so. I had to terminate it manually, because I wanted to sleep.

i'll try again, though
working on the greek translation