jensbuehl / aoe4-guides

Source code for aoe4guides.com: Yet another Age of Empires IV build order tool
https://aoe4guides.com
MIT License
17 stars 6 forks source link

Overlay tool export should replace \n by "," #76

Closed CraftySalamander closed 10 months ago

CraftySalamander commented 10 months ago

When clicking on the 'Overlay Tool' export button (for instance on this BO), the "notes" have several \n characters, which do not work well with the Overlay formatting (for both RTS Overlay and AoE4 Overlay).

These \n in "notes" should be replaced by ",". When I do this in a text editor (only on the "notes") before pasting the BOs in the Overlay, everything works as expected.

jensbuehl commented 10 months ago

Thanks for the hin. I'll take a look

jensbuehl commented 10 months ago

What do you mean by not working well? Overlay seems fine here with multi-line. image

I could change it, but don't you think this is a downgrade for long step descriptions? image

CraftySalamander commented 10 months ago

If I take the BO I mentioned at the beggining, I get this image

If I replace

"notes": [
            "5 @unit_worker/villager.png@ builds @building_economy/mill.png@ at berries (for oil)\n1 @unit_worker/villager.png@ build @building_byzantines/cistern-1.png@ (near @resource/resource_gold.png@@resource/berrybush.png@) then @resource/berrybush.png@"
         ]

by

"notes": [
            "5 @unit_worker/villager.png@ builds @building_economy/mill.png@ at berries (for oil)","1 @unit_worker/villager.png@ build @building_byzantines/cistern-1.png@ (near @resource/resource_gold.png@@resource/berrybush.png@) then @resource/berrybush.png@"
         ]

I get this image

I have the impression that the Qt library (used by AoE4 Overlay) does not work well with the \n

CraftySalamander commented 10 months ago

I replicated your example, and it works well because there is no image image

But it still works if you replace

"notes": [
            "Zeile 1\nZeile 2"
         ]

by

 "notes": [
            "Zeile 1","Zeile 2"
         ]

image

I think you just replaced \n by ,, but you should use "," (which will add a new entry in the notes table.

jensbuehl commented 10 months ago

Ah I see! You are parsing for "," and adding a new line then. This works as expected. Will push soonish.

Still, it is super weird, sinde this BO works perfectly fine with \n https://aoe4guides.com/builds/mU8Wi3QJQIEco2kkki9x

CraftySalamander commented 10 months ago

The Delhi BO you just mentioned already uses the correct formating (\n only present in "description", but this has no impact on the Overlay):

"notes": [
            "5 @unit_worker/villager-delhi.png@>@resource/gaiatreeprototypetree.png@ (until 100@resource/resource_wood.png@), then to@resource/berrybush.png@",
            "1 @unit_worker/villager-delhi.png@builds@building_economy/house.png@+@building_economy/mill.png@",
            "1 @unit_worker/villager-delhi.png@builds@building_religious/mosque.png@+@building_economy/lumber-camp.png@",
            "3 @unit_worker/villager-delhi.png@>@resource/resource_gold.png@",
            "@resource/rally.png@@resource/resource_food.png@ until ready for @age/age_2.png@",
            "@technology_economy/forestry.png@+@technology_economy/wheelbarrow.png@+@technology_delhi/efficient-production.png@+@technology_religious/piety.png@",
            ""

However, I do not know why this BO has the correct one, but not the new Byzantine BO.

jensbuehl commented 10 months ago

Ah, got it. In the past I used <br> as linebreak which is already converted correctly. Will take care of \n as well, then.

jensbuehl commented 10 months ago

Fixed in v1.6.4 with 46eccc4 (along with resized images to save quite some hosting traffic, you can find the original sized imaged for future reference here: https://github.com/jensbuehl/aoe4-guides/tree/main/src/assets/pictures_original_size)

CraftySalamander commented 10 months ago

Great, thank you.