mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-10 21:06:25 +00:00
337 lines
9.6 KiB
INI
337 lines
9.6 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 ON_EVENT NAME ACTION_WML
|
|
# Creates a generic event. Strictly a syntactic shortcut
|
|
[event]
|
|
name={NAME}
|
|
{ACTION_WML}
|
|
[/event]
|
|
#enddef
|
|
|
|
#define ON_PRESTART ACTION_WML
|
|
# Creates an event that triggers when the scenario starts but before the user
|
|
# gets any visible output. Strictly a syntactic shortcut.
|
|
#
|
|
# For example, you can make side 2 start the scenario with ownership of the
|
|
# village at 13,15:
|
|
#
|
|
#! {ON_PRESTART (
|
|
#! [capture_village]
|
|
#! side=2
|
|
#! x,y=13,15
|
|
#! [/capture_village]
|
|
#! )}
|
|
[event]
|
|
name=prestart
|
|
{ACTION_WML}
|
|
[/event]
|
|
#enddef
|
|
|
|
#define ON_START ACTION_WML
|
|
# Creates an event that triggers when the scenario starts, after the map is
|
|
# displayed but before the player can act. Strictly a syntactic shortcut.
|
|
#
|
|
# For example you could display some dialogue when the scenario starts:
|
|
#
|
|
#! {ON_START (
|
|
#! [message]
|
|
#! speaker=Konrad
|
|
#! message= _ "Hey, I can see some enemies up ahead!"
|
|
#! [/message]
|
|
#!
|
|
#! [message]
|
|
#! speaker=Delfador
|
|
#! message= _ "Yes, so it would seem. Charge!"
|
|
#! [/message]
|
|
#! )}
|
|
[event]
|
|
name=start
|
|
{ACTION_WML}
|
|
[/event]
|
|
#enddef
|
|
|
|
#define ON_SIDETURN ACTION_WML
|
|
# Creates an event that triggers at the start of every players turn
|
|
# For example, you could set each players gold to a fixed amount every turn.
|
|
#! {ON_SIDETURN (
|
|
#! [modify_side]
|
|
#! side=3
|
|
#! gold=0
|
|
#! [/modify_side]
|
|
#! )}
|
|
[event]
|
|
name=side turn
|
|
first_time_only=no
|
|
{ACTION_WML}
|
|
[/event]
|
|
#enddef
|
|
|
|
#define ON_TURN TURN ACTION_WML
|
|
# Creates an event that triggers at the start of turn TURN
|
|
# For example you can create a Wose belonging to player 1 at turn 3:
|
|
# Strictly a syntactic shortcut.
|
|
#! {ON_TURN 3 (
|
|
#! [unit]
|
|
#! side=1
|
|
#! type=wose
|
|
#! x,y=12,4
|
|
#! [/unit]
|
|
#! )}
|
|
[event]
|
|
name=turn {TURN}
|
|
{ACTION_WML}
|
|
[/event]
|
|
#enddef
|
|
|
|
#define ON_VICTORY ACTION_WML
|
|
# Creates an event that triggers when a player wins the game, before
|
|
# the game ends. Strictly a syntactic shortcut.
|
|
#
|
|
# For example you could congratulate the player:
|
|
#! {ON_VICTORY (
|
|
#! [message]
|
|
#! speaker=narrator
|
|
#! message="Congratulations!"
|
|
#! [/message]
|
|
#! )}
|
|
[event]
|
|
name=victory
|
|
{ACTION_WML}
|
|
[/event]
|
|
#enddef
|
|
|
|
#define ON_DEFEAT ACTION_WML
|
|
# Creates an event that triggers when a player wins the game, before
|
|
# the game ends. Strictly a syntactic shortcut.
|
|
#
|
|
# For example you could suggest an easier difficulty
|
|
# the player:
|
|
#! {ON_DEFEAT (
|
|
#! [message]
|
|
#! speaker=narrator
|
|
#! message="Aww.. you lost. Try again with 800g and +40g income?"
|
|
#! [/message]
|
|
#! )}
|
|
[event]
|
|
name=defeat
|
|
{ACTION_WML}
|
|
[/event]
|
|
#enddef
|
|
|
|
#define ALLOW_UNDO
|
|
# Allows the player to undo the effects of a moveto event.
|
|
# Strictly a syntactic shortcut.
|
|
#
|
|
# For example, let's allow undoing reading a note:
|
|
#! {ON_TILE 5 7 () (
|
|
#! [message]
|
|
#! speaker=narrator
|
|
#! message="This is a note."
|
|
#! [/message]
|
|
#! {ALLOW_UNDO}
|
|
#! )}
|
|
[allow_undo]
|
|
[/allow_undo]
|
|
#enddef
|
|
|
|
#define ON_TILE_ONCE X Y FILTER ACTION_WML
|
|
# Creates an event that triggers the first time a unit steps on a
|
|
# given tile. The filter can be used to only affect special units, or
|
|
# units of a given player.
|
|
#
|
|
# For example we could make a text-message
|
|
# that is only readable once:
|
|
#! {ON_TILE_ONCE 5 7 () (
|
|
#! [message]
|
|
#! speaker=narrator
|
|
#! message="This is a note."
|
|
#! [/message]
|
|
#! )}
|
|
[event]
|
|
name=moveto
|
|
first_time_only=yes
|
|
[filter]
|
|
x={X}
|
|
y={Y}
|
|
{FILTER}
|
|
[/filter]
|
|
{ACTION_WML}
|
|
[/event]
|
|
#enddef
|
|
|
|
#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,y=$unit.x,$unit.y
|
|
[/primary_unit]
|
|
[second_unit]
|
|
x,y=$second_unit.x,$second_unit.y
|
|
[/second_unit]
|
|
[/fire_event]
|
|
[clear_variable]
|
|
name=param[0]
|
|
[/clear_variable]
|
|
#enddef
|
|
|
|
#define ON_SIGHTING ID SIGHTING_SIDE SIGHTED_FILTER ACTION_WML
|
|
# 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.
|
|
#
|
|
# 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.type|!"
|
|
#! [/message]
|
|
#! [message]
|
|
#! speaker=second_unit
|
|
#! message= _ "Oh my! I was seen by a side $unit.side $unit.type|!"
|
|
#! [/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]
|
|
viewing_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]
|
|
viewing_side={SIGHTING_SIDE}
|
|
[/filter_vision]
|
|
[/secondary_unit]
|
|
[/fire_event]
|
|
|
|
[set_variable]
|
|
name=SIGHTED_{ID}_finished
|
|
value=yes
|
|
[/set_variable]
|
|
[/then]
|
|
[/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
|