Now THIS is funny

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
malthaussen
Posts: 36
Joined: April 6th, 2024, 11:05 pm

Now THIS is funny

Post by malthaussen »

To no surprise of mine, when I tried to start my campaign from the "campaign" menu, it returned a very verbose error message. So verbose, I wanted to take a screenshot so I wouldn't get it wrong.

There is no default hot key for a screenshot, so I went into Preferences and assigned f12 to the job. I made no changes to the campaign's .cfg file, or indeed any changes at all but this.

Now, when I try to start the campaign, I don't get the error message, instead just a very unhelpful "failed to load the scenario" message. (Which, incidentally, is ambiguous in this context: it should say "failed to load the campaign," otherwise one might think the campaign loads okay, but the first scenario does not).

So, from memory, because I no longer get the error message, it was something of this ilk: "Error in user/Eric/Documents/my games/Wesnoth 1.18/data/add-ons/3rd Army/Main.cfg line 30

macro {~add-ons/3rd \Army/scenarios} missing"

Now, that "\" in the macro is interesting, as one can see from my code that it is not present, in fact the macro is the same used by just about every other .cfg file I've looked at.

Code: Select all

#Config file for 3rd Army Campaign
#By EMH, April 2024

#textdomain wesnoth-3rd_Army
[textdomain]
	name="wesnoth-3rd_army"
	path="data/add-ons/3rd_Army/translations"
[/textdomain]
[campaign]
	
	id=3rd_Army
	name= _ "3rd Army"
	abbrev= _ "3rdA"
	define="CAMPAIGN_3RD_ARMY"
	icon="units/human-loyalists/dragoon/dragoon.png~RC(magenta>red)"
	image="data/add-ons/3rd_Army/images/campaign_image.jpg"
	first_scenario="01_First_Contact"
	description= _ "Trials and tribulations of the 3rd Army in the Great Midgard War"
	{CAMPAIGN_DIFFICULTY EASY "units/human-loyalists/horseman/horseman.png~RC(magenta>red)" ( _ "Recruit") ( _ "Beginner")} {DEFAULT_DIFFICULTY}
	{CAMPAIGN_DIFFICULTY NORMAL "units/human-loyalists/longbowman.png~RC(magenta>blue)" _"Veteran" _"Intermediate"}
    {CAMPAIGN_DIFFICULTY HARD "units/human-loyalists/masterbowman.png~RC(magenta>blue)" _"Commander" _"Hard"}
[/campaign]

#ifdef CAMPAIGN_3RD_ARMY

	[binary_path]
		path=data/add-ons/3rd_Army
	[/binary_path]
	
	{~add-ons/3rd_Army/scenarios}
	
	
#endif
While the circumstances of the error are funny (come on, admit it, adding a hotkey for screenshots should not alter the program in any way), the error is annoying.
Also strange is that the "image" does not show up on the campaign's load screen. Since that also requires the path "data/add-ons/3rd_Army."

Incidentally, I removed the f12 for the screenshot, but I'm still just getting a blunt "failed to load the scenario."

Just about at my wit's end, which is not unexpected, because I'm not very witty.

-- Mal
"Of two choices, I always take the third."
User avatar
Spannerbag
Posts: 538
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Now THIS is funny

Post by Spannerbag »

