"Macro/file . . . is missing"

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.
stegyre
Posts: 53
Joined: August 18th, 2008, 4:35 pm

"Macro/file . . . is missing"

Post by stegyre »

Me again. I expect I've messed up something very basic, but I'm flummoxed.

I am trying to create a very simple era. I slavishly copied and then cut down from another era I have, which itself is a slavish copy-and-edit of "A New Land Era." (That one works.)

Each time I try to load, I get the following error:
Macro/file '\f0\fnil\charset0' is missing
at ~add-ons\\Sif_Era\\_main.cfg:1
Here's the entire _main.cfg (It isn't so very long.)

Code: Select all

#textdomain wesnoth-Sif_Era
 
[textdomain]
    name="wesnoth-Sif_Era"
    path="data/add-ons/Sif_Era/translations"
[/textdomain]
 
#ifdef MULTIPLAYER
[binary_path]
    path=data/add-ons/Sif_Era/
[/binary_path]
 
{~add-ons/Sif_Era/era}
{~add-ons/Sif_Era/factions}
{~add-ons/Sif_Era/images}
{~add-ons/Sif_Era/macros}
{~add-ons/Sif_Era/units}
 
[+units]
    {~add-ons/Sif_Era/units}
    {~add-ons/Sif_Era/units/drach}
    {~add-ons/Sif_Era/units/fee}
    {~add-ons/Sif_Era/units/fisch}
    {~add-ons/Sif_Era/units/klein}
    {~add-ons/Sif_Era/units/machine}
    {~add-ons/Sif_Era/units/mensch}
    {~add-ons/Sif_Era/units/tier}
[/units]
#endif
 
#ifdef EDITOR
# I believe this section is necessary for single player campaigns.
[binary_path]
    path=data/add-ons/Sif_Era/
[/binary_path]
 
{~add-ons/Sif_Era/era/}
{~add-ons/Sif_Era/factions/}
{~add-ons/Sif_Era/images/}
{~add-ons/Sif_Era/macros/}
{~add-ons/Sif_Era/units/}
 
[+units]
    {~add-ons/Sif_Era/units/}
    {~add-ons/Sif_Era/units/drach}
    {~add-ons/Sif_Era/units/fee}
    {~add-ons/Sif_Era/units/fisch}
    {~add-ons/Sif_Era/units/klein}
    {~add-ons/Sif_Era/units/machine}
    {~add-ons/Sif_Era/units/mensch}
    {~add-ons/Sif_Era/units/tier}
[/units]
#endif
 
#credits: Ruffian icon and portraits from core.
BfW version is 1.12.5.
_main.cfg was prepared using Microsoft's WordPad (which I've safely and consistently used with all of my other BfW editing).

Puzzled. :oops:
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: "Macro/file . . . is missing"

Post by The_Gnat »

Hi stegyre, this is a odd error! It doesnt seem to reference anything from your era :hmm: I have created many eras and never had this problem...

Are you sure the problem is with your era? Try removing your addon and then running wesnoth and see if you still get the error!

Hopefully you are able to find a solution! !

EDIT: Also instead of doing two sections #ifdef MULTIPLAYER and #ifdef EDITOR just put everything without any #ifdef that way it always loads and you dont have to write it twice
stegyre
Posts: 53
Joined: August 18th, 2008, 4:35 pm

Re: "Macro/file . . . is missing"

Post by stegyre »

Thanks for the tip. For the record, I appreciate all feedback.

I think my WordPad file may have been corrupted. By copying my working _main.cfg (from SANLEra) and then copy-pasting everything from my original _main.cfg (Sif_Era) into that one and making it the new Sif_Era _main.cfg, I eliminated that era (and moved on to other errors, which I am working through).

EDIT: Okay! I have an exceedingly-rudimentary but working Era, now. Time to start messing around and create a whole new set of errors.

For the record, I think the error I was getting is some sort of corruption in the WordPad file. (MS WordPad, Windows 10.) I lack the ability to verify that, but the work-around – copying a WordPad file from a working era and then pasting my text into it – seems to work, after having implemented it three different times on three different files. (Maybe that info will be useful to someone else; maybe not.)
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: "Macro/file . . . is missing"

Post by The_Gnat »

stegyre wrote:Thanks for the tip. For the record, I appreciate all feedback.

I think my WordPad file may have been corrupted. By copying my working _main.cfg (from SANLEra) and then copy-pasting everything from my original _main.cfg (Sif_Era) into that one and making it the new Sif_Era _main.cfg, I eliminated that era (and moved on to other errors, which I am working through).

EDIT: Okay! I have an exceedingly-rudimentary but working Era, now. Time to start messing around and create a whole new set of errors.

