From Wesnoth

The Wesnoth Markup Language

The Wesnoth Markup Language (WML) is used to code almost everything in Wesnoth, including scenarios, units, savefiles, and the user interface layout. WML files are simple, human-readable text files, usually with the .cfg extension, with similarities to INI files and XML. A major feature in WML are macros, which are alike those found in the C language and similarily are handled by a preprocessor. Implementation-wise, WML files are handled mainly by the config class (and simple_wml in wesnothd).

This page is a collection of pointers to different common WML structures.

See BuildingScenarios, BuildingCampaigns and BuildingUnits for a tutorial style overview.

Note: this reference may contain slight inaccuracies, might not list all existing keys and tags or might contain some deprecated syntax. If you find that this reference doesn't give you the answer to how to implement some feature in WML, the most reliable way is to look at the WML code of existing units and campaigns that have done so.

How WML works

WML toplevel tags

Other WML tags

  • EventWML how to describe an event
    • FilterWML the construct to filter on units, locations, and weapons
    • ActionWML to describe the actions which occur when the event is fired
      • ConditionalActionsWML actions that encapsulate conditional filters and the actions to execute if the conditions are met
      • DirectActionsWML actions that directly affect gameplay: for example creating a unit
      • InternalActionsWML actions that WML uses internally: for example storing a variable
      • InterfaceActionsWML actions that do not affect gameplay: for example displaying a message
      • LuaWML how to code actions with the Lua language
  • AiWML how to describe parameters for AI
  • EffectWML the construct to modify a unit
  • AbilitiesWML a list of the different abilities a unit or weapon can have
  • DescriptionWML the structure of WML coded menus like the difficulty chooser of campaigns
  • EditorWML tags controlling the post-1.4 editor's behavior

Predefined macros

Wesnoth ships with a library of predefined macros you should find useful in writing your own WML.


See Also

This page was last modified on 22 April 2015, at 07:35.