#textdomain wesnoth-tutorial
#define LABEL STRING POSITION
    [set_variable]
        name=label_string
        format={STRING}
    [/set_variable]
    [label]
        x,y={POSITION}
        text=$label_string
    [/label]
    {CLEAR_VARIABLE label_string}
#enddef
#define UNLABEL POSITION
    [label]
        x,y={POSITION}
        text=""	# wmllint: ignore
    [/label]
#enddef

#define PRINT STRING
    [set_variable]
        name=print_string
        format={STRING}
    [/set_variable]
    [print]
        text=$print_string
        size=18
        duration=10000
        red,green,blue=255,255,255
    [/print]
    {CLEAR_VARIABLE print_string}
#enddef

#define CLEAR_PRINT
    [print]
        text=""	# wmllint: ignore
    [/print]
#enddef

#define MOVE ID_STRING START_X START_Y END_X END_Y
    [if]
        [have_unit]
            id={ID_STRING}
        [/have_unit]
        [not]
            [have_unit]
                side=1
                x,y={START_X},{START_Y}
            [/have_unit]
            [or]
                [have_unit]
                    x,y={END_X},{END_Y}
                [/have_unit]
            [/or]
        [/not]
        [then]
            [scroll_to]
                x,y={START_X},{START_Y}
            [/scroll_to]
            [store_unit]
                [filter]
                    id={ID_STRING}
                [/filter]
                variable=MOVE_tmp
                kill=yes
            [/store_unit]
            [move_unit_fake]
                type=$MOVE_tmp.type
                side=$MOVE_tmp.side
                x={START_X},{END_X}
                y={START_Y},{END_Y}
            [/move_unit_fake]
            # Drain moves
            {VARIABLE MOVE_tmp.moves 0}
            {VARIABLE MOVE_tmp.x {END_X}}
            {VARIABLE MOVE_tmp.y {END_Y}}
            [unstore_unit]
                variable=MOVE_tmp
            [/unstore_unit]
            {CLEAR_VARIABLE MOVE_tmp}
        [/then]
    [/if]
#enddef

#define NUMEQ VAR VALUE
    [variable]
        name={VAR}
        numerical_equals={VALUE}
    [/variable]
#enddef

#define GENDER MALE_WML FEMALE_WML
    [if]
        [variable]
            name=gender
            equals=male
        [/variable]
        [then]
            {MALE_WML}
        [/then]
        [else]
            {FEMALE_WML}
        [/else]
    [/if]
#enddef
