Porting add-ons - newbie to wmllint and wml

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
Daravel
Posts: 287
Joined: August 30th, 2008, 10:39 pm
Location: England

Porting add-ons - newbie to wmllint and wml

Post by Daravel » May 3rd, 2018, 5:19 pm

Hello!

As I've posted here (viewtopic.php?f=8&t=48086), I'm looking to port over old add-ons to 1.14. The main snag is that my wml is fairly basic.

I've taken a simple campaign and my aim is to get it working on 1.14, but I've already hit problems. I've made this thread to seek help in understanding different error messages and how to fix the answer.

First up:

When loading the campaign I get this error:

Macro/file 'WEAPON_SPECIAL_SHOCK' is missing
at campaigns/Eastern_Invasion/units/Horse_Lord.cfg:41
included from campaigns/Fargoths_Bow/_main.cfg:26
included from _main.cfg:38

Looking in the _main.cfg (attached) it pulls the Horse_lord unit from Eastern Invasion. Checking the EI campaign, the unit and ability are all there. I'd say that the directory is wrong, but it's finding the unit OK, just not the ability within the units cfg. I can't find anything on the wiki about importing units into your campaign, I'm sure it's a simple fix.
Attachments
_main.cfg
(2.03 KiB) Downloaded 38 times
Dialgoue editing for non-native English speakers - I will edit your scenario/campaign dialogue
I can also help re-write your campaign dialogue, drop me a PM (Completed projects: The Sojournings of Grog)

User avatar
Ravana
Moderator
Posts: 1832
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Porting add-ons - newbie to wmllint and wml

Post by Ravana » May 3rd, 2018, 5:48 pm

You picked addon that put its files in wrong location, see https://wiki.wesnoth.org/AddonStructure

It might be easier to start with newer addons, 1.10 and 1.12 ones.

Daravel
Posts: 287
Joined: August 30th, 2008, 10:39 pm
Location: England

Re: Porting add-ons - newbie to wmllint and wml

Post by Daravel » May 3rd, 2018, 10:18 pm

Ravana wrote:
May 3rd, 2018, 5:48 pm
You picked addon that put its files in wrong location, see https://wiki.wesnoth.org/AddonStructure

It might be easier to start with newer addons, 1.10 and 1.12 ones.
Is it because its trying to pull mainline units? I removed all the unit and binary path and it worked - but would it then be able to use the units later on, considering they are mainline? Obviously custom units go into the 'units' folder, so do you only need to use [+units] when you have custom units in that folder?


After getting it to work, it then said the map wouldn't load, saying that the terrain was illegal (S): S or something. Looking at the terrain file, I'm not entirely sure what's going on here. According to the terrain wiki, 'S' is swamp. Opening up a dead water map shows the terrain code 'Ss', so I tried switching it to that, but no luck. I used the map editor and put down some swamp and the code is 'Ss'. I gave up here.

Instead I pulled up The Sojournings of Grog as I know that definitely worked and is on the 1.12 server. I loaded it up on 1.14 and it worked fine (played into the 2nd scenario). I then ran wmllint and it came up with such a long list of things that the cmd window couldn't display them all (I tried running it on just one scenario file, but it didn't seem to like that). So I went ahead and made the changes, which then promptly broke the campaign. Interestingly, it seems to be a similar issue as it then can't find a macro - which when I looked in the utils folder, doesn't exist (but it worked fine on the 1.12 version)

I understood wmllint to update the WML to the conventions and syntax of the latest version. But obviously it is making some changes which break the campaign. Is there a handy guide anywhere that details a) what the wml changes are between each version and b) what wmllint does, or does not do, in regard to these? Do I just need to pour over the full changelog for each stable release?
Dialgoue editing for non-native English speakers - I will edit your scenario/campaign dialogue
I can also help re-write your campaign dialogue, drop me a PM (Completed projects: The Sojournings of Grog)

User avatar
Ravana
Moderator
Posts: 1832
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Porting add-ons - newbie to wmllint and wml

Post by Ravana » May 3rd, 2018, 10:57 pm

Commonly encountered changes should be listed in topics like viewtopic.php?f=21&t=47614.

S signifies swamp, but by itself is not a terrain (anymore? it seems ancient campaign, before my time). Current terrains list is https://wiki.wesnoth.org/TerrainCodesWML.

Personally I have not found wmllint useful, so cant advice much with that.