For the record, I think the error I was getting is some sort of corruption in the WordPad file. (MS WordPad, Windows 10.) I lack the ability to verify that, but the work-around – copying a WordPad file from a working era and then pasting my text into it – seems to work, after having implemented it three different times on three different files. (Maybe that info will be useful to someone else; maybe not.)
I'm glad you were able to solve your problem!! :D Also for editing i usually use notepad, and haven't had any problems.
stegyre
Posts: 53
Joined: August 18th, 2008, 4:35 pm

Re: "Macro/file . . . is missing"

Post by stegyre »

My issue with Notepad is that it does not display line breaks and indentations. I'd open a file in Notepad and find it impossible to read. I was delighted to find WordPad fixed this.
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: "Macro/file . . . is missing"

Post by The_Gnat »

stegyre wrote:My issue with Notepad is that it does not display line breaks and indentations. I'd open a file in Notepad and find it impossible to read. I was delighted to find WordPad fixed this.
Yeah i have the exact same problem, it really makes it impossible to read :P But what i do is open the file in wordpad and just hit the save button. After it is saved using wordpad when i open it in notepad it is formatted correctly. Alternatively for some files where that doesn't work i just select all of the text in wordpad and paste it into notepad. :D
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: "Macro/file . . . is missing"

Post by Ravana »

For windows I suggest using notepad++.
stegyre
Posts: 53
Joined: August 18th, 2008, 4:35 pm

Re: "Macro/file . . . is missing"

Post by stegyre »

New problem: I'm creating a series of AMLA choices, and I cannot get the images to display. Everything else about the advancements appears to be working properly. This is purely a cosmetic issue, but it highlights my lack of understanding. The icons I am using have been copied over from core into my own ~images/icons folder. (I like to have my content "on board" as much as possible.) When the table comes up for advancing a unit, however, the game shows the "Image not found" icon for the first option and the unit's own icon for the second. (The icons are supposed to be the boots_elven.png and steel_armor.png.)

Here's the relevant code. (I've put them into macros.) Let me know if you need to see more:

Code: Select all

#define FASTER
    id=faster
    always_display=true
    image=~icons/boots_elven.png
    description= _ "Gain an additional move point."
 ***
#enddef

#define ARMORED
    id=armored
    always_display=true
    image=~icons/steel_armor.png
    description= _ "Equip plate mail, increasing all resistances but reducing movement."

***
#enddef
For what it's worth, I've tried all variations of with and without the tilde (~) and with or without quotation marks (e.g., image="icons/boots_elven.png"), as I seem to see examples of both in other's work.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: "Macro/file . . . is missing"

Post by zookeeper »

I also suggest Notepad++. You can use WordPad or similar, but you always have to make sure that you're really saving as a plaintext document or else you run into the above issues.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: "Macro/file . . . is missing"

Post by zookeeper »

stegyre wrote:For what it's worth, I've tried all variations of with and without the tilde (~) and with or without quotation marks (e.g., image="icons/boots_elven.png"), as I seem to see examples of both in other's work.
Doesn't sound possible; even if you don't have a [binary_path] (the kind every add-on with custom images/sounds/music needs) to help the game find your version of the image, then image="icons/boots_elven.png" is still the correct path to the core version of that image and thus you should see that in-game. Remember that you can't just load an existing save and have all kinds of changes to your WML automatically take effect in them; for example if you have a unit with those AMLAs, then existing units in existing saves still have the old version of the AMLA options within them and your updated code will only be seen in newly created units.

Also, distrust any code where you've seen ~ used in an image path like ~icons/steel_armor.png because that just simply doesn't make any sense.
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: "Macro/file . . . is missing"

Post by The_Gnat »

stegyre wrote:For what it's worth, I've tried all variations of with and without the tilde (~) and with or without quotation marks (e.g., image="icons/boots_elven.png"), as I seem to see examples of both in other's work.
Hmm... Thats odd image=icons/boots_elven.png always works for me. Maybe your images aren't being loaded correctly? For example i have a add-on that uses:

Code: Select all

    [advancement]
        id=WoseAd1
        max_times=4
        description= _ "A stronger  Wose"
        image=attacks/crush-wose.png
        [effect]
            apply_to=attack
            range=melee
            increase_damage=1
        [/effect]
        [effect]
            apply_to=max_experience
            increase=5
        [/effect]
        [effect]
            apply_to=hitpoints
            increase_total=5
            heal_full=yes
        [/effect]
    [/advancement]
And this works perfectly... :hmm: So i am thinking your images must not be loading correctly. Also try naming them different names from the default icons so they don't overlap, and you can tell if they're actually loading! :D Are you trying out your modification in multiplayer or campaign?

Like zookeeper says i dont see why your images arent loading!
stegyre
Posts: 53
Joined: August 18th, 2008, 4:35 pm

Re: "Macro/file . . . is missing"

Post by stegyre »

Still working on this. Thanks for the comments.
zookeeper wrote:Doesn't sound possible; even if you don't have a [binary_path] (the kind every add-on with custom images/sounds/music needs) to help the game find your version of the image, then image="icons/boots_elven.png" is still the correct path to the core version of that image and thus you should see that in-game.
I do have the [binary_path] coding in my _main.cfg, and it (otherwise) appears to work properly (i.e., the other things I've included, such as Sif_Era.cfg, are loading properly - as nearly as I can tell). For reference, here's my relevant code:

Code: Select all

[binary_path]
    path=data/add-ons/Sif_Era/
[/binary_path]

{~add-ons/Sif_Era/Sif_Era.cfg}
{~add-ons/Sif_Era/era}
{~add-ons/Sif_Era/factions}
{~add-ons/Sif_Era/images}
{~add-ons/Sif_Era/macros}
{~add-ons/Sif_Era/units}
Remember that you can't just load an existing save and have all kinds of changes to your WML automatically take effect in them; for example if you have a unit with those AMLAs, then existing units in existing saves still have the old version of the AMLA options within them and your updated code will only be seen in newly created units.
Between each change, I exit all the way out of Wesnoth and restart. In fact, as WordPad won't let me save changes while the game is running, I'm forced to do so. Also, each time I start a new MP scenario.
Spoiler:
Also, distrust any code where you've seen ~ used in an image path like ~icons/steel_armor.png because that just simply doesn't make any sense.
This gives me pause, because the tilde is used in the code I've quoted above, where it seems to work as I thought it was supposed to. That is, the tilde means "take everything from the current (or default) directory[ies] and add this additional path." So image=~icons/icon_name.png would mean, "find the 'icons' folder in the 'images' directory where you already look by default for any image; you will find icon_name.png there." What is it I am misunderstanding? :hmm:

Assuming that my images aren't loading, how would I check this?
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: "Macro/file . . . is missing"

Post by The_Gnat »

stegyre wrote: This gives me pause, because the tilde is used in the code I've quoted above, where it seems to work as I thought it was supposed to. That is, the tilde means "take everything from the current (or default) directory[ies] and add this additional path." So image=~icons/icon_name.png would mean, "find the 'icons' folder in the 'images' directory where you already look by default for any image; you will find icon_name.png there." What is it I am misunderstanding? :hmm:

Assuming that my images aren't loading, how would I check this?
The best way to solve problems like this is to systematically narrow them down. First isolate the problem.

Change a unit and see if his image is loading-> if it isn't you know you problem is images loading. -> if it is loading then try changing his image to be the icon you want in your game. -> if that works then you know it must be your AMLA that isn;t working

Continue doing this until you know exactly what the problem iss!! :D

Otherwise, since It is very hard to tell what your problem is without seeing your add-on, if you want you can upload it and attach it as a archive (i recommend using 7zip). Then i can have a look and see what exactly is not working.

Hopefully this helps!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: "Macro/file . . . is missing"

Post by zookeeper »

stegyre wrote:
Also, distrust any code where you've seen ~ used in an image path like ~icons/steel_armor.png because that just simply doesn't make any sense.
This gives me pause, because the tilde is used in the code I've quoted above, where it seems to work as I thought it was supposed to. That is, the tilde means "take everything from the current (or default) directory[ies] and add this additional path." So image=~icons/icon_name.png would mean, "find the 'icons' folder in the 'images' directory where you already look by default for any image; you will find icon_name.png there." What is it I am misunderstanding? :hmm:
The tilde simply doesn't do anything. If it seems to work for you, then that's simply because the game silently ignores it (I'd be surprised if it did, though).

What image=icons/icon_name.png means is "try to find images/icons/icon_name.png in any and all directories which have been [binary_path]ed (+the core image directories)". That's how all image/sound/music file references work.
stegyre
Posts: 53
Joined: August 18th, 2008, 4:35 pm

Re: "Macro/file . . . is missing"

Post by stegyre »

Sooooooo, want to hear a funny story? Turns out, when they say, "Unit IDs must be unique," they really, really mean it. Turns out the problem was all of my own making, in a way that no one (without access to my own BfW files) would be able figure out.

On the plus side, I have learned from the responses. First prize goes to Zookeeper: the tilde, indeed, should not be used. Once I had corrected the real problem (spoilered for length), the tilde kept the game from finding the images. Tilde removed, problem fixed.
Spoiler:
Watch this space! I'm sure my next mistake is just around the corner. :whistle:

Thanks for the help, guys. Turns out even an answer like, "No, we really cannot see anything wrong with this code," helps.
Post Reply