Problem moving "Heir to the Throne" to another folder.

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.
Post Reply
pedros
Posts: 18
Joined: April 19th, 2018, 4:12 am

Problem moving "Heir to the Throne" to another folder.

Post by pedros » May 12th, 2018, 2:49 am

I have linux, debian 9.3, which has Battle for Wesnoth v1.12.6.

The first code copies Heir_To_The_Throne to an empty campaign folder, and everything works.

The second code copies Heir_To_The_Throne to an occupied campaign folder. It should overwrite anything that conflicts, and there are no messages about it. But when I try to run the campaign, it displays an error message.

$

Code: Select all

mkdir -p /usr/share/games/wesnoth/1.12/data/campaigns/test3
cp -r /usr/share/games/wesnoth/1.12/data/campaigns//Heir_To_The_Throne/* /usr/share/games/wesnoth/1.12/data/campaigns/test3
rpl "id=Heir_To_The_Throne" "id=test3" /usr/share/games/wesnoth/1.12/data/campaigns/test3/_main.cfg
rpl "Heir to the Throne" "test3" /usr/share/games/wesnoth/1.12/data/campaigns/test3/_main.cfg
rpl "Heir_To_The_Throne" "test3" /usr/share/games/wesnoth/1.12/data/campaigns/test3/_main.cfg
rpl "CAMPAIGN_HEIR_TO_THE_THRONE" "CAMPAIGN_TEST3" /usr/share/games/wesnoth/1.12/data/campaigns/test3/_main.cfg
wesnoth --campaign=test3 --campaign-difficulty 1 --nosound --data-dir /usr/share/games/wesnoth/1.12
$

Code: Select all

mkdir -p scratch3
cp -r /usr/share/games/wesnoth/1.12/data/campaigns/* scratch3
mkdir -p /usr/share/games/wesnoth/1.12/data/campaigns/all3
cp -r scratch3/*/* /usr/share/games/wesnoth/1.12/data/campaigns/all3
cp -r scratch3/Heir_To_The_Throne/* /usr/share/games/wesnoth/1.12/data/campaigns/all3
rpl "id=Heir_To_The_Throne" "id=all3" /usr/share/games/wesnoth/1.12/data/campaigns/all3/_main.cfg
rpl "Heir to the Throne" "all3" /usr/share/games/wesnoth/1.12/data/campaigns/all3/_main.cfg
rpl "Heir_To_The_Throne" "all3" /usr/share/games/wesnoth/1.12/data/campaigns/all3/_main.cfg
rpl "CAMPAIGN_HEIR_TO_THE_THRONE" "CAMPAIGN_ALL3" /usr/share/games/wesnoth/1.12/data/campaigns/all3/_main.cfg
wesnoth --campaign=all3 --campaign-difficulty 1 --nosound --data-dir /usr/share/games/wesnoth/1.12
Error loading game configuration files. The game will now exit.
Details:
Macro/file 'ABILITY_INITIATIVE' is missing
at campaigns/all3/units/Battle_Princess.cfg:26
included from campaigns/all3/_main.cfg:84
included from _main.cfg:24

So how to fix this? These two files are the same.
/usr/share/games/wesnoth/1.12/data/campaigns/test3/utils/abilities.cfg
/usr/share/games/wesnoth/1.12/data/campaigns/all3/utils/abilities.cfg

Shiki
Developer
Posts: 220
Joined: July 13th, 2015, 9:53 pm
Location: Germany

Re: Problem moving "Heir to the Throne" to another folder.

Post by Shiki » May 12th, 2018, 3:29 am

It doesn't matter if you move the folders, it will still load many things from the original location.

See https://github.com/wesnoth/wesnoth/blob ... in.cfg#L81
Maintainer of Era of Myths.
Introduction to WML filtering and WML variables.

User avatar
zookeeper
WML Wizard
Posts: 9734
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Problem moving "Heir to the Throne" to another folder.

Post by zookeeper » May 12th, 2018, 10:12 am

If you really want to move it, then you also need to replace all instances of "campaigns/Heir_To_The_Throne" in its .cfg files.

pedros
Posts: 18
Joined: April 19th, 2018, 4:12 am

Re: Problem moving "Heir to the Throne" to another folder.

Post by pedros » May 12th, 2018, 3:33 pm

to Shiki, Developer. The rpl command in my code above edits the origional _main.cfg file, which prevents the campaign from loading many things from the original location. It changes these lines:
path=data/campaigns/Heir_To_The_Throne
campaigns/Heir_To_The_Throne/utils
campaigns/Heir_To_The_Throne/units
campaigns/Heir_To_The_Throne/scenarios

to zookeeper, WML Wizard. Yes, I really want to move it, and break links to the origional. This is so I can edit things and see the result. I found only one .cfg file with instances of Heir_To_The_Throne: /usr/share/games/wesnoth/1.12/data/campaigns//Heir_To_The_Throne/_main.cfg, and I edited that in my code above. What other files are you talking about?

User avatar
beetlenaut
Developer
Posts: 2205
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Problem moving "Heir to the Throne" to another folder.

Post by beetlenaut » May 13th, 2018, 12:27 pm

If I understand correctly, you are copying HttT, not just moving it. It seems like this would lead to errors. I think it would be better to treat your new HttT like any other add-on. Copy HttT to your add-ons folder, and change its name. Change the campaign id and campaign define to something different, and have the paths point to your add-ons folder. (I've done this before and it works fine.) Your modified HttT will show up in the campaigns list as a separate entry.
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients

pedros
Posts: 18
Joined: April 19th, 2018, 4:12 am

Re: Problem moving "Heir to the Throne" to another folder.

Post by pedros » May 16th, 2018, 4:06 pm

to beetlenaut, Developer. Yes, the first thing I want to do is copy HttT. That is what my first code does, and it works. I even found a slight error in my code, // should be /. The only diffrence between my code and your instructions is my folder name is test3, your folder name is add-ons. Here is my code, with the changes. The code language is debian bash, and some lines require super user privledge, and some require non-privledged user. cp is the command to copy.

Code: Select all

mkdir -p /usr/share/games/wesnoth/1.12/data/campaigns/add-ons
cp -r /usr/share/games/wesnoth/1.12/data/campaigns/Heir_To_The_Throne/* /usr/share/games/wesnoth/1.12/data/campaigns/add-ons
rpl "id=Heir_To_The_Throne" "id=add-ons" /usr/share/games/wesnoth/1.12/data/campaigns/add-ons/_main.cfg
rpl "Heir to the Throne" "add-ons" /usr/share/games/wesnoth/1.12/data/campaigns/add-ons/_main.cfg
rpl "Heir_To_The_Throne" "add-ons" /usr/share/games/wesnoth/1.12/data/campaigns/add-ons/_main.cfg
rpl "CAMPAIGN_HEIR_TO_THE_THRONE" "CAMPAIGN_ADD-ONS" /usr/share/games/wesnoth/1.12/data/campaigns/add-ons/_main.cfg
wesnoth --campaign=add-ons --campaign-difficulty 1 --nosound --data-dir /usr/share/games/wesnoth/1.12
After the copy of HttT, I want to copy some non-conflicting files from other scenarios to the folder you call add-ons. To narrow down the problem, I did this. It works.

Code: Select all

cp -r /usr/share/games/wesnoth/1.12/data/campaigns/Two_Brothers/images /usr/share/games/wesnoth/1.12/data/campaigns/add-ons
cp -r /usr/share/games/wesnoth/1.12/data/campaigns/Two_Brothers/maps /usr/share/games/wesnoth/1.12/data/campaigns/add-ons
cp -r /usr/share/games/wesnoth/1.12/data/campaigns/Two_Brothers/scenarios/01_Rooting_Out_a_Mage.cfg /usr/share/games/wesnoth/1.12/data/campaigns/scenarios
Next I did this, and it gives the first error message.

Code: Select all

cp -r /usr/share/games/wesnoth/1.12/data/campaigns/Two_Brothers/scenarios /usr/share/games/wesnoth/1.12/data/campaigns/add-ons
Error loading game configuration files. The game will now exit.
Details:
Macro/file 'TB_BIGMAP' is missing
at campaigns/add-ons/scenarios/01_Rooting_Out_a_Mage.cfg:77
included from campaigns/add-ons/_main.cfg:87
included from _main.cfg:24

So it seems a file in /usr/share/games/wesnoth/1.12/data/campaigns/Two_Brothers/scenarios stops wesnoth from working, when the file is copied to /usr/share/games/wesnoth/1.12/data/campaigns/add-ons/scenarios. I could copy each file individually until I find the culprit. Then what? Any help here?

User avatar
beetlenaut
Developer
Posts: 2205
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Problem moving "Heir to the Throne" to another folder.

Post by beetlenaut » May 16th, 2018, 10:16 pm

I didn't say to use, "A folder named add-ons," I said, "Your add-ons folder." That's in a different place (userdata/data/add-ons), uses a different path (~add-ons), and won't have any permissions problems. It will also be easier to be sure that you aren't using parts of the original campaign and parts of the copy at the same time. I think that is what's causing your problems.

I highly recommend that you follow the Create link at the top of this page, and read about editing Wesnoth and the add-on structure. Our responses will make more sense, and you might actually be able to solve all your problems yourself.
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients

Post Reply