User avatar
beetlenaut
Developer
Posts: 2205
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Porting add-ons - newbie to wmllint and wml

Post by beetlenaut » May 5th, 2018, 12:51 am

Daravel wrote:
May 3rd, 2018, 5:19 pm
it's finding the unit OK, just not the ability within the units cfg. ...I'm sure it's a simple fix.
The ability is in the Eastern Invasion utils folder which you never included.
Daravel wrote:
May 3rd, 2018, 10:18 pm
According to the terrain wiki, 'S' is swamp.
Yes, but there is no terrain that is just S. It sounds like the map is using old-style terrain codes, and those won't translate. You will have to rebuild the map. You could download an older version of BfW (I'm pretty sure 1.4 will work, and maybe 1.6 as well), and run it alongside 1.14 with the map editor open. You could copy the map manually that way. It may not be that easy, but it's probably easier than manually changing all the codes in the .map text file.
Daravel wrote:
May 3rd, 2018, 10:18 pm
So I went ahead and made the changes, which then promptly broke the campaign.
All of them at once? There is no way you didn't make any typos or tag mistakes. You should have changed just one or two things at a time and tested after each edit (not forgetting to reload the cache). Then, if it broke, you would know where the problem was.
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients

Konrad2
Forum Regular
Posts: 974
Joined: November 24th, 2010, 6:30 pm

Re: Porting add-ons - newbie to wmllint and wml

Post by Konrad2 » July 26th, 2018, 3:35 pm

Daravel wrote:
May 3rd, 2018, 10:18 pm
Is there a handy guide anywhere that details a) what the wml changes are between each version [...] Do I just need to pour over the full changelog for each stable release?
I've pulled together a list of links for WML/Lua changes.
While I'm also putting together a list of WML changes (see post below), that list will be not as complete as the information in the links.

