Journey Map Pin Error

The place to post your WML questions and answers.

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.
Post Reply
harlequin565
Posts: 9
Joined: May 17th, 2012, 7:44 am

Journey Map Pin Error

Post by harlequin565 »

Hi folks,

Just reinstalled Wesnoth with the intention of finishing my campaign (started in 2014!)

1st issue is that the map journey function is no longer working. I'm getting the following

Image

When I go into the journey config and remove the co-ordinates for the battle, the scenario loads just fine. If I try other scenarios as starter scenarios I get the same error.
I can only imagine that something in the WML has changed in "recent" versions that is causing this because it all worked fine when I was last working on it (many years ago!)

Anyone have any pointers to set me off in the right direction?
Thanks in advance!
Pilauli
Posts: 115
Joined: August 18th, 2020, 12:56 pm

Re: Journey Map Pin Error

Post by Pilauli »

Map journey? Is that the thing where there is a map in the "story" section that shows where the heroes are going?

If so, you could try reading through the mainline campaigns to see how they do it nowadays.

--

Looking at your error message, I suspect your problem might be that you have negative coordinates you shouldn't have.
'as_int >= 0' failed
[...]
x = -15
If I had to make a guess about what's going on, I would guess that they used to measure coordinates from the center of the image and now measure from the top-left corner, which would require everyone to recalculate all of the coordinates at the time of the changeover. I could easily be wrong, though.

So, uh, try making all of your coordinates positive and see if that fixes it.

--

For general reference:
https://wiki.wesnoth.org/ReferenceWML (very general reference)
https://www.wesnoth.org/macro-reference ... -utils.cfg (list of macro names and arguments; you can open the relevant file on your computer to read their innards)
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Journey Map Pin Error

Post by Celtic_Minstrel »

Pilauli wrote: February 11th, 2021, 11:36 pm If I had to make a guess about what's going on, I would guess that they used to measure coordinates from the center of the image and now measure from the top-left corner, which would require everyone to recalculate all of the coordinates at the time of the changeover.
If this is true, it should probably be filed as a bug, both because unexpected API changes like that are a bad idea and because measuring from the centre actually is more useful.

Even if they're still measured from the centre though, that means the coordinate you give is combined with some other numbers to get the actual position of the image's top left corner, so if your image is 32 pixels wide then the lowest possible coordinate is -16; anything lower could have triggered this. This is also a bug though - invalid user input should never crash the program.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
harlequin565
Posts: 9
Joined: May 17th, 2012, 7:44 am

Re: Journey Map Pin Error

Post by harlequin565 »

Pilauli wrote: February 11th, 2021, 11:36 pm Map journey? Is that the thing where there is a map in the "story" section that shows where the heroes are going?
Correct.

Sadly, it's not the co-ordinates. They're positive and I checked they were right. Was the first thing I did when I saw the "-15". Was a Google search result for the problem too.

Setting the start scenario as a different one bombs it out too, so it's (presumably) not the values.

I'll have to go down the HttT copy route I think.

THanks for your replies.
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Journey Map Pin Error

Post by octalot »

Which version of Wesnoth are you using, and could you post the WML that causes the error, please? I agree with Celtic_Minstrel, that sounds like a bug.
harlequin565
Posts: 9
Joined: May 17th, 2012, 7:44 am

Re: Journey Map Pin Error

Post by harlequin565 »

The campaign was built in 1.12 so all the WML will have been from that. It worked fine in 1.12. Am tempted to download the older version just to confirm.

I've literally dropped the campaign straight into the 1.14 Steam version under add-ons.

I've been looking to find the changelogs for 1.13 and 1.14 to see if there's anything in there that changed anything related. I was wondering if there were size restrictions on the map, but I swapped the map into HTTT and it worked fine.

As to the WML that causes the error...

This is all from the bigmap.cgf in utils

Code: Select all

#textdomain wesnoth-DrenaiRising

#define DRENAI_BIGMAP
    [background_layer]
        image=maps/bigmap.png
        scale_vertically=yes
        scale_horizontally=no
        keep_aspect_ratio=yes
    [/background_layer]
#enddef

#define JOURNEY X Y
    [image]
        x,y={X},{Y}
        file=misc/new-journey.png
        delay=300
        centered=yes
    [/image]
#enddef

#define JOURNEY_01_NEW
    {NEW_BATTLE 774 553}
#enddef

#define BIGMAP_01_DRENAI_RISING
    [story]
        [part]
            show_title=yes
            {DRENAI_BIGMAP}
            {JOURNEY_01_NEW}
        [/part]
    [/story]
#enddef
And then in scenario 1 I call

