Coding errors?
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.
-
- Posts: 46
- Joined: October 5th, 2010, 9:42 am
Coding errors?
My first scenario/campaign. Of course I have problems. Please help!
_main
Yes, I took images from AOI
First scenario
_main
Code: Select all
#textdomain wesnoth-Trivial_Matters
[textdomain]
name="wesnoth-Trivial_Matters"
path="data/add-ons/Trivial_Matters/translations"
[/textdomain]
# wmlscope: set export=no
[campaign]
id=Trivial_Matters
icon="units/elves-wood/lord.png~TC(1,magenta)"
image="data/campaigns/An_Orcish_Incursion/images/campaign_image.png"
name= _ "Trivial Matters"
abbrev= _ "TM"
rank=49
first_scenario="01_An_Unexpected_Attack"
difficulties="EASY,NORMAL,HARD"
difficulty_descriptions={MENU_IMG_TXT2 "units/elves-wood/fighter.png~RC(magenta>red)" _"Fighter" _"(Beginner)"} +
";*" + {MENU_IMG_TXT2 "units/elves-wood/lord.png~RC(magenta>red)" _"Lord" _"(Normal)"} + ";" +
{MENU_IMG_TXT2 "units/elves-wood/high-lord.png~RC(magenta>red)" _"High Lord" _"(Challenging)"}
define="CAMPAIGN_TRIVIAL_MATTERS"
description=_ "A village is attacked by bandits. The village leader, Addyn, decides to fight back.
" + _"(Noob level, 2 scenarios.)"
[/campaign]
First scenario
Code: Select all
#textdomain wesnoth-Trivial_Matters
[scenario]
id=An_Unexpected_Attack
name= _ "An Unexpected Attack"
map_data="{~add-ons/Trivial_Matters/maps/1_Unexpected_Attack.map}"
{TURNS 30 30 30}
next_scenario=Payback
{DAWN}
{MORNING}
{AFTERNOON}
{DUSK}
{FIRST_WATCH}
{SECOND_WATCH}
[side]
#ifdef HARD
type=Peasant
#ifdef MEDIUM
type=Spearman
#ifdef Easy
type=Swordsman
#endif
id=Addyn
Name= _ "Addyn"
{GOLD 100 80 60}
unrenamable=yes
side=1
canrecruit=yes
controller=human
recruit=Peasant, Woodsman
teamn_name=Addyn
user_team_name=_"Addyn"
{FLAG_VARIANT loyalist}
[unit]
id=Dacy
name= _ "Dacy"
unrenamable=yes
type=Mage
gender=female
side=1
x=22
y=4
{IS_HERO}
[modifications]
{TRAIT_LOYAL}
{TRAIT_INTELLIGENT}
[/modifications]
[/unit]
[/side]
[side]
#ifdef HARD
type=Bandit
#else
type=Thug
#endif
id=Galdin
Name= _ "Galdin"
{GOLD 50 60 80}
unrenamable=yes
side=2
canrecruit=yes
recruit=Thug, Thief, Footpad
team_name=Galdin
user_team_name=_"Galdin"
{FLAG_VARIANT loyalist}
[ai]
Recruitment_pattern=fighter,fighter,scout
{ATTACK_DEPTH 2 2 2}
[/ai]
[/side]
[objectives]
side=1
[objective]
description= _ "Defeat the Bandit Leader"
condition=win
[/objective]
[objective]
description= _ "Death of Addyn"
condition=lose
[/objective]
[objective]
description= _ "Turns run out"
condition=lose
[/objective]
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]
[event]
name=start
[message]
speaker=Dacy
message= _ "Look! Outlaws on our borders!"
[/message]
[message]
speaker=Galdin
message= _ "This is the place. Plunder the village, boys."
[/message]
[message]
speaker=Addyn
message= _ "We must defeat that bandit to keep town Town safe!"
[/message]
[/event]
[event]
name=victory
[message]
speaker=Dacy
message= _ "We have defeated them!"
[/message]
[message]
speaker=Addyn
message= _ "I fear that this was not a random attack. Come, let us find the root of this"
[/event]
[/scenario]
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Coding errors?
My keen eyes spot a missing " in line xxx... seriously, you should post what error you get. Look in the file stderr.txt whether you can interpret it yourself (windows).
EDIT
However, the #ifdef CAMPAIGN_... block is missing so the engine probably doesn't find your scenario. Have a look at A simple campaign (see signature) for an example (or any other campaign, but without explanations...)
EDIT
However, the #ifdef CAMPAIGN_... block is missing so the engine probably doesn't find your scenario. Have a look at A simple campaign (see signature) for an example (or any other campaign, but without explanations...)
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
-
- Posts: 46
- Joined: October 5th, 2010, 9:42 am
Re: Coding errors?
Unknown scenario, Nested quote... I don't really understand them, though...
Re: Coding errors?
Besides (what I saw by skimming through this thread), the last [message]-Block isn't closed. This could also cause an error.
Crend
Crend
UMC Story Images — Story images for your campaign!
Re: Coding errors?
Oh, fer...
Look at your first_scenario. Then look at your first scenario's id. Take the main.cfg's 01_ in the first_scenario tag out and hey presto, it finds your scenario.
Look at your first_scenario. Then look at your first scenario's id. Take the main.cfg's 01_ in the first_scenario tag out and hey presto, it finds your scenario.
"What do you mean, "a dwarvish dragonguard with marksman is overpowered"?"
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
- Elvish_Hunter
- Posts: 1575
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Coding errors?
Another thing that you may want to avoid is pointing to other campaign files. You have this code:But there is a problem: Linux users, when installing from repositories, can choose what mainline campaigns to install, or not install any at all. So, in 1.8, those players that don't have AOI installed won't see the image; but in 1.9/1.10, for those users your campaign won't load at all. You should, instead, copy that file in your campaign folder and point to your copy.
Code: Select all
image="data/campaigns/An_Orcish_Incursion/images/campaign_image.png"
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: Coding errors?
Afaik the fatal error comes only for preprocessor file and macro inclusions with {}. Missing binary files instead result in a missing image like it used to be...Elvish_Hunter wrote:Another thing that you may want to avoid is pointing to other campaign files. You have this code:But there is a problem: Linux users, when installing from repositories, can choose what mainline campaigns to install, or not install any at all. So, in 1.8, those players that don't have AOI installed won't see the image; but in 1.9/1.10, for those users your campaign won't load at all. You should, instead, copy that file in your campaign folder and point to your copy.Code: Select all
image="data/campaigns/An_Orcish_Incursion/images/campaign_image.png"
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
-
- Posts: 46
- Joined: October 5th, 2010, 9:42 am
Re: Coding errors?
I have matched the scenario_id and the first_scenario, but I still get the Unknown scenario error
Re: Coding errors?
did you follow Anonymissimus' advice?
if you've done so post your _main.cfg.Anonymissimus wrote:However, the #ifdef CAMPAIGN_... block is missing so the engine probably doesn't find your scenario. Have a look at A simple campaign (see signature) for an example (or any other campaign, but without explanations...)
-
- Posts: 46
- Joined: October 5th, 2010, 9:42 am
Re: Coding errors?
main.cfg
First scenario
Still the same problems...Unknown scenario. The scenario config file is in a file "scenarios" which is in "Trivial_Matters" which is in "add_ons"
Code: Select all
[textdomain]
name="wesnoth-Trivial_Matters"
path="data/add-ons/trivial_matters/translations"
[/textdomain]
#textdomain wesnoth-Trivial_Matters
# wmlscope: set export=no
[campaign]
name= _ "Trivial Matters"
textdomain=wesnoth-Trivial_Matters
first_scenario=01_An_Unexpected_Attack
id=TRIVIAL_MATTERS
abbrev=TM
define=CAMPAIGN_TRIVIAL_MATTERS
difficulties=EASY,NORMAL,HARD
difficulty_descriptions= _ "&elvish-fighter.png=Easy;*&elvish-
hero.png=Medium;&elvish-champion.png=Hard"
icon=thief-die-7.png
image= peasant.png
description= _ "A small town is attacked. Their leader, Addyn,
decides to fight back."
[/campaign]
#ifdef TRIVIAL_MATTERS
##:: Private Binary Path
[binary_path]
path=data/add-ons/TRIVIAL_MATTERS/
[/binary_path]
#endif
First scenario
Code: Select all
#textdomain wesnoth-Trivial_Matters
[scenario]
id=01_An_Unexpected_Attack
name= _ "An Unexpected Attack"
map_data="{~add-ons/Trivial_Matters/maps/1_Unexpected_Attack.map}"
{TURNS 30}
next_scenario=null
{DEFAULT_SCHEDULE}
{VICTORY_AND_DEFEAT_MUSIC}
[side]
side=1
controller=human
team_name=1
user_team_name= _ "Addyn"
type=Peasant
description=Addyn
user_description=Addyn
gender=male
canrecruit=yes
unrenamable=true
recruit=Peasant
{GOLD 100}
{INCOME 10}
[unit]
id=Dacy
name= _ "Dacy"
unrenamable=yes
type=Mage
gender=female
side=1
x=22
y=4
{IS_HERO}
[modifications]
{TRAIT_LOYAL}
{TRAIT_INTELLIGENT}
[/modifications]
[/unit]
[/side]
[side]
type=Thug
id=Galdin
Name= _ "Galdin"
{GOLD 50}
unrenamable=yes
side=2
canrecruit=yes
recruit=Thug, Thief, Footpad
team_name=Galdin
user_team_name=_"Galdin"
{FLAG_VARIANT loyalist}
[ai]
Recruitment_pattern=fighter,fighter,scout
{ATTACK_DEPTH 2}
[/ai]
[/side]
[event]
name=prestart
[music]
name=vengeful.ogg
append=yes
[/music]
[objectives]
side=1
[objective]
description= _ "Defeat the Bandit Leader"
condition=win
[/objective]
[objective]
description= _ "Death of Addyn"
condition=lose
[/objective]
[objective]
description= _ "Turns run out"
condition=lose
[/objective]
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]
[/event]
[event]
name=start
[message]
speaker=Dacy
message= _ "Look! Outlaws on our borders!"
[/message]
[message]
speaker=Galdin
message= _ "This is the place. Plunder the village, boys."
[/message]
[message]
speaker=Addyn
message= _ "We must defeat that bandit to keep town Town safe!"
[/message]
[/event]
[event]
name=victory
[message]
speaker=Dacy
message= _ "We have defeated them!"
[/message]
[message]
speaker=Addyn
message= _ "I fear that this was not a random attack. Come, let us find the root of this"
[/message]
[/event]
[/scenario]
Re: Coding errors?
Code: Select all
#ifdef CAMPAIGN_TRIVIAL_MATTERS
[binary_path]
path=data/add-ons/Trivial_Matters/
[/binary_path]
{~add-ons/Trivial_Matters/scenarios}
#endif
"What do you mean, "a dwarvish dragonguard with marksman is overpowered"?"
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
-
- Posts: 46
- Joined: October 5th, 2010, 9:42 am
Re: Coding errors?
^I supposed that I was supposed to add that. Thanks, but now I get an error of "Missing closing tag for tag scenario at..."
I think I interpret it to mean that there is a missing " in the map tag, but I can't see anything.
I think I interpret it to mean that there is a missing " in the map tag, but I can't see anything.
-
- Posts: 1549
- Joined: June 18th, 2009, 1:45 am
Re: Coding errors?
The problem now is with your
Yours only has one. For now, try changing it to simply
{GOLD}
and {INCOME}
macros. They both need three arguments:GOLD EASY_LIST NORMAL_LIST HARD_LIST
Yours only has one. For now, try changing it to simply
gold=50
or income=10
or something like that.-
- Posts: 46
- Joined: October 5th, 2010, 9:42 am
Re: Coding errors?
Thanks, changed that.
Still get this though
Error
The following add-on hada errors and could not be loaded:
D:/Kai's Stuff/userdata/data/add-ons/Trivial_Matters/_main.cfg
ERROR DETAILS:
Missing closing tag for tag scenario at ~add-ons/Trivial_Matters/scenarios/01_An_Unexpected_Attack.cfg:2 included from ~add-oms/Trivial_Matters/_main.cfg:31, value " at ~add-ons/Trivial_Matters/maps/1_Unexpected_Attack.map:6 included from ~add-ons/Trivial_Matters/scenarios/01_An_Unexpected_Attack.cfg: included from ~add_ons/Trivial_Matters/_main.cfg:31
Still get this though
Error
The following add-on hada errors and could not be loaded:
D:/Kai's Stuff/userdata/data/add-ons/Trivial_Matters/_main.cfg
ERROR DETAILS:
Missing closing tag for tag scenario at ~add-ons/Trivial_Matters/scenarios/01_An_Unexpected_Attack.cfg:2 included from ~add-oms/Trivial_Matters/_main.cfg:31, value " at ~add-ons/Trivial_Matters/maps/1_Unexpected_Attack.map:6 included from ~add-ons/Trivial_Matters/scenarios/01_An_Unexpected_Attack.cfg: included from ~add_ons/Trivial_Matters/_main.cfg:31
Re: Coding errors?
The same thing for:elvish_sovereign wrote:The problem now is with your{GOLD}
and{INCOME}
macros. They both need three arguments:
GOLD EASY_LIST NORMAL_LIST HARD_LIST
Yours only has one. For now, try changing it to simplygold=50
orincome=10
or something like that.
Code: Select all
{TURNS 30}
Code: Select all
{ATTACK_DEPTH 2}
You are also missing "controller=ai" in side=2.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server