A couple of quick things you might try:
  • See if there's anything helpful in the logfile.
  • Purge the cache (main menu->preferences->cache) and try again, the error might re-appear (and also be in the logfile which saves faffing around with screen grabs if you're lucky).
Sorry if this is bit terse, was about to sign off and have a break, just spent ages trying to get some lua to work and it won't. :annoyed:
Asked for help and am going to calm 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
Ravana
Forum Moderator
Posts: 3018
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Now THIS is funny

Post by Ravana »

Once wesnoth knows your addon is invalid it does not bother looking again. You can use f5 to let it try again. Some kinds of errors also require manually deleting cache files.
User avatar
Straff
Posts: 87
Joined: September 27th, 2020, 2:53 pm

Re: Now THIS is funny

Post by Straff »

Line 20 and 21, there are no parentheses around (_"Veteran") and ( _"Intermediate") and (_"Commander") and ( _"Hard")
User avatar
malthaussen
Posts: 36
Joined: April 6th, 2024, 11:05 pm

Re: Now THIS is funny

Post by malthaussen »

@straff: you're quite right. I copy/pasted those arguments from a working .cfg. from somebody else's scenario.

-- Mal
"Of two choices, I always take the third."
User avatar
malthaussen
Posts: 36
Joined: April 6th, 2024, 11:05 pm

Re: Now THIS is funny

Post by malthaussen »

So, at spannerbag's suggestion, I checked the log:

Battle for Wesnoth v1.18.0 x86_64
Started on Thu Apr 11 17:35:45 2024

Automatically found a possible data directory at: C:\Wesnoth

Data directory: C:\Wesnoth
User configuration directory: C:\Users\USER\Documents\My Games\Wesnoth1.18
User data directory: C:\Users\USER\Documents\My Games\Wesnoth1.18
Cache directory: C:\Users\USER\Documents\My Games\Wesnoth1.18\cache


Setting mode to 1280x800
20240411 17:35:47 warning general: no location found for 'data/add-ons/3rd_Army/translations', skipping textdomain
Checking lua scripts... ok
20240411 17:35:51 error image: could not open image 'data/add-ons/3rd_Army/images/campaign_image.jpg'
20240411 17:36:03 error preprocessor: Macro/file '~add-ons/3rd_Army/scenarios' is missing
at ~add-ons/3rd\ Army/_main.cfg:30
20240411 17:36:03 error config: preprocessor config error reading usermade add-on 'C:\Users\USER\Documents\My Games\Wesnoth1.18/data/add-ons/3rd Army/_main.cfg'
20240411 17:36:03 error config: Macro/file '~add-ons/3rd_Army/scenarios' is missing
at ~add-ons/3rd\ Army/_main.cfg:30
20240411 17:37:21 error engine: Unable to find config for content 01_First_Contact of type scenario
20240411 17:37:21 error engine: Unable to find config for content 3rd_Army of type campaign
20240411 17:37:21 error engine: Couldn't find [scenario] with id=01_First_Contact
20240411 17:37:21 error general: Failed to load the scenario

From this log, it appears that the game can't find the data folder in "C:\Users\USER\Documents\My Games\Wesnoth1.18" and therefore cannot find anything located in the campaign's folder. The question would be "why?" This is the way the game set up the paths. From "`Wesnoth 1.18" it should proceed to "data/add-ons/3rd Army."
And why the extraneous "\" in the error message for the Line 30 "error?"

... anyway, on a hunch, I removed all the understrokes separating words in the arguments in the .cfg file, even though every other .cfg file I've seen uses them. And et viola (sort of), the error log is now very different:

Battle for Wesnoth v1.18.0 x86_64
Started on Thu Apr 11 19:06:27 2024

Automatically found a possible data directory at: C:\Wesnoth

Data directory: C:\Wesnoth
User configuration directory: C:\Users\USER\Documents\My Games\Wesnoth1.18
User data directory: C:\Users\USER\Documents\My Games\Wesnoth1.18
Cache directory: C:\Users\USER\Documents\My Games\Wesnoth1.18\cache


Setting mode to 1280x800
Checking lua scripts... ok

And it can find the campaign_image. It still "failed to load the scenario," but it at least looks like the campaign .cfg works, but the scenario .cfg is broken. This is progress, of a sort.

One wonders why campaign .cfgs that contain all those understrokes I removed work just fine, though.

I've been a programmer for nigh unto 50 years, and some of these errors are just weird. I mean, let's face it, if you're stealing somebody's working code for your own program, it ought to work, n'est ce pas?

-- Mal
"Of two choices, I always take the third."
gnombat
Posts: 710
Joined: June 10th, 2010, 8:49 pm

Re: Now THIS is funny

Post by gnombat »

Do you have an actual space in your folder name? I.e., 3rd Army? You should rename it and replace the space with an underscore, i.e., 3rd_Army.
malthaussen wrote: April 11th, 2024, 11:18 pm One wonders why campaign .cfgs that contain all those understrokes I removed work just fine, though.
The underscore character should work fine, but spaces will probably cause weird errors.
User avatar
malthaussen
Posts: 36
Joined: April 6th, 2024, 11:05 pm

Re: Now THIS is funny

Post by malthaussen »

@gnombat: Now that you mention it, I do see that every friggin' campaign folder name uses underscores, so yeah, I think I'll just do as you suggest.

Who knows, maybe the horse will learn to sing yet.

And... mirabile dictu, the #&$@ loads and runs now. Which means I owe you another beer.

-- Mal
"Of two choices, I always take the third."
User avatar
Atreides
Posts: 1076
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Re: Now THIS is funny

Post by Atreides »

malthaussen wrote: April 11th, 2024, 11:18 pm I've been a programmer for nigh unto 50 years, and some of these errors are just weird. I mean, let's face it, if you're stealing somebody's working code for your own program, it ought to work, n'est ce pas?

-- Mal
Shoot. If that's true you're likely older than me even. 8- > I took my first FORTRAN class in high school. 1980. We used punch cards (but filled them in with pencil instead) and the teach drove them off to Waterloo to run them at the Uni mainframe there. Got back printouts.
User avatar
malthaussen
Posts: 36
Joined: April 6th, 2024, 11:05 pm

Re: Now THIS is funny

Post by malthaussen »

I was 17 when I first tried to persuade a computer to do what I wanted. It was a FACIT computer with 1k of memory, programmed in machine code (naturally). I failed, and it's been downhill ever since. That was (counts, runs out of fingers and toes)... um, 51 years ago in September.

-- Mal
"Of two choices, I always take the third."
Post Reply