Coding errors?

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.
Kingslayer
Posts: 46
Joined: October 5th, 2010, 9:42 am

Coding errors?

Post by Kingslayer »

My first scenario/campaign. Of course I have problems. Please help!

_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]
Yes, I took images from AOI


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]
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Coding errors?

Post by Anonymissimus »

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...)
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Kingslayer
Posts: 46
Joined: October 5th, 2010, 9:42 am

Re: Coding errors?

Post by Kingslayer »

Unknown scenario, Nested quote... I don't really understand them, though...
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Coding errors?

Post by Crendgrim »

Besides (what I saw by skimming through this thread), the last [message]-Block isn't closed. This could also cause an error.


Crend
UMC Story Images — Story images for your campaign!
User avatar
Reepurr
Posts: 1088
Joined: August 29th, 2010, 5:38 pm

Re: Coding errors?

Post by Reepurr »

:x 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.
"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!
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Coding errors?

Post by Elvish_Hunter »

Another thing that you may want to avoid is pointing to other campaign files. You have this code:

Code: Select all

image="data/campaigns/An_Orcish_Incursion/images/campaign_image.png"
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.
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)
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Coding errors?

Post by Anonymissimus »

Elvish_Hunter wrote:Another thing that you may want to avoid is pointing to other campaign files. You have this code:

Code: Select all

image="data/campaigns/An_Orcish_Incursion/images/campaign_image.png"
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.
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...
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Kingslayer
Posts: 46
Joined: October 5th, 2010, 9:42 am

Re: Coding errors?

Post by Kingslayer »

I have matched the scenario_id and the first_scenario, but I still get the Unknown scenario error
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Coding errors?

Post by Max »

did you follow Anonymissimus' advice?
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...)
if you've done so post your _main.cfg.
Kingslayer
Posts: 46
Joined: October 5th, 2010, 9:42 am

Re: Coding errors?

Post by Kingslayer »

main.cfg

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]
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"
User avatar
Reepurr
Posts: 1088
Joined: August 29th, 2010, 5:38 pm

Re: Coding errors?

Post by Reepurr »

Code: Select all

#ifdef CAMPAIGN_TRIVIAL_MATTERS
[binary_path]
    path=data/add-ons/Trivial_Matters/
[/binary_path]
{~add-ons/Trivial_Matters/scenarios}
#endif
:whistle:
"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!
Kingslayer
Posts: 46
Joined: October 5th, 2010, 9:42 am

Re: Coding errors?

Post by Kingslayer »

^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.
monochromatic
Posts: 1549
Joined: June 18th, 2009, 1:45 am

Re: Coding errors?

Post by monochromatic »

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 simply gold=50 or income=10 or something like that.
Kingslayer
Posts: 46
Joined: October 5th, 2010, 9:42 am

Re: Coding errors?

Post by Kingslayer »

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
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Coding errors?

Post by SkyOne »

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 simply gold=50 or income=10 or something like that.
The same thing for:

Code: Select all

    {TURNS 30}
also

Code: Select all

   {ATTACK_DEPTH 2}
I am not sure how many arguments for the attack depth macro, but I am sure that it should not be just one.

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
Post Reply