Weird error Wesnoth looking into wrong folder

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
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Weird error Wesnoth looking into wrong folder

Post by JustNatan »

Hey,
I copied an old "campaign" of mine to have an easier start for my new campaign. However for some reason I get very weird errors now when I try to run it and it's prob. because I forgot to change something, but I can't put my finger on it...

Errors

Code: Select all

20210304 09:35:15 error display: could not open image 'portraits/khalifate/hakim.png'
20210304 09:35:18 error engine: Couldn't find [scenario] with id=trolls_intro2
20210304 09:35:18 error general: Failed to load the scenario
The problem: I am not calling "portraits/khalifate/hakim.png" in the entire folder (I used grep -r hakim.png)

Code of my _main.cfg

Code: Select all

#textdomain wesnoth-riseofthetrolls
[textdomain]
    name="wesnoth-riseofthetrolls"
[/textdomain]

[campaign]
  id=RotT

  name= _ "Rise Of The Trolls"
  abbrev= _ "RotT"
  icon="scenery/rock2.png"

  first_scenario=trolls_intro2
  define=CAMPAIGN_RotT
  difficulties=EASY,NORMAL,HARD
  
  #ifver WESNOTH_VERSION <= 1.60
  image="portraits/trolls/troll-warrior.png"
  #else
  difficulty_descriptions={MENU_IMG_TXT "portraits/trolls/whelp.png~RC(magenta>red)" _"Easy"} +
   ";*" + {MENU_IMG_TXT "portraits/trolls/troll.png~RC(magenta>red)" _"Normal"} +
   ";" + {MENU_IMG_TXT "portraits/trolls/troll-Warrior.png~RC(magenta>red)" _"Hard"}
  image="portraits/trolls/troll-rocklobber.png"   
  #endif
   
   
    description= _ "Trolls are cool!" + _"(Single player, difficult Level V1.5c)"
[/campaign]

#ifdef CAMPAIGN_RoTT
[binary_path]
    path=data/add-ons/RiseOfTheTrolls/
[/binary_path]

[+units]
{~add-ons/RiseOfTheTrolls/units}
[/units]
{~add-ons/RiseOfTheTrolls/scenarios}
{~add-ons/RiseOfTheTrolls/macros}
#endif
And of course I have a scenario named
├── scenarios
│   ├── trolls_intro2.cfg
(which I think is not important)
but it contains

Code: Select all

[scenario]
    id=trolls_intro2
    next_scenario=null
    name= _ "A Beginning"
    map_data="{~add-ons/RiseOfTheTrolls/maps/0_Soldier_Room.map}"
    turns=10
    victory_when_enemies_defeated=no

  {AFTERNOON}
  [side]
		side=1
		team_name=Arlen
		user_team_name=_ "Arlen"
		controller=human
		{GOLD 0 0 0}
		type=Spearman
		id=arlen
		name="Arlen"
		unrenamable=no
		canrecruit=yes
  [/side]

  

  [side]
    side=2
    controller=ai
    name= _ "Grand Marshal Seer"
    team_name="Seer"
    type="Grand Marshal"
    id=GM
    canrecruit=yes
  [/side]
  [side]
    side=3
    controller=ai
  [/side]
[side]
    side=3
    controller=ai
    name= _ "General Tosh"
    team_name="Seer"
    type="General"
    id=GT
    canrecruit=yes
  [/side]
  [side]
    side=3
    controller=ai
[/side]
  [event]
    name=prestart
    {LOYAL_UNIT 2 (Iron Mauler) 9 6}
    {LOYAL_UNIT 2 (Iron Mauler) 11 6}
    {LOYAL_UNIT 3 (Spearman) 9 11}
    {LOYAL_UNIT 3 (Spearman) 11 11}
    {LOYAL_UNIT 3 (Spearman) 10 11}
    {LOYAL_UNIT 3 (Spearman) 12 11}
    {LOYAL_UNIT 3 (Spearman) 7 11}
    {LOYAL_UNIT 3 (Spearman) 7 12}
    {LOYAL_UNIT 3 (Spearman) 13 11}
    {LOYAL_UNIT 3 (Spearman) 13 12}

  [/event]