I do not claim that my list of links is complete. (And theoretically I could out down the link for every WML changelog, but I'd consider that spam.)

Between 1.14.0 and 1.14.4 Between 1.12 and 1.13/1.14 Between 1.10 and 1.11/1.12 Between 1.8 and 1.9/1.10 Between 1.6 and 1.7/1.8 Between 1.4 and 1.5/1.6 Between 1.2 and 1.3/1.4 Between 1.0 and 1.1/1.2
Last edited by Konrad2 on July 31st, 2018, 5:33 pm, edited 2 times in total.
I am a Ghost: I drain the life energy from other people to survive and am hated/feared by regular people. Non-regular people don't like me either though.

Konrad2
Forum Regular
Posts: 974
Joined: November 24th, 2010, 6:30 pm

Re: Porting add-ons - newbie to wmllint and wml

Post by Konrad2 » July 31st, 2018, 4:05 pm

Feel free to add to it. (It's very incomplete so far.)
Some of this might be wrong, so please make corrections as needed.

https://docs.google.com/spreadsheets/d/ ... sp=sharing

EDIT: Accidentally didn't enable full access thorugh link before..
Last edited by Konrad2 on August 1st, 2018, 9:51 am, edited 1 time in total.
I am a Ghost: I drain the life energy from other people to survive and am hated/feared by regular people. Non-regular people don't like me either though.

Groggy_Dice
Inactive Developer
Posts: 165
Joined: February 4th, 2011, 6:19 am
Contact:

Re: Porting add-ons - newbie to wmllint and wml

Post by Groggy_Dice » August 1st, 2018, 7:31 am

There is a GUI frontend to wmllint written by Elvish Hunter; have you tried it?

I don't know exactly what you've tried, but it is important to note that wmllint has no notion itself of the game's directory structure. You must point it to the data/core directory when invoking wmllint (preferably as the first directory called), or you are bound to be inundated with errors about missing macros, units, etc. If an add-on uses an Era, its folder should be called. If the campaign is using the Horse Lord, you need to call it or a directory that includes it. wmllint will only parse folders that it is specifically invoked for.

You might want to try the GUI. It tries to make things easier, for example by assuming that wmllint is in its standard location relative to data/core and calling core by default. Another option is to use the -K --known switch. It suppresses the global sanity check, so you can do a quick and dirty check of a single file or folder without a flood of errors about unknown macros, etc.
Ports:
Prudence (Josh Roby) | By the Sword (monochromatic) | The Eight of Cembulad (Lintana~ & WYRMY)
Resources:
UMC Timeline (Dec) | List of Unported UMC (Dec) | wmllint++ (Feb)

Groggy_Dice
Inactive Developer
Posts: 165
Joined: February 4th, 2011, 6:19 am
Contact:

Re: Porting add-ons - newbie to wmllint and wml

Post by Groggy_Dice » August 1st, 2018, 9:00 am

As for the general state of wmllint:

wmllint was originally developed by esr, but he became alienated from the project.

I became involved, improving the conversion of old WML to 1.10, fixing long-standing bugs, adding a couple of new features.

However, I did not follow new WML changes closely. I don't know C++, I don't compile, and I rarely download development milestones. So I only dimly knew what the changes were and felt no stake in them.

For example, a new map format was introduced in 1.12. But why write code to convert old maps when I really didn't know what the new format was, I likely wouldn't see the need for it, and the old format would continue to work indefinitely?

I had ideas for more wmllint improvements, but put them on the back-burner to focus on non-Wesnoth matters. Unfortunately I got bogged down and haven't returned to wmllint.

I'm not sure anyone else has picked up the slack. Whenever I've glanced at the new commit history, it's struck me as sparse.

So it's possible that wmllint peaked as a tool for upgrading to 1.10, and a bit of bitrot is setting in.
Ports:
Prudence (Josh Roby) | By the Sword (monochromatic) | The Eight of Cembulad (Lintana~ & WYRMY)
Resources:
UMC Timeline (Dec) | List of Unported UMC (Dec) | wmllint++ (Feb)

User avatar
Elvish_Hunter
Developer
Posts: 1372
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Porting add-ons - newbie to wmllint and wml

Post by Elvish_Hunter » August 1st, 2018, 9:43 am

Groggy_Dice wrote:
August 1st, 2018, 9:00 am
For example, a new map format was introduced in 1.12. But why write code to convert old maps when I really didn't know what the new format was, I likely wouldn't see the need for it, and the old format would continue to work indefinitely?
There's also the fact that, when you open an old map in the map editor, it's automatically converted to the new format when saving it. So, there's really no point for wmllint to get involved.
Groggy_Dice wrote:
August 1st, 2018, 9:00 am
I'm not sure anyone else has picked up the slack. Whenever I've glanced at the new commit history, it's struck me as sparse.
However, the WML from 1.12 to 1.14 hasn't changed that much. There were two main changes: the transparent portraits (granted, this isn't really a WML change...) were moved from their own directories and the non transparent portraits were removed, this in turn required a change of every portrait path that wmllint can do automatically; and there was the substitution of difficulty macros in _main.cfg with tags. This last change was impossible to automate, because every UMC author wrote them differently enough: some of them didn't use macros, some spanned them over two or three lines (and wmllint can only do line-by-line changes), sometimes the MENU_IMG_TEXT and MENU_IMG_TEXT2 were used in [message] [option]... So, a one-size-fits-all solution just couldn't be implemented.
Granted, there were also other changes like [elseif], but these don't break compatibility.
EDIT: and there was also the renaming of the Khalifate as Dunefolk, which once again wmllint handles automatically.
Current maintainer of these add-ons:
1.14: The Sojournings of Grog, A Rough Life, The White Troll (co-author)
1.12: Children of Dragons, Wesnoth Lua Pack
Active again until mid-October

enclave
Posts: 835
Joined: December 15th, 2007, 8:52 am

Re: Porting add-ons - newbie to wmllint and wml

Post by enclave » August 1st, 2018, 10:51 am

not sure myself if you would be able to open old map in map editor at all, from my memory it would just crash.
Also you maybe found all S in map editor, but didn't notice the S on the map border (x=0, y=0)
So easiest way to edit the map I would say:
1) download "Notepad++"
2) Open map with Notepad++
3) At top of the window find "Search" (near File, Edit, View, Encoding etc), and there find "Replace" (Ctrl+H), and then you could input "S" in top field and "Ss" in bottom field... i think it's case sensitive, so it won't replace "Wws" with "WwSs", but keep it in mind.. since S is too simple terrain code.. it would also replace "Ss" with "Sss", as it would be replacing all S ocurencies..

Maps were often very incompatible between versions... so in 1.10 I even created add-on which replaces some known incompatible with 1.12 terrains.. so you may try to "search" "enclave" in 1.10 add-ons if you looking to port map from 1.10 into 1.12

Post Reply