mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 20:02:05 +00:00
199 lines
6.2 KiB
INI
199 lines
6.2 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
|
|
|
|
#define NO_INTERRUPT_NO_UNDO
|
|
# This can be used in mid-movement events (enter_hex and exit_hex) to cause
|
|
# no interruption of movement, yet prevent the move from being undone.
|
|
[allow_undo]
|
|
[/allow_undo]
|
|
[event]
|
|
name=moveto
|
|
[/event]
|
|
#enddef
|
|
|
|
#define ON_SIGHTING ID SIGHTING_SIDE SIGHTED_FILTER ACTION_WML
|
|
# NOTE: As of version 1.11, this macro is unnecessary, since sighted
|
|
# events now work as intended.
|
|
#
|
|
# This is intended to be used when a regular sighted event can't be relied
|
|
# on (that'd be most of the time). This event triggers when a unit matching
|
|
# SIGHTED_FILTER is first seen by a unit of side SIGHTING_SIDE. This works
|
|
# whether the sighting happens due to moving, recruiting, recalling,
|
|
# attacking (in case DSU was on before the attack) or advancing. If none of
|
|
# those actions manage to "catch" the moment of sighting, then it will occur
|
|
# when the current side ends their turn.
|
|
#
|
|
# The 'unit' and 'second_unit' message speaker shortcuts as well as the
|
|
# auto-stored $unit and $second_unit should work normally: the sighting unit
|
|
# is the primary unit and the sighted unit is the secondary unit.
|
|
#
|
|
# You need to provide a unique ID if you use several of these events in the
|
|
# same scenario. Otherwise it can be left empty.
|
|
#
|
|
# Only works if SIGHTING_SIDE has fog and/or shroud.
|
|
#
|
|
# Example:
|
|
#! {ON_SIGHTING () 1 side=2,3 (
|
|
#! [message]
|
|
#! speaker=unit
|
|
#! message= _ "I can see a side $second_unit.side $second_unit.language_name|!"
|
|
#! [/message]
|
|
#! [message]
|
|
#! speaker=second_unit
|
|
#! message= _ "Oh my! I was seen by a side $unit.side $unit.language_name|!"
|
|
#! [/message]
|
|
#! )}
|
|
#!
|
|
[event]
|
|
name=SIGHTED_{ID}_trigger_action_WML
|
|
|
|
{ACTION_WML}
|
|
[/event]
|
|
|
|
[event]
|
|
name=moveto,recruit,recall,attack,post advance,side turn
|
|
first_time_only=no
|
|
|
|
[filter]
|
|
side={SIGHTING_SIDE}
|
|
|
|
[or]
|
|
{SIGHTED_FILTER}
|
|
[/or]
|
|
[/filter]
|
|
|
|
[if]
|
|
[variable]
|
|
name=SIGHTED_{ID}_finished
|
|
not_equals=yes
|
|
[/variable]
|
|
|
|
[then]
|
|
[store_side]
|
|
side={SIGHTING_SIDE}
|
|
variable=stored_sighting_side
|
|
[/store_side]
|
|
|
|
[if]
|
|
[have_unit]
|
|
{SIGHTED_FILTER}
|
|
|
|
[filter_vision]
|
|
side={SIGHTING_SIDE}
|
|
[/filter_vision]
|
|
[/have_unit]
|
|
|
|
[and]
|
|
[variable]
|
|
name=stored_sighting_side.fog
|
|
boolean_equals=yes
|
|
[/variable]
|
|
|
|
[or]
|
|
[variable]
|
|
name=stored_sighting_side.shroud
|
|
boolean_equals=yes
|
|
[/variable]
|
|
[/or]
|
|
[/and]
|
|
|
|
[then]
|
|
[fire_event]
|
|
name=SIGHTED_{ID}_trigger_action_WML
|
|
|
|
[primary_unit]
|
|
side={SIGHTING_SIDE}
|
|
|
|
[filter_location]
|
|
[filter]
|
|
{SIGHTED_FILTER}
|
|
|
|
[not]
|
|
side={SIGHTING_SIDE}
|
|
[/not]
|
|
[/filter]
|
|
|
|
radius="$($this_unit.max_moves + 1)"
|
|
[/filter_location]
|
|
[/primary_unit]
|
|
|
|
[secondary_unit]
|
|
{SIGHTED_FILTER}
|
|
|
|
[filter_vision]
|
|
side={SIGHTING_SIDE}
|
|
[/filter_vision]
|
|
[/secondary_unit]
|
|
[/fire_event]
|
|
|
|
[set_variable]
|
|
name=SIGHTED_{ID}_finished
|
|
value=yes
|
|
[/set_variable]
|
|
[/then]
|
|
|
|
[else]
|
|
[allow_undo]
|
|
[/allow_undo]
|
|
[/else]
|
|
[/if]
|
|
|
|
[clear_variable]
|
|
name=stored_sighting_side
|
|
[/clear_variable]
|
|
[/then]
|
|
|
|
[else]
|
|
[allow_undo]
|
|
[/allow_undo]
|
|
[/else]
|
|
[/if]
|
|
[/event]
|
|
|
|
[event]
|
|
name=victory
|
|
|
|
[clear_variable]
|
|
name=SIGHTED_{ID}_finished
|
|
[/clear_variable]
|
|
[/event]
|
|
#enddef
|