[/scenario]
(which should be important; since I matched the ID)
This is just a simplified version of the real intro, but I've removed most of it for a minimal example.

So for me it looks like for some reason wesnoth tries to load the old campaign, but I don't know why it makes this connection.

I am using 1.15.7+dev(99188ee0-Clean) on Linux.
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Weird error Wesnoth looking into wrong folder

Post by octalot »

These two are case sensitive (I think) :

Code: Select all

define=CAMPAIGN_RotT
...
#ifdef CAMPAIGN_RoTT
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Re: Weird error Wesnoth looking into wrong folder

Post by JustNatan »

@octalot
Thanks :), but this is probably not the problem. I adjusted the case later. (when I noticed that it should be RotT not RoTT)
Alright this helped (it's case sensitive) and by testing I noticed I mixed errors:

Code: Select all

20210304 09:35:15 error display: could not open image 'portraits/khalifate/hakim.png'
This is actually just a image loading error that appears when I open campaign menu cause of the other campaign. So it is not tied to the scenario not found error.

But the scenario not found error still exists.
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Weird error Wesnoth looking into wrong folder

Post by octalot »

Is it the multiple [side]s with side=3?

Have you tried clearing Wesnoth's cache?
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Re: Weird error Wesnoth looking into wrong folder

Post by JustNatan »

@octalot
I've never cleared wesnoth cache. I just found this path ~/.cache/wesnoth/* in another thread but it doesn't exist. I installed via flashpack if that matters.
My preprocessor also throws an error because of an ability not found, but I don't think that is the issue.

Code: Select all

20210304 11:07:09 warning config: add-on 'Under_the_Burning_Suns' has no _info.cfg; cannot read version info
Checking lua scripts... ok
20210304 11:07:11 error display: could not open image 'portraits/khalifate/hakim.png'
#all this above shouldn't be important
20210304 11:07:13 error preprocessor: Macro/file 'ABILITY_LEADERSHIPX' is missing
at ~add-ons/RiseOfTheTrolls/units/Loyalist_General.cfg:35
    included from ~add-ons/RiseOfTheTrolls/_main.cfg:36
20210304 11:07:13 error config: error reading usermade add-on '/home/xaver/.var/app/org.wesnoth.Wesnoth/data/wesnoth/1.15/data/add-ons/RiseOfTheTrolls/_main.cfg'
20210304 11:07:13 error config: Macro/file 'ABILITY_LEADERSHIPX' is missing
at ~add-ons/RiseOfTheTrolls/units/Loyalist_General.cfg:35
    included from ~add-ons/RiseOfTheTrolls/_main.cfg:36
20210304 11:07:21 error engine: Couldn't find [scenario] with id=trolls_intro2
20210304 11:07:21 error general: Failed to load the scenario
I fixed the multiple sides, but I think this was never read by wesnoth since the scenario couldn't be found. I tried again, but nothing changed after removing sides.
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Weird error Wesnoth looking into wrong folder

Post by octalot »

Answering your other thread first, in _main.cfg you need to include the macros folder before the units folder so that the #define is read before the place that uses that #define.

The preprocessor error means that the game will never see your add-on.

You can clear the cache via "Preferences", "General", "Cache", "Purge".
JustNatan
Posts: 36
Joined: September 17th, 2020, 6:07 pm

Re: Weird error Wesnoth looking into wrong folder

Post by JustNatan »

@octalot thanks :) I thought something similar as well for a second, but then I remembered that I took the main.cfg from an addon and thought it must be right. Anyway...
this nearly fixed my problem. I had another higher/lower case error that I fixed myself and now my minimal example seems to work. I'll check now if the ability works as well and if so close the second thread.

The preprocessor error was only shown after fixing the first higher/lower case error so I couldn't tell you earlier (just so you know I am not that one guy who didn't post the entire error message ;) )
Post Reply