wesnoth/data/core/macros/event-utils.cfg
2017-07-25 21:19:05 +02:00

41 lines
1.3 KiB
INI

#textdomain wesnoth
# This file contains shortcuts for common WML events (such as prestart, side
# turn, and such), which can be used to write events faster and in less space.
#
# It is recommended that you only use these if you're confident you could write
# the expanded form as well; these are mostly intended as shortcuts for
# experienced WML authors.
# These don't depend on any other macros. Please don't change this.
# ! in comments is used in generating HTML documentation, ignore it otherwise.
#define CALL_FUNCTION EVENT_NAME PARAMETER_WML
# This will fire an event with a set of parameters, for example:
#! {CALL_FUNCTION my_event a,b,c=1,2,3}
#
# That example would fire an event with name "my_event"
# and inside that event, $param.c will be equal to "3"
# This will hold true even if the event is fired recursively
[set_variables]
mode=insert
name=param[0]
[value]
{PARAMETER_WML}
[/value]
[/set_variables]
[fire_event]
name={EVENT_NAME}
[primary_unit]
x=$x1
y=$y1
[/primary_unit]
[secondary_unit]
x=$x2
y=$y2
[/secondary_unit]
[/fire_event]
[clear_variable]
name=param[0]
[/clear_variable]
#enddef