Code: Select all

{BIGMAP_01_DRENAI_RISING}
If I comment out {JOURNEY_01_NEW} the scenario loads fine (obviously without the journey icons).

Somethign is wrong with this

Code: Select all

#define JOURNEY_01_NEW
    {NEW_BATTLE 774 553}
#enddef
But I'm not seeing it. I'm sure it's something really stupid.
harlequin565
Posts: 9
Joined: May 17th, 2012, 7:44 am

Re: Journey Map Pin Error

Post by harlequin565 »

Edit to add, just downloaded 1.12 and it works fine. I'm going to start digging through changelogs when I find them.
gnombat
Posts: 682
Joined: June 10th, 2010, 8:49 pm

Re: Journey Map Pin Error

Post by gnombat »

harlequin565 wrote: February 12th, 2021, 12:56 pm Edit to add, just downloaded 1.12 and it works fine. I'm going to start digging through changelogs when I find them.
If the add-on is working on version 1.12, I think you can upload it to the 1.12 add-on server (I believe the add-on server still accepts uploads even though it is for an old version).
harlequin565
Posts: 9
Joined: May 17th, 2012, 7:44 am

Re: Journey Map Pin Error

Post by harlequin565 »

gnombat wrote: February 12th, 2021, 4:08 pm If the add-on is working on version 1.12, I think you can upload it to the 1.12 add-on server (I believe the add-on server still accepts uploads even though it is for an old version).
Sorry for being ignorant but how would that help?

It would be good if I could finish the campaign against the latet version of Wesnoth...
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2340
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Journey Map Pin Error

Post by Lord-Knightmare »

It would be good if I could finish the campaign against the latet version of Wesnoth...
It sounds like you need to use wmllint.
Wesnoth Wiki wrote: wmllint
a utility for sanity-checking WML syntax and porting your old WML to the current version of WML.
https://wiki.wesnoth.org/Maintenance_tools

If you have python3 installed, you can run the GUI.pyw file in the data/tools directory and use the app to have your code updated to the 1.14.x WML.
The tool would do all the corrections for you and point out which parts you have to rectify. Also, I do recommend keeping a copy of your add-on (better safe than sorry) before using wmllint if you make cannot use it properly the first time.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
gnombat
Posts: 682
Joined: June 10th, 2010, 8:49 pm

Re: Journey Map Pin Error

Post by gnombat »

harlequin565 wrote: February 12th, 2021, 9:44 pm
gnombat wrote: February 12th, 2021, 4:08 pm If the add-on is working on version 1.12, I think you can upload it to the 1.12 add-on server (I believe the add-on server still accepts uploads even though it is for an old version).
Sorry for being ignorant but how would that help?

It would be good if I could finish the campaign against the latet version of Wesnoth...
Yes, obviously the latest 1.14 version of Wesnoth is the recommended version, but releasing it on 1.12 might be a way to allow people to test it, look at the code, provide feedback, etc. Maybe someone will see something that could help resolve this issue (or other issues).

Right now it's never been released anywhere, so no one has ever seen it (other than the few code snippets you posted above), and it's difficult for anyone to tell whether anything might be wrong with it...
harlequin565
Posts: 9
Joined: May 17th, 2012, 7:44 am

Re: Journey Map Pin Error

Post by harlequin565 »

gnombat wrote: February 12th, 2021, 11:25 pm Yes, obviously the latest 1.14 version of Wesnoth is the recommended version, but releasing it on 1.12 might be a way to allow people to test it, look at the code, provide feedback, etc. Maybe someone will see something that could help resolve this issue (or other issues).

Right now it's never been released anywhere, so no one has ever seen it (other than the few code snippets you posted above), and it's difficult for anyone to tell whether anything might be wrong with it...
Ah... Well it's unreleasable sadly as it doesn't meet the requirements for the add-on server. It was a little labour of love as well as a challenge to myself to make it.

THanks for your help though.
harlequin565
Posts: 9
Joined: May 17th, 2012, 7:44 am

Re: Journey Map Pin Error

Post by harlequin565 »

Well would you believe it. A good sleep can fix anything...

After putting the code up yesaterday I figured it couldn't be that which was the problem, as the code is extremely simple. When I was CTRL+F'ing through the changelogs I noticed a change to the [story] tags so I copied the layout of [story] from a working campaign.

Code: Select all

[story]
Story goes here
[/story]

{map macro}
And we're in business! I think 1.12 Wesonth is less concerned about the order things are presented in in the scenario.cfg than 1.14. Esp as scenario2 has broken for something else!

Either way, I'm back on my way again, so thanks for all the help.
Post Reply