<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.wesnoth.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=DeWulf</id>
	<title>The Battle for Wesnoth Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.wesnoth.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=DeWulf"/>
	<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/Special:Contributions/DeWulf"/>
	<updated>2026-05-04T22:41:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.16</generator>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=Talk:ReferenceWMLDump&amp;diff=13755</id>
		<title>Talk:ReferenceWMLDump</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=Talk:ReferenceWMLDump&amp;diff=13755"/>
		<updated>2007-02-09T09:27:38Z</updated>

		<summary type="html">&lt;p&gt;DeWulf: Proposal for improved clarity when explaining syntax&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following is very confusing to read:&lt;br /&gt;
&lt;br /&gt;
If '''''variable''=''value''''' is an attribute in [variables], then the expression '''$''variable'''''&lt;br /&gt;
is a shortcut to ''value''.&lt;br /&gt;
&lt;br /&gt;
If '''[''array'']''' is a tag in [variables], then '''$''array''.''variable'''''&lt;br /&gt;
has the same value as '''$''variable''''' does in [''array''].&lt;br /&gt;
For example if [''array''] contains the attribute '''variable=value''',&lt;br /&gt;
then the expression '''$array.variable''' will be interpreted as '''value'''.&lt;br /&gt;
&lt;br /&gt;
I propose to make it a rule in WML reference not to use technical terms (''variable'', ''array'') as variable names or tag names in examples, and always to state explicitly if some term or reference is a reserved word (tagname, attribute name, name of a core macro) or if it is being used as an example. The ''foobar'' convention is valuable in such cases, as it shows implicitly which words are &amp;quot;reserved&amp;quot;, and which are defined by the programmer:&lt;br /&gt;
&lt;br /&gt;
If '''''foo''=''bar''''' is an attribute in [variables], then the expression '''$''foo'''''&lt;br /&gt;
is a shortcut to ''bar''.&lt;br /&gt;
&lt;br /&gt;
If '''[''foo'']''' is a tag in [variables], then '''$''foo''.''bar'''''&lt;br /&gt;
has the same value as '''$''bar''''' does in [''foo''].&lt;br /&gt;
For example if [''foo''] contains the attribute '''bar=foobar''',&lt;br /&gt;
then the expression '''$foo.bar''' will be interpreted as '''foobar'''.&lt;br /&gt;
&lt;br /&gt;
In this example, it is now easy to see that [variables] is a standard tag, whereas [foo] is a user defined tag.&lt;/div&gt;</summary>
		<author><name>DeWulf</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.wesnoth.org/index.php?title=EventWML&amp;diff=13729</id>
		<title>EventWML</title>
		<link rel="alternate" type="text/html" href="https://wiki.wesnoth.org/index.php?title=EventWML&amp;diff=13729"/>
		<updated>2007-02-08T07:56:31Z</updated>

		<summary type="html">&lt;p&gt;DeWulf: /* the [event] tag */ Description of the 'unit action' type of event triggers;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{WML Tags}}&lt;br /&gt;
== the [event] tag ==&lt;br /&gt;
&lt;br /&gt;
This tag is a subtag of [scenario] (or [unit] - see '''event''', [[UnitWML]]) which is used to describe a set of actions&lt;br /&gt;
which trigger at a certain point in the scenario.&lt;br /&gt;
&lt;br /&gt;
keys and tags that describe when the event should trigger:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; ''name'' this is not like a normal 'name' key. It is a basic description of when the event will trigger.&lt;br /&gt;
* ''prestart'' the event is triggered before a scenario 'starts' -- before anything is shown on the screen at all. You can use this event to set up things like village ownership. For things displayed on-screen such as character dialog, use 'start'.&lt;br /&gt;
* ''start'' this event triggers after the map is shown but before the scenario begins&lt;br /&gt;
* ''new turn'' this event triggers whenever the last player ends their turn. See also '''first_time_only=no'''. When the last player ends their turn, before any events of this type trigger, the value of the WML variable '''turn_number''' is set to the number of the turn that is beginning.&lt;br /&gt;
* ''side turn'' this event triggers when a side starts its turn. Before events of this type trigger, the value of the WML variable '''side_number''' is set to the number of the side of the player about to take their turn.&lt;br /&gt;
* ''turn ''X'''' this event triggers at the start of turn ''X''. ''X'' cannot be 1.&lt;br /&gt;
* ''time over'' this event triggers on turn ''turns''. (''turns'' is specified in [scenario])&lt;br /&gt;
* ''enemies defeated'' this event triggers when all units with '''canrecruit=1''' (i.e. all leaders) not allied with side 1 are killed.&lt;br /&gt;
* ''victory'' in this scenario, any tag of the form '''[endlevel] result=victory [/endlevel]''' will be automatically preceded by all actions in this tag. It helps debugging if the victory event allows you to safely advance to any of the possible next maps after using the &amp;quot;:n&amp;quot; command. Scenarios where key units are picked up before the victory, or where some action chosen earlier determines which map to advance to, make it hard to quickly test scenarios in a campaign. (See also [endlevel], [[DirectActionsWML]])&lt;br /&gt;
* ''defeat'' in this scenario, any tag of the form '''[endlevel] result=defeat [/endlevel]''' will be automatically preceded by all actions in this tag. (See also [endlevel], [[DirectActionsWML]])&lt;br /&gt;
* ''ai turn'' is triggered just before the AI is invoked for a side. This is called after ''side turn'', and thus the WML variable '''side_number''' still holds the number of this side.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Filters can be applied to the following event triggers (see [[FilterWML]]; see also below). The actions specified in the event tag will be executed only if the filter returns true. &lt;br /&gt;
These event triggers are all actions by units (''moveto'', ''attack'') or things that happen to units (''recruit'', ''advance''). When one of these events is triggered, the position of the active unit (referred to as ''primary_unit'') is stored in the variables 'x1' and 'y1' and the position of any unit that ''primary_unit'' does something to is stored in the variables 'x2' and 'y2' (this unit is referred to as ''secondary_unit'' below). '' {{DevFeature}} These units are stored in the variables 'unit' and 'second_unit' as if they had been stored using the '''[store_unit]''' tag. see [[SingleUnitWML]]&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''moveto'' triggers after ''primary_unit'' moves. Typically this is used when ''primary_unit'' gets to a particular location and a filter for the location of ''primary_unit'' is included; remember that this is the location that ''primary_unit'' lands on, not the location it started on or any location it travels on.&lt;br /&gt;
* ''sighted'' this event triggers when ''primary_unit'' moves to a location where ''secondary_unit'' is in ''primary_unit'''s sight range. Works only in shroud or fog.&lt;br /&gt;
* ''attack'' this event triggers when ''primary_unit'' attacks ''secondary_unit''.&lt;br /&gt;
* ''attacker_hits'' this event triggers when the attacker (''primary_unit'') hits the defender (''secondary_unit'').&lt;br /&gt;
* ''attacker_misses''} same as ''attacker_hits'', but is triggered when the attacker misses.&lt;br /&gt;
* ''defender_hits'' this event triggers when the attacker (''primary_unit'') is hit in retaliation by the defender (''secondary_unit'').&lt;br /&gt;
* ''defender_misses'' same as ''defender_hits'', but is triggered when the defender misses.&lt;br /&gt;
* ''attack_end'' is similar to ''attack'', but is instead triggered after the fight, not before. Note that if either unit is killed during the fight, this event triggers before any ''die'' events.&lt;br /&gt;
* ''stone'' this event triggers when ''primary_unit'' is hit by an attack with the 'stones' ability (See ''stones'', [[AbilitiesWML]]) by ''secondary_unit'' (''secondary_unit'' is the unit with the 'stones' ability.)&lt;br /&gt;
* ''die'' this event triggers when ''primary_unit'' is killed by ''secondary_unit''.&lt;br /&gt;
* ''capture'' this event triggers when ''primary_unit'' captures a village. The village may have been previously neutral, or previously owned by another side; merely moving into your own villages does not constitute a capture.&lt;br /&gt;
* ''recruit'' this event triggers when ''primary_unit'' is recruited or recalled. (That is, when a unit is recruited or recalled, it will trigger this event and this event's filter will filter that unit.)&lt;br /&gt;
* ''prerecruit'' {{DevFeature}} this event triggers when ''primary_unit'' is recruited, but before it is displayed. &lt;br /&gt;
* ''advance'' this event triggers just before ''primary_unit'' is going to advance to another unit.&lt;br /&gt;
* ''post_advance'' this event triggers just after ''primary_unit'' has advanced to another unit.&lt;br /&gt;
* ''select'' triggers when a unit is selected. ''Note: in networked multiplayer, these events are only executed by the client on which the event is triggered, leading to out of sync errors if you modify the game state in the event.''&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
An '''[allow_undo]''' tag anywhere within a moveto event will cancel any lack of undo functionality the event would have&lt;br /&gt;
caused. It is up to the scenario designer to avoid abusing this command by allowing undo on events that shouldn't be&lt;br /&gt;
undoable. The results of doing this may be strange. This actually does have functionality beyond aesthetics like&lt;br /&gt;
signs: suppose you have an event that performs some action depending on the condition of an 'if' statement. This event&lt;br /&gt;
might be executed on every single move, but the body of the 'if' statement entered only in a few cases. Previously&lt;br /&gt;
this would completely disable undo for the entire scenario, while now it can be made to only disable undo in the cases&lt;br /&gt;
where the event mutates the scenario.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''Primary_unit'' can be referred to as '''unit''' and ''Secondary_unit'' can be referred to as '''second_unit''' in [message] tags. For example:&lt;br /&gt;
 [event]&lt;br /&gt;
 name=die&lt;br /&gt;
   [message]&lt;br /&gt;
   speaker=second_unit&lt;br /&gt;
   message=&amp;quot;Hahaha, I finally killed you!&amp;quot;&lt;br /&gt;
   [/message]&lt;br /&gt;
 &lt;br /&gt;
   [message]&lt;br /&gt;
   speaker=unit&lt;br /&gt;
   message=&amp;quot;It's not over yet! I'll come back to haunt you!&amp;quot;&lt;br /&gt;
   [/message]&lt;br /&gt;
 [/event]&lt;br /&gt;
&lt;br /&gt;
These keys and tags are more complex ways to filter when an event should trigger:&lt;br /&gt;
* ''first_time_only'' whether the event should be removed from the scenario after it is triggered.  Default is 'yes'.&lt;br /&gt;
* '''[filter]''' the event will only trigger if ''primary_unit'' matches this filter.&lt;br /&gt;
** standard unit filter - attributes for [filter] are described in [[FilterWML]]&lt;br /&gt;
* '''[filter_second]''' is like [filter], but for ''secondary_unit''.&lt;br /&gt;
** standard unit filter&lt;br /&gt;
* '''[special_filter]''' and '''[special_filter_second]''' can be used to set some additional filtering criteria for ''primary_unit'' and ''secondary_unit'' that are not generally available in a standard unit filter. Can be used in events ''attack'', ''attacker_hits'', ''attacker_misses'', ''defender_hits'', ''defender_misses'' and ''attack_end''.&lt;br /&gt;
** ''weapon'' the name of the weapon used.&lt;br /&gt;
** ''terrain'' the letter of the terrain the unit is on.&lt;br /&gt;
&lt;br /&gt;
=== Actions triggered by [event] ===&lt;br /&gt;
&lt;br /&gt;
After the trigger conditions have been met, all action tags within the [event] tag are executed in the order they are written in.&lt;br /&gt;
&lt;br /&gt;
There are 3 main types of actions:&lt;br /&gt;
* direct actions ([[DirectActionsWML]]) which have a direct effect on gameplay&lt;br /&gt;
* display actions ([[InterfaceActionsWML]]) which show something to the user&lt;br /&gt;
* internal actions ([[InternalActionsWML]]) which are used by WML internally&lt;br /&gt;
&lt;br /&gt;
Several actions use standard filters to find out which units&lt;br /&gt;
to execute the command on.  These are denoted by the phrases&lt;br /&gt;
&amp;quot;standard unit filter&amp;quot; and &amp;quot;standard location filter&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Nested events ===&lt;br /&gt;
&lt;br /&gt;
There is 1 special type of action: event creation.  By placing an '''[event]''' tag inside another '''[event]''' tag, the nested event is created when the outer event executes.  For example, you could create a portal that opens on turn 10.  The outer event executes on turn 10, creating the nested moveto event, which executes when a player steps on a certain spot.  An equivalent way of doing this would be to a single moveto event with an if statement to check for turn number, but using nested '''[event]''' tags is a simple and elegant way to accomplish more complex tasks without resorting to excessive if statements.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[DirectActionsWML]]&lt;br /&gt;
* [[InternalActionsWML]]&lt;br /&gt;
* [[InterfaceActionsWML]]&lt;br /&gt;
* [[FilterWML]]&lt;br /&gt;
* [[ReferenceWML]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: WML Reference]]&lt;/div&gt;</summary>
		<author><name>DeWulf</name></author>
		
	</entry>
</feed>