[event] is missing name or id field : how to trace
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.
- Spannerbag
- Posts: 535
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
[event] is missing name or id field : how to trace
Hiya,
Being driven mad by a new bug
Version:
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
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.
(They shouldn't fire early on anyway, they are mainly
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?
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
Being driven mad by a new bug
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
- 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
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.
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
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: [event] is missing name or id field : how to trace
Should be easier to start from savefile instead of cache.
Re: [event] is missing name or id field : how to trace
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
wmllint might be able to find it, but if you're unfamiliar with that tool be sure to use its
--dryrun
option.- 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
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)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
- Spannerbag
- Posts: 535
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: [event] is missing name or id field : Update
Many thanks to all who replied, much appreciated - but I'm still stuck
Went through the uncompressed save and everything looked fine.
In
Result ("OK" means error not on-screen)
first
This seems to indicate to me that the error occurs when loading macro and/or scenario files?
I'd guess the former because
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
I'm running out of places to look
All I can think of is to systematically remove individual
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.
Running version 1.16.1 x86_64
Any thoughts/comments would be really great!
Cheers,
--Spannerbag
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 OKstory
page 2 OKpreload
exiting campaign tag (_main.cfg
) OKprestart
exiting campaign tag (_main.cfg
) OK (screen grab below)first
scenario
prestart
message on screen (screen grab below)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
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
- 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
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.
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
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Re: [event] is missing name or id field : how to trace
Thought of a simpler way to log it - dumping the contents (whatever is between the
That needs a local C++ build to use right now, but it may well be in the release build for 1.16.3.
[event]...[/event]
tags) is easy: #6619That needs a local C++ build to use right now, but it may well be in the release build for 1.16.3.
- Spannerbag
- Posts: 535
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: [event] is missing name or id field : FIXED (whoo-hoo!)
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
I use this quite a lot and can't seem to get exactly this behaviour from the standard macros?
Anyway, I'd used
When I used
Really glad to hunt it down
Cheers!
--Spannerbag
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
Cheers!
--Spannerbag
- 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
Interesting Troubleshooting note. Need to note this down if I encounter it myself.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.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
- Spannerbag
- Posts: 535
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: [event] is missing name or id field : how to trace
Secondary gotchas:Lord-Knightmare wrote: ↑April 9th, 2022, 5:49 pmInteresting Troubleshooting note. Need to note this down if I encounter it myself.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.
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
Re: [event] is missing name or id field : how to trace
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.- Spannerbag
- Posts: 535
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: [event] is missing name or id field : how to trace
Thanks!
Just hope I remember it's there if/when I need it
Cheers!
--Spannerbag