Struggling with first campaign
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.
Struggling with first campaign
Hi,
I started today with the tutorial for making your down campaign ( https://wiki.wesnoth.org/WML_for_Complete_Beginners ). I followed the tutorial to including step 4 and wanted to try out the first scenario. But I receive the following Error Message:
"The following add-on had errors and could not be loaded:
/Users/Kal_Ultor/Library/Containers/org.wesnoth.Wesnoth/Data/Library/Application Support/Wesnoth_1.16/data/add-ons/my_first_campaign/_main.cfg
Please report this to the author or maintainer of this add-on.
Details:
Macro/file '\fonttbl\f0\fnil\fcharset0' is missing
at ~add-ons/my_first_campaign/_main.cfg:2"
How do I fix it?
In case it is important:
- I use a MacBook Pro MacOs Monterey
- Version of Battle for Wesnoth: 1.16.8
- I wrote both files, "_main.cfg" and, "my_first_scenario.cfg" in TextEdit, saved them with the Suffix ".rtf" and replaced it via Information following this tutorial: https://www.alphr.com/create-cfg-file/
- both files are stored in the following direction: Wesnoth_1.16/data/add-ons/my_first_campaign (so in the my_first_campaign Folder)
Thank you for your help!
My Code (Even though I copied and pasted it)
_main.cfg
my_first_scenario.cfg
I started today with the tutorial for making your down campaign ( https://wiki.wesnoth.org/WML_for_Complete_Beginners ). I followed the tutorial to including step 4 and wanted to try out the first scenario. But I receive the following Error Message:
"The following add-on had errors and could not be loaded:
/Users/Kal_Ultor/Library/Containers/org.wesnoth.Wesnoth/Data/Library/Application Support/Wesnoth_1.16/data/add-ons/my_first_campaign/_main.cfg
Please report this to the author or maintainer of this add-on.
Details:
Macro/file '\fonttbl\f0\fnil\fcharset0' is missing
at ~add-ons/my_first_campaign/_main.cfg:2"
How do I fix it?
In case it is important:
- I use a MacBook Pro MacOs Monterey
- Version of Battle for Wesnoth: 1.16.8
- I wrote both files, "_main.cfg" and, "my_first_scenario.cfg" in TextEdit, saved them with the Suffix ".rtf" and replaced it via Information following this tutorial: https://www.alphr.com/create-cfg-file/
- both files are stored in the following direction: Wesnoth_1.16/data/add-ons/my_first_campaign (so in the my_first_campaign Folder)
Thank you for your help!
My Code (Even though I copied and pasted it)
_main.cfg
Code: Select all
[textdomain]
name="wesnoth-my_first_campaign"
path="data/add-ons/my_first_campaign/translations"
[/textdomain]
#textdomain wesnoth-my_first_campaign
[campaign]
#wesnoth-My_First_Campaign
id=my_first_campaign
name= _ "My First Campaign"
abbrev= _ "MFC"
define=CAMPAIGN_MY_FIRST_CAMPAIGN
#need icon and image (take from core files, don't include external files for sake of simplicity)
icon=
image=
first_scenario=my_first_scenario
description= _ "This is my first campaign."
{CAMPAIGN_DIFFICULTY EASY "units/human-loyalists/spearman.png~RC(magenta>red)" ( _ "Spearman") ( _ "Normal")}
[/campaign]
#ifdef CAMPAIGN_MY_FIRST_CAMPAIGN
[binary_path]
path=data/add-ons/my_first_campaign
[/binary_path]
{~add-ons/my_first_campaign/macros}
{~add-ons/my_first_campaign/utils}
{~add-ons/my_first_campaign/scenarios}
#endif
Code: Select all
#textdomain wesnoth-my_first_campaign
[scenario]
id=my_first_scenario
next_scenario=null
name=_"My First Scenario."
map_data="{~add-ons/my_first_campaign/maps/my_first_map.map}"
turns=30
[side]
side=1
controller=human
team_name="good"
user_team_name= _ "My Team"
id=MyLeader
name= _ "My Leader's Name"
type="Elvish Ranger"
unrenameable=yes
canrecruit=yes
recruit="Elvish Fighter, Elvish Archer, Elvish Shaman"
gold=100
[/side]
[side]
side=2
controller=ai
team_name="bad"
user_team_name= _ "Bad Guys"
id="EnemyLeader"
name= _ "My Villain"
type= "Orcish Warrior"
unrenameable=yes
canrecruit=yes
recruit="Orcish Grunt, Orcish Archer, Orcish Assassin, Wolf Rider"
gold=100
[/side]
[/scenario]
Re: Struggling with first campaign
".rtf" stands for Rich Text Format, which won't work - you need to save the file as plain text.
I don't use a Mac, so I'm not sure how you save as plain text in TextEdit, but according to the Wikipedia article on TextEdit it does support plain text, so it should be possible. It might work if you use the suffix ".txt" instead of ".rtf". Then you'll have to rename it to ".cfg" as you did before.
- Celtic_Minstrel
- Developer
- Posts: 2274
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Struggling with first campaign
When editing in TextEdit, you need to choose "Make Plain Text" from the Format menu before saving the file. That will cause TextEdit to add a ".txt" extension by default, but I'm pretty sure you can change it to ".cfg" right in the save box.
Re: Struggling with first campaign
Thank you for your help. I did, as you said. Now I can find the campaign in the campaign menu. However, when I choose it, I just receive an error message:
Error – Failed to load the scenario
What can I do about it?
Error – Failed to load the scenario
What can I do about it?
Re: Struggling with first campaign
Did you put the file "my_first_scenario.cfg" directly in the "my_first_campaign" folder? It should be in a subfolder named "scenarios".
Re: Struggling with first campaign
It is now in the "scenarios" folder, but I still receive the error message
Re: Struggling with first campaign
You may need to check your logs folder, it will probably have more error details.
Your logs folder should be located at:
Wesnoth_1.16/logs
Look in the most recently created log file in that folder for error messages.
Your logs folder should be located at:
Wesnoth_1.16/logs
Look in the most recently created log file in that folder for error messages.
Re: Struggling with first campaign
If I rename to (2x), then your campaign loads on my side.
Code: Select all
unrenameable
Code: Select all
unrenamable
Re: Struggling with first campaign
Thank you! @Straff's fix worked.
- Spannerbag
- Posts: 553
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: Struggling with first campaign
Hi,
it's probably a bit too late now but here are a couple of add-ons that might help?
Assuming you're using Wesnoth v1.16 then there are these that might help:
Campaign-How-To (A Simple Campaign) and maybe Helmet's DIY Campaign.
I use my own home-brewed stub campaign when testing but the ones above have (hopefully) better documentation
IIRC I think Campaign-How-To (A Simple Campaign) might be available in earlier versions of Wesnoth as A Simple Campaign.
No idea if it's changed much between versions though.
Good luck with your campaign!
Cheers!
-- Spannerbag
Re: Struggling with first campaign
@Spannerbag, Thank you, they are indeed very helpful. But I ran into another issue. I am trying to make it possible to board and unboard a galleon. However, I received this error message for the last 2 hours and couldn't find a way to fix it:
Unexpected characters after variable name (expected , or =)
at ~add-ons/my_first_campaign/scenarios/my_first_scenario.cfg:82
included from ~add-ons/my_first_campaign/_main.cfg:31
My Code:
Unexpected characters after variable name (expected , or =)
at ~add-ons/my_first_campaign/scenarios/my_first_scenario.cfg:82
included from ~add-ons/my_first_campaign/_main.cfg:31
My Code:
Spoiler:
- Spannerbag
- Posts: 553
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: Struggling with first campaign
Glad to hear it
First off, whenever you get this sort of message it gives you the line number:
at ~add-ons/my_first_campaign/scenarios/my_first_scenario.cfg:82
So I copied your code into a text editor, went to line number 82 and looked around nearby and found this:
Code: Select all
[show_if]
canrecruit=yes
not
has_unit_variable("boarded_units", "$unit_id")
[/show_if]
Which is broken in several ways.
First off
[show_if]
wants a true/false value so whatever is inside needs to be something like [have_unit]
or [variable]
.A good reference is the condition tags section of the ConditionalActionsWML wiki page. Once that's correctly structured you can work through the actual logic.
Presumably, if you remove the transport related code everything else works fine?
If you haven't done that it might be worth testing that the basic campaign structure is sound (apologies if you've already done this).
FWIW I use the
DEBUG_MSG
(macros/debug-utils
) when testing to report on variables and whether or not a section of code actually executes. It's very handy and better than :inspect
because it reports at execution time.Code: Select all
#define DEBUG_MSG MESSAGE_TEXT
# Emit a debug message. Meant to be overridden with no-op definition
# of the same name for production use.
[message]
speaker=narrator
message={MESSAGE_TEXT}
image=wesnoth-icon.png
[/message]
#enddef
My motto: Take small steps. Test often.
Hope this helps.
Cheers!
-- Spannerbag