New to WML, need some help.

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
User avatar
The_Quixotic_King
Posts: 17
Joined: May 6th, 2020, 6:37 pm

New to WML, need some help.

Post by The_Quixotic_King »

Greetings, I am quite new here, and I have been trying to mess around with WML. I have been making a very simple one scenario campaign, just a zany nothingness about Galvanized Penguins. And I wrote about all of the main.cfg and the first scenario, and, it wont work, it wont even show up in the campaign selection. And it won't tell me that anything is wrong either when I load up wesnoth. (note: when I load up map editor it says something is wrong with the age of lords, but i'm relatively certain that's unrelated) I have rewritten the Main.cfg multiple times now, and I just can't find out why. I can't use Zookeepers technique of debugging because i can't load it at all. This is my first experience with coding about anything, so if it is something profoundly stupid please let me know.

Please also let me know if their is a better way of formatting a post like this.

The Main.cfg

Code: Select all

[textdomain]
    name="my_first_campaign"
    path="data/add-ons/my_first_campaign/"
[/textdomain]
   
[campaign]
     #textdomain my_first_campaign
    
     id=CAMPAIGN_ID
     name= _ "Galvanized War"
     abbrev= _ "GE"
     define=CAMPAIGN_MY_FIRST_CAMPAIGN
   
     icon=
     image= 
     description= _ "The war of Galvanized secession"
    
     {CAMPAIGN_DIFFICULTY EASY   "units/human-peasants/peasant.png~RC(magenta>red)" ( _ "Civilian") ( _ "Beginner")}
     {CAMPAIGN_DIFFICULTY NORMAL "units/human-loyalists/spearman.png~RC(magenta>red)" ( _ "Soldier") ( _ "Normal")} {DEFAULT_DIFFICULTY}
     {CAMPAIGN_DIFFICULTY HARD   "units/human-loyalists/pikeman.png~RC(magenta>red)" ( _ "Veteran") ( _ "Challenging")}
   
     first_scenario=my_first_scenario
    
[/campaign]
    
#ifdef CAMPAIGN_MY_FIRST_CAMPAIGN
    
{~add-ons/my_first_campaign/scenarios}
{~add-ons/my_first_campaign/maps}

[+units]
    {~add-ons/my_first_campaign/units}
[/units]
 
#endif

The first scenario

Code: Select all

 #textdomain wesnoth-my_first_campaign
	[scenario]
		id=my_first_scenario
		next_scenario=null
		name= _ "my_first_scenario"
		map_data=map_data="{~add-ons/my_first_campaign/maps/Galvanized_defense.map}"
		turns=30
		[side]
		side=1
		controller=human
		team_name=Galvanized
		user_team_name= _ "Galvanized Penguins"
		id="MyPenguin"
		name= _ "Duke Clement"
		type="Dwarvish Stalwart"
		unrenameable=yes
		canrecruit=yes
		recruit="Dwarvish Guardsman, Goblin Spearman, Sergeant, Dwarvish Thunderer"
		gold=100
		[/side]
		[side]
		side=2
		controller=ai
		team_name="bad"
		user_team_name= _ "Raiders"
		id="EnemyLeader"
		name= _ "Fudor"
		type= "Bandit"
		unrenameable=yes
		recruit="Orcish Grunt, Footpad, Poacher"
		gold=100
		[/side]
	[/scenario]
	
	[event]
		name=start
		[message]
			speaker=EnemyLeader
			message= _ "So, the galvanized penguins do not wish to pay tribute to our master? Very well then, I, Fudor will destroy all of you!"
		[/message]
		[message]
		speaker=MyPenguin
		message= _ "We refuse to pay tribute to Velbil! Come my penguins! to arms! We shall defend our Zinc to the last Penguin!"
		[/message]
		[objectives]
			[objective]
				description= _ "Defeat Fudor"
				condition="win"
			[/objective]
			[objective]
				description= _ "Death of Duke Clement"
				condition="lose"
			[/objective]
		[/objectives]
	[/event]
	
[event]
    name=time over
    [message]
        speaker=MyPenguin
        message= _ "Alas, They stole the Zinc!"
    [/message]
    [endlevel]
        result=defeat
    [/endlevel]
[/event]
	
[event]
	name="last breath"
	first_time_only=no
	[filter]
		side=1
	[/filter]
	[message]
		speaker=second_unit
		message= _ "Die zinc hoarding miser!"
	[/message]
[/event]
[event]
name=die
	first_time_only=no
	[filter]
		side=1
	[/filter]
	[message]
		speaker=unit
		message= _ "remember me!"
	[/message]
[/event]
	
If you went through this, i thank you profusely.
“Truly I was born to be an example of misfortune, and a target at which the arrows of adversary are aimed.” -Donquixote

vghetto
Posts: 166
Joined: November 2nd, 2019, 5:12 pm

Re: New to WML, need some help.

Post by vghetto »

Hi,

Maybe it's not showing because the folder is in the wrong location. When you start wesnoth click on the blue i in the bottom left corner and see where the Add-ons folder is located in your installation.

A couple of notes about the code, the events should be inside the scenario, so move the [/scenario] to the end of the file.
Also, delete one of the map_data=map_data=

I strongly recommend you download the addon WML_Guide and use that as a template.

Edit:
If you do have the correct folder location, make sure the main file is _main.cfg

User avatar
The_Quixotic_King
Posts: 17
Joined: May 6th, 2020, 6:37 pm

Re: New to WML, need some help.

Post by The_Quixotic_King »

Thanks, i got it to load, i think the problem was it wasn't reading my main.cfg file because it was a text document and not a file, also it was just main.cfg and not _main.cfg.

now that it actually showed up it doesn't work, it seems to be a problem with the scenario, but i think i can fix that on my own, thanks again.

Code: Select all

The following add-on had errors and could not be loaded:
    C:\Users\ejbra\Documents\My Games\Wesnoth1.14/data/add-ons/my_first_campaign/_main.cfg

Please report this to the author or maintainer of this add-on.

Details:

    Unterminated closing tag
    at ~add-ons/my_first_campaign/scenarios/my_first_scenario.cfg:90
        included from ~add-ons/my_first_campaign/_main.cfg:28
“Truly I was born to be an example of misfortune, and a target at which the arrows of adversary are aimed.” -Donquixote

User avatar
The_Quixotic_King
Posts: 17
Joined: May 6th, 2020, 6:37 pm

Re: New to WML, need some help. update

Post by The_Quixotic_King »

Well i got the scenario to work just fine and all, but when i actually played the scenario the map was very poorly balanced, the AI was at a huge advantage, so i updated the map and added some units in the map editor to spice things up. But, when i tried to test it i got this:

Code: Select all

The following add-on had errors and could not be loaded:
    C:\Users\ejbra\Documents\My Games\Wesnoth1.14/data/add-ons/my_first_campaign/_main.cfg

Please report this to the author or maintainer of this add-on.

Details:

    Nested quoted string
    at ~add-ons/my_first_campaign/maps/Galvanized_defense.map:4
        included from ~add-ons/my_first_campaign/scenarios/my_first_scenario.cfg:6
        included from ~add-ons/my_first_campaign/_main.cfg:28
I've checked over and over again, there are no nested quoted strings. If i remove the quotations from row 4 it just tells me to go down to the next line with quotations, it thinks that every single quotation is nested, i am absolutely dumbfounded, can't figure it out for the life of me.
“Truly I was born to be an example of misfortune, and a target at which the arrows of adversary are aimed.” -Donquixote

User avatar
Pentarctagon
Project Manager
Posts: 4363
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: New to WML, need some help.

Post by Pentarctagon »

Can you upload your entire current add-on directory as a zip file?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

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

Re: New to WML, need some help.

Post by beetlenaut »

The error message reported doesn't always tell you what needs to be fixed. If the engine says it is unable to match up some quotes, that doesn't mean that an ending quote is missing. It might be that you forgot the slash in an end tag, so one quotation mark is hidden inside a tag that is still open at the end of the file. What would need to be fixed in this example is the ending slash, even though the error message doesn't mention it. It's probably something like that. (Though I'm not sure my example is actually possible.)

Hope that helps. If not, feel free to upload the whole thing like Pentarctagon said, and one of us with more debugging experience will find it in a jiffy.

Also, if you are not using an editor with syntax highlighting (where tags, strings, numbers, and so on are in different colors), you should look into it. Sometimes errors that are hard to find are just obvious with colors.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide

User avatar
The_Quixotic_King
Posts: 17
Joined: May 6th, 2020, 6:37 pm

Re: New to WML, need some help.

Post by The_Quixotic_King »

here it is, i've been trying many different things and i just can't locate the problem, is it a glitch?
Attachments
my_first_campaign.zip
here is the stuff,
(6.72 KiB) Downloaded 31 times
“Truly I was born to be an example of misfortune, and a target at which the arrows of adversary are aimed.” -Donquixote

User avatar
Pentarctagon
Project Manager
Posts: 4363
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: New to WML, need some help.

Post by Pentarctagon »

Your .map files should have just the map data in them, and that's it.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

User avatar
The_Quixotic_King
Posts: 17
Joined: May 6th, 2020, 6:37 pm

Re: New to WML, need some help.

Post by The_Quixotic_King »

ah good, i moved all the stuff to the scenario and it worked, thank you kindly. but it is strange, because i didn't add in all of the unit stuff, it was already there. I used the unit tool in the map editor, was that my first mistake?

once again, i thank you profusely.
Last edited by The_Quixotic_King on May 8th, 2020, 1:49 am, edited 1 time in total.
“Truly I was born to be an example of misfortune, and a target at which the arrows of adversary are aimed.” -Donquixote

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

Re: New to WML, need some help.

Post by beetlenaut »

The map editor unit tool added that other code, yes. But, you also must have saved the map as a scenario instead of saving as a map. Saving as a map just stores the tile data. (Saving as a scenario is probably the default after using some of the scenario features like the unit tool, so that might be how it happened.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide

User avatar
The_Quixotic_King
Posts: 17
Joined: May 6th, 2020, 6:37 pm

Re: New to WML, need some help.

Post by The_Quixotic_King »

I see, thank you, now that i now how to use it, it will actually be helpful, and not break my mind for 4 hours.

Thank you kindly.
“Truly I was born to be an example of misfortune, and a target at which the arrows of adversary are aimed.” -Donquixote

Post Reply