[event] is missing name or id field : how to trace

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
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

[event] is missing name or id field : how to trace

Post by Spannerbag »

Hiya,
Being driven mad by a new bug :annoyed:

Version: 1.16.1 x86_64

After adding a fair chunk of new code I decided to playtest from the start again (new campaign).
I had not changed scenarios 1 or 2, made minor changes to scenario 3, added lots of macro code and done stuff in the later scenarios.

The campaign (i.e. scenario 1) begins with a brief 2 part [story] and on part 2 (or sometimes later) I get an on-screen message: event is missing name or id field

So I've gone through all the scenarios, unittypes and macros and all events have names.
All fire_events also have names and all remove_events specify ids.

_main.cfg does contain some global events but by putting message statements in _main.cfg the error occurs after them.
(They shouldn't fire early on anyway, they are mainly last breath and post advance events).

So it must be when the engine loads macros, scenarios etc., which I have already checked :?
I'm guessing there must be a macro somewhere missing something (but I do not get any preprocessor errors).
The logfile is not very helpful, I seem to get 2 errors running together?

error wml: [event] is missing name or id fieldlibpng warning: iCCP: known incorrect sRGB profile

I could simply playtest until something that should happen doesn't, but there are loads of pathways to test and it could take ages.

I've also tried purging the cache and rebooting, without success.

So, does anyone have any suggestions on how to track the little blighter down?

Cheers!
--Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Pentarctagon
Project Manager
Posts: 5564
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: [event] is missing name or id field : how to trace

Post by Pentarctagon »

If the [event] has no name or id field, then there would be no way for it to be executed, so you wouldn't see any sort of debug statements printed either.

You could try finding your add-on's cache file, open it, and see if you can find any [event] tags with no name or id field.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [event] is missing name or id field : how to trace

Post by Ravana »

Should be easier to start from savefile instead of cache.
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: [event] is missing name or id field : how to trace

Post by octalot »

I have a vague recollection of assigning a bug to myself to improve that error message, but eventually finding it would need too big a change to get useful information available in the log. If you're familiar with C++ too, I'd suggest breakpointing that log statement and walking up the stack.

wmllint might be able to find it, but if you're unfamiliar with that tool be sure to use its --dryrun option.
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: [event] is missing name or id field : how to trace

Post by Elvish_Hunter »

octalot wrote: April 9th, 2022, 11:49 am wmllint might be able to find it, but if you're unfamiliar with that tool be sure to use its --dryrun option.
Currently there's no such check implemented in wmllint, so running it won't be useful in this situation.
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)
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [event] is missing name or id field : Update

Post by Spannerbag »

Many thanks to all who replied, much appreciated - but I'm still stuck :annoyed:

Went through the uncompressed save and everything looked fine.

In _main.cfg immediately before [/campaign] I added both preload and prestart events each with a message.

Result ("OK" means error not on-screen)

story page 1 OK
story page 2 OK
preload exiting campaign tag (_main.cfg) OK
prestart exiting campaign tag (_main.cfg) OK (screen grab below)
exit_campaign.png
first scenario prestart message on screen (screen grab below)
scenario_1_prestart.png
This seems to indicate to me that the error occurs when loading macro and/or scenario files?
I'd guess the former because story was on-screen before error displayed so scenario had, at least partially, loaded?


Soo... I reviewed my most recent changes (again) and removed the last item I added. No change :(

As a sanity check started mainline A Tale of Two Brothers which worked fine (phew).

Then in first scenario set next_scenario=null and renamed all subsequent scenarios from .cfg to .txt . No change :(

I'm running out of places to look :augh:
All I can think of is to systematically remove individual .cfg files from utils until one (hopefully) proves to be the source of the error.
However this could be a fiddly and rather time-consuming sub-project so I was wondering are there any (Windows 7) commandline options that might help?
(E.g. extra_logging for example).

Running version 1.16.1 x86_64

Any thoughts/comments would be really great!

Cheers,
--Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2361
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: [event] is missing name or id field : how to trace

Post by Lord-Knightmare »

This error/warning message is rather troublesome as its cause is difficult to discern.
I have this ported "Dwarven Campaign" in my addons folder and it throws the same bug. It's rather simplistic but it threw the warning anyways. Thus, I tried checking to see what was causing it.
The first scenario threw the warning/error however the thing is...it only has 2 events...a "start" event and a "turn 1". Both of which seem fine as it is. Still the error shows. Added ids to them and still...

One silver-lining is that it's not gamebreaking.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: [event] is missing name or id field : how to trace

Post by octalot »

Thought of a simpler way to log it - dumping the contents (whatever is between the [event]...[/event] tags) is easy: #6619

That needs a local C++ build to use right now, but it may well be in the release build for 1.16.3.
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [event] is missing name or id field : FIXED (whoo-hoo!)

Post by Spannerbag »

Thanks for all your help, I've managed to locate and fix the issue.

I removed ALL the macro files (even ones without events) and then hacked the scenario code to make it work.
The error went away, so it was in a macro file.

Next I spent some time putting back the files one by one.

The fault lay with one of my sound macros.
I used a custom macro to play music at scenario start (when story is on-screen) then continue the music (without a break) when gameplay begins.
I use this quite a lot and can't seem to get exactly this behaviour from the standard macros?

Anyway, I'd used EXTRA_SCENARIO_MUSIC which begins with [+event] but there was no preceding event in the scenario.
When I used APPEND_MUSIC everything worked fine.

Really glad to hunt it down :D

Cheers!
--Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2361
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: [event] is missing name or id field : how to trace

Post by Lord-Knightmare »

Anyway, I'd used EXTRA_SCENARIO_MUSIC which begins with [+event] but there was no preceding event in the scenario.
When I used APPEND_MUSIC everything worked fine.
Interesting Troubleshooting note. Need to note this down if I encounter it myself.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [event] is missing name or id field : how to trace

Post by Spannerbag »

Lord-Knightmare wrote: April 9th, 2022, 5:49 pm
Anyway, I'd used EXTRA_SCENARIO_MUSIC which begins with [+event] but there was no preceding event in the scenario.
When I used APPEND_MUSIC everything worked fine.
Interesting Troubleshooting note. Need to note this down if I encounter it myself.
Secondary gotchas:

a) I thought I'd tested that sound macro already.
Presumably I made the change then didn't test from the start so the code never executed (it was in the very first scenario).

b) it was lifted from another work in progress where it works fine. (Best check that too).

No doubt I'll have forgotten all this next time something weird crops up...

Cheers!
--Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: [event] is missing name or id field : how to trace

Post by octalot »

Added in 1.16.3 and 1.17.4: the command-line option --log-debug=wml will make Wesnoth print the contents of the [event] tag.
User avatar
Spannerbag
Posts: 535
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: [event] is missing name or id field : how to trace

Post by Spannerbag »

octalot wrote: April 21st, 2022, 1:35 pm Added in 1.16.3 and 1.17.4: the command-line option --log-debug=wml will make Wesnoth print the contents of the [event] tag.
Thanks!
Just hope I remember it's there if/when I need it :)

Cheers!
--Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
Post Reply