Failed to load scenario (#@%$!)

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
denispir
Posts: 163
Joined: March 14th, 2013, 12:26 am

Failed to load scenario (#@%$!)

Post by denispir » November 7th, 2019, 1:40 pm

Why do we have as informative error messages as "Failed to load scenario"? Why doesn't or cannot the parser or engine tell us about the anomaly found? Why isn't there more in the log file? (And why is our log file messed with tons of errors from other campaigns?!)
Could we study and document the various cases in which this error (and others) happen? They seem to be typically those kinds of stupid errors, but hard to avoid and even harder to find.

I suspect all this is related to the usage of a preprocessor and to the various identifying data that must match. If I'm right, making a standard folder structure and file naming scheme, and getting of the preprocessor (for file inclusion) should help a lot: there would be a single id for campaigns and scenarios, playing all roles, and no folder or file names at all (except maybe maps).
Could we change the framework to prevent those annoying and depressive "events"?

Now, my case: this should be easy to find, because it is a very simple 1-scenario campaign made to study or try various kinds of things, from Wesnoth features to microAI code. I'm blocked (on this side of dev) for several days already, also because such #@%$! errors get on my nerves, so that I prefere trying to rest my mind or do something else, before retrying to solve it. But in this very case, nothing works.
* Checked innumerable times dirs and files, their existence and pathes.
* No special unit types, nore even units defined apart.
* No custom macros, utils, Lua code...
* No image, portrait, sound or such.
The scenario is in fact self-contained apart from standard macros like {DEFAULT_SCHEDULE}.

What could I do?
(I have already tried to search the forum: much interesting, but no help for me: all issues mentionned are already ok by me, or I am blind.)

PS: I cannot remove much (to try & isolate the source of the bug) since it is really a minimal scenario, and what I could remove should instead trigger real WML errors if it were wrong (I will in fact check that).

PPS: I wonder if my problem may be related to the fact that at times Wesnoth does not seem to re-load, even started from scratch (and noone seems to know why). Possibly I would have corrected the bug but the engine still works on old versions (and erasing the precompiled code or whatnot somehere does not help!).

User avatar
Pentarctagon
Forum Administrator
Posts: 4060
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Failed to load scenario (#@%$!)

Post by Pentarctagon » November 7th, 2019, 1:51 pm

Can you upload your test add-on so that other people can see exactly what's going on?
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: 2244
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Failed to load scenario (#@%$!)

Post by Ravana » November 7th, 2019, 4:33 pm

I would say that using campaign is additional layer of complexity already, just scenario would be enough.

User avatar
octalot
Developer
Posts: 407
Joined: July 17th, 2010, 7:40 pm

Re: Failed to load scenario (#@%$!)

Post by octalot » November 7th, 2019, 5:26 pm

Just a sanity check - do you have the [scenario] tag with the right id= to exactly match the [campaign] tag's first_scenario= ?

Turning on engine logging with --log-debug=engine might help, but there's no log message yet for the specific case of not having a scenario with the right id. That will be fixed in 1.15.3.

denispir
Posts: 163
Joined: March 14th, 2013, 12:26 am

Re: Failed to load scenario (#@%$!)

Post by denispir » November 7th, 2019, 6:53 pm

octalot wrote:
November 7th, 2019, 5:26 pm
Just a sanity check - do you have the [scenario] tag with the right id= to exactly match the [campaign] tag's first_scenario= ?
Yes, I had checked already such things (as said), but another time does not do bad:

Code: Select all

    # in _main.cfg :
    first_scenario = "1_Test_Scenario"
    
    # in 1_Test_Scenario.cfg :
    id = "1_Test_Scenario"
octalot wrote:
November 7th, 2019, 5:26 pm
Turning on engine logging with --log-debug=engine might help, but there's no log message yet for the specific case of not having a scenario with the right id. That will be fixed in 1.15.3.
I will quickly try and see if any helpful info pops out. Thank you!

EDIT: Was pretty quick. The only difference is that I have about 100 lines of info about registered colors, before the 33 lines of warnings and errors about other campaigns I have with wesnoth -d. The 2 last lines of the log are:

Code: Select all

20191107 20:04:17 error display: could not open image 'portraits/humans/transparent/lieutenant.png'
20191107 20:04:36 error general: Failed to load the scenario
The last one is all the info I get about my error. The previous one and all others are about some other UMC (and why doesn't the error tell us about which UMC?).
Last edited by denispir on November 7th, 2019, 7:11 pm, edited 1 time in total.

User avatar
Ravana
Forum Moderator
Posts: 2244
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Failed to load scenario (#@%$!)

Post by Ravana » November 7th, 2019, 7:09 pm

Could verify your scenario is loaded https://wiki.wesnoth.org/PreprocessorRef#.23warning

denispir
Posts: 163
Joined: March 14th, 2013, 12:26 am

Re: Failed to load scenario (#@%$!)

Post by denispir » November 7th, 2019, 7:16 pm

Ravana wrote:
November 7th, 2019, 7:09 pm
Could verify your scenario is loaded https://wiki.wesnoth.org/PreprocessorRef#.23warning
Just tried: it is not, for sure (I wrote a very visible message).

EDIT: Indeed, this is just what the error means.
Last edited by denispir on November 9th, 2019, 9:02 am, edited 1 time in total.

User avatar
Ravana
Forum Moderator
Posts: 2244
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Failed to load scenario (#@%$!)

Post by Ravana » November 7th, 2019, 7:51 pm

That means you dont have the [scenario] in _main.cfg.

denispir
Posts: 163
Joined: March 14th, 2013, 12:26 am

Re: Failed to load scenario (#@%$!)

Post by denispir » November 9th, 2019, 9:04 am

Ravana wrote:
November 7th, 2019, 7:51 pm
That means you dont have the [scenario] in _main.cfg.
Sorry, I don't understand. The [scenario] tag is inside 1_Test_Scenario.cfg, which the error message says is not loaded. What do you mean?

User avatar
Pentarctagon
Forum Administrator
Posts: 4060
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Failed to load scenario (#@%$!)

Post by Pentarctagon » November 9th, 2019, 9:22 am

Again, if you would upload your add-on, it would be easier since we can look at what your entire code is.
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: 2244
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Failed to load scenario (#@%$!)

Post by Ravana » November 9th, 2019, 10:10 am

_main.cfg is the only file wesnoth loads for non-core addons. Preprocessor may insert other files into it, but you have not showed that this is the case.

denispir
Posts: 163
Joined: March 14th, 2013, 12:26 am

Re: Failed to load scenario (#@%$!)

Post by denispir » November 10th, 2019, 8:51 am

Pentarctagon wrote:
November 9th, 2019, 9:22 am
Again, if you would upload your add-on, it would be easier since we can look at what your entire code is.
Sorry, I slipped on your first message because of the reason below, and then forget (I do several things in //).

The reason I did not upload those files immediately is that they are literally saturated with comment because they may play another role, namely that of an example or skeleton for novice campaign authors. But I will do the job of removing all that this morning, and quote you again.

[This may be a solution actually, if also rename all that, then the engine will have to reload all.]

denispir
Posts: 163
Joined: March 14th, 2013, 12:26 am

Re: Failed to load scenario (#@%$!)

Post by denispir » November 10th, 2019, 9:54 am

Pentarctagon wrote:
November 9th, 2019, 9:22 am
Again, if you would upload your add-on, it would be easier since we can look at what your entire code is.
It's crazy. I did it, I mean copy the WML file into another campaign name (just "Test") and erase all comments. Then I tried just for fun, and the new campaign works fine! I have not changed a single line of code!!! (nore preprocessor directives)

But the really crazy thing is that: I thus thought that, as evoked above, the engine for some reason occasionnally fails to really re-load campaign files (even after erasing the whole cache dir). So what I did is simply remove the whole original campaign ("Test Campaing"), restart Wesnoth (the campaign actually disappeared from campaign menu), replace the campaing and retry: the engine still fails to load the scenario... I am pretty bluffed ;-).

So, instead of uploading files stripped of comment, I need to upload the original ones (if you have comments about comments... ;-)). See files attached.
Attachments
1_Test_Scenario.cfg
(9.21 KiB) Downloaded 7 times
_main.cfg
(7.92 KiB) Downloaded 11 times

denispir
Posts: 163
Joined: March 14th, 2013, 12:26 am

Re: Failed to load scenario (#@%$!)

Post by denispir » November 10th, 2019, 10:26 am

denispir wrote:
November 10th, 2019, 9:54 am
Pentarctagon wrote:
November 9th, 2019, 9:22 am
Again, if you would upload your add-on, it would be easier since we can look at what your entire code is.
It's crazy. I did it, I mean copy the WML file into another campaign name (just "Test") and erase all comments. Then I tried just for fun, and the new campaign works fine! I have not changed a single line of code!!! (nore preprocessor directives)

But the really crazy thing is that: I thus thought that, as evoked above, the engine for some reason occasionnally fails to really re-load campaign files (even after erasing the whole cache dir). So what I did is simply remove the whole original campaign ("Test Campaing"), restart Wesnoth (the campaign actually disappeared from campaign menu), replace the campaing and retry: the engine still fails to load the scenario... I am pretty bluffed...

So, instead of uploading files stripped of comment, I need to upload the original ones (if you have comments about my comments...). See files attached.
EDIT: Now, it works. I just stopped for a while, went out to buy a little bier, came back and now it works !!! It's not only the world of Wesnoth that contains mysterious magic ;-). But it's pretty annoying blockage that lets us totally helpless. I have had similar problems, and mysterious disparition of the problems, 3 times now.
By the way, I think my original error, the only one found and corrected days ago, was about having changed the preprocessor flag for my campaign being played (CAMPAIGN => TEST_CAMPAIGN) in only one place in _main. So, indeed the scenario file could not be found... then.

User avatar
Pentarctagon
Forum Administrator
Posts: 4060
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Failed to load scenario (#@%$!)

Post by Pentarctagon » November 10th, 2019, 2:25 pm

Note also that in the scenario file, #idfef and #enddif are not valid preprocessor directives.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

Post Reply