home *** CD-ROM | disk | FTP | other *** search
- #textdomain wesnoth
- # Interface shortcut macros.
-
- # These don't depend on any other macros. Please don't change this.
- # ! in comments is used to generate HTML documentation; ignore it otherwise.
-
- #define MESSAGE SPEAKER_ID IMAGE CAPTION_TEXT MESSAGE_TEXT
- # Displays a text message spoken by SPEAKER_ID.
- # Speaker can be any of: narrator, unit and second_unit
- # For example, let's have the narrator, which looks like a faery
- # express some feelings on the undead:
- #! {MESSAGE narrator "units/elves-wood/shyde.png" _ "Faery" _ "Aarr! Them be undeadies! Loooks at them.."}
- [message]
- speaker={SPEAKER_ID}
- message={MESSAGE_TEXT}
- image={IMAGE}
- caption={CAPTION_TEXT}
- [/message]
- #enddef
-
- #define FLOATING_TEXT FILTER COLOUR_VALUE TEXT
- # Floats the given text above the given unit in the same manner as
- # damage numbers are displayed in combat. For example when a unit
- # steps on a hidden trap and is dealt 8 damage, let's show this to
- # the player like all other damage is:
- #! {FLOATING_TEXT x,y=$x1,$y1 255,0,0 "8"}
- [store_unit]
- [filter]
- {FILTER}
- [/filter]
-
- kill=no
- variable=FLOATING_TEXT_temp
- [/store_unit]
-
- [unstore_unit]
- variable=FLOATING_TEXT_temp
- find_vacant=no
- red,green,blue={COLOUR_VALUE}
- text={TEXT}
- [/unstore_unit]
-
- {CLEAR_VARIABLE FLOATING_TEXT_temp}
- #enddef
-
- #define HIGHLIGHT_IMAGE X Y IMAGE BACKGROUND_VALUE
- # Scrolls to the given location, blinks the given image in and out a few
- # times, and then leaves the image in place. Use this to pinpoint an
- # important location to the player. If there's an existing [item] on the
- # location, specify it as the BACKGROUND_VALUE or else it'll get lost
- # during the blinking.
- [scroll_to]
- x,y={X},{Y}
- check_fogged=false
- [/scroll_to]
- [item]
- x,y={X},{Y}
- halo={IMAGE}
- [/item]
- [redraw][/redraw]
- [delay]
- time=300
- [/delay]
- [removeitem]
- x,y={X},{Y}
- [/removeitem]
- [item]
- x,y={X},{Y}
- image={BACKGROUND_VALUE}
- [/item]
- [redraw][/redraw]
- [delay]
- time=300
- [/delay]
- [item]
- x,y={X},{Y}
- halo={IMAGE}
- [/item]
- [redraw][/redraw]
- [delay]
- time=300
- [/delay]
- [removeitem]
- x,y={X},{Y}
- [/removeitem]
- [item]
- x,y={X},{Y}
- image={BACKGROUND_VALUE}
- [/item]
- [redraw][/redraw]
- [delay]
- time=300
- [/delay]
- [item]
- x,y={X},{Y}
- halo={IMAGE}
- [/item]
- [redraw][/redraw]
- [delay]
- time=300
- [/delay]
- [removeitem]
- x,y={X},{Y}
- [/removeitem]
- [item]
- x,y={X},{Y}
- image={BACKGROUND_VALUE}
- [/item]
- [redraw][/redraw]
- [delay]
- time=300
- [/delay]
- [item]
- x,y={X},{Y}
- image={IMAGE}
- [/item]
- [redraw][/redraw]
- #enddef
-
- #define CLEAR_FOG SIDE X Y RADIUS
- # Clears fog in a specific area for the given side. This is to be used only
- # for the duration of an event: always use {UNCLEAR_FOG} (below) before the
- # event exits, or otherwise you'll be left with fake fog clearer units on
- # the map.
- [if]
- [have_unit]
- type=Fog Clearer
- [/have_unit]
-
- [then]
- [set_variable]
- name=fog_clearer_i
- add=1
- [/set_variable]
- [/then]
-
- [else]
- [set_variable]
- name=fog_clearer_i
- value=1
- [/set_variable]
- [/else]
- [/if]
-
- [unit]
- side={SIDE}
- type=Fog Clearer
- id=fog_clearer_$fog_clearer_i
- x,y={X},{Y}
- max_moves={RADIUS}
- [/unit]
-
- [store_unit]
- [filter]
- id=fog_clearer_$fog_clearer_i
- [/filter]
-
- kill=no
- variable=new_fog_clearer
- [/store_unit]
-
- [hide_unit]
- x,y=$new_fog_clearer.x,$new_fog_clearer.y
- [/hide_unit]
-
- [redraw]
- side={SIDE}
- [/redraw]
-
- [clear_variable]
- name=fog_clearer_i
- [/clear_variable]
-
- [clear_variable]
- name=new_fog_clearer
- [/clear_variable]
- #enddef
-
- #define UNCLEAR_FOG
- # Restores fog that was temporarily cleared (check CLEAR_FOG above). Only
- # one UNCLEAR_FOG is required no matter how many times CLEAR_FOG was used.
- [kill]
- type=Fog Clearer
- animate=no
- fire_event=no
- [/kill]
- #enddef
-
- #define SET_LABEL X Y STRING
- # Puts STRING on the map at X,Y. Strictly a syntactic shortcut.
- #
- # For example:
- #! {SET_LABEL 4 7 _ "There be dragons here!"}
- [label]
- x={X}
- y={Y}
- text={STRING}
- [/label]
- #enddef
-
- #define REMOVE_LABEL X Y
- # Removes a label from a given tile.
- #
- # For example, remove it from 4,7
- #! {REMOVE_LABEL 4 7}
- [label]
- x={X}
- y={Y}
- text="" # wmllint: ignore
- [/label]
- #enddef
-
- #define SET_LABEL_PERSISTENT X Y STRING
- # Sets a label on tile x,y that gets reset every sideturn in case
- # someone clears it.
- #
- # Example:
- #! {SET_LABEL_PERSISTENT 4 7 _ "There really will be dragons here!!"}
- {SET_LABEL {X} {Y} ({STRING}) }
- {ON_SIDETURN (
- {SET_LABEL {X} {Y} ({STRING}) }
- )}
- #enddef
-
- #define SET_IMAGE_AND_LABEL_PERSISTENT X Y IMAGE STRING
- # Shorthand for setting both a persistent label and image at once
- {SET_LABEL_PERSISTENT {X} {Y} ({STRING}) }
- {PLACE_IMAGE ({IMAGE}) {X} {Y}}
- #enddef
-
- #define FAKE_UNIT_MOVE FROM_X TO_X FROM_Y TO_Y SIDE TYPE MODIFIER_WML
- # Moves a fake unit using TYPE's animations, from (FROM_X, FROM_Y)
- # to (TO_X, TO_Y). You can also specify modifiers that change the
- # baseframe displayed by unit's gender or variation, or none at
- # all.
- #
- # Example:
- #! {FAKE_UNIT_MOVE 1 2 1 2 1 (Dark Adept) (
- #! gender=female
- #! variation=fancy
- #! )}
- [move_unit_fake]
- type={TYPE}
- side={SIDE}
- x={FROM_X},{TO_X}
- y={FROM_Y},{TO_Y}
- {MODIFIER_WML}
- [/move_unit_fake]
- #enddef
-
- #define SCROLL X Y
- # Scrolls the screen by the specified offsets
- #
- # For example, let's scroll 5 right and 3 down:
- #! {SCROLL 5 3}
- [scroll]
- x={X}
- y={Y}
- [/scroll]
- #enddef
-
- #define SCROLL_TO X Y
- # Scrolls the screen to focus on the specified coordinates
- #
- # For example, let's focus on 26,35:
- #! {SCROLL 26 35}
- [scroll_to]
- x={X}
- y={Y}
- [/scroll_to]
- #enddef
-
- #define REDRAW
- [redraw]
- [/redraw]
- #enddef
-
- #define QUAKE SOUND
- # Visuals and sound for an earth tremor.
- [sound]
- name={SOUND}
- [/sound]
- [scroll]
- x=5
- y=0
- [/scroll]
- [scroll]
- x=-10
- y=0
- [/scroll]
- [scroll]
- x=5
- y=5
- [/scroll]
- [scroll]
- x=0
- y=-10
- [/scroll]
- [scroll]
- x=0
- y=5
- [/scroll]
- #enddef
-
- #define EARTHQUAKE ACTION_WML
- # Creates an earthquake-effect while performing ACTION_WML
- # For example we could kill all non-leader units in the earthquake:
- #! {EARTHQUAKE (
- #! [kill]
- #! canrecruit=no
- #! animate=yes
- #! [/kill]
- #! )}
- [sound]
- name=lightning.ogg
- [/sound]
- {SCROLL 2 1}
- {SCROLL -1 -3}
- {SCROLL -3 1}
- {ACTION_WML}
- {SCROLL 1 3}
- {SCROLL 1 -2}
- #enddef
-
- #define COLOR_ADJUST RED GREEN BLUE
- # Adjusts the color of the screen by a tint or red, green and blue
- # for example, let's make it very blueish:
- #! {COLOR_ADJUST 0 0 100}
- [colour_adjust]
- red={RED}
- green={GREEN}
- blue={BLUE}
- [/colour_adjust]
- #enddef
-
- # Flashes the screen with a given color performing ACTION_WML
- # These macros come in WHITE, RED, GREEN and BLUE and can
- # easily be expanded for ORANGE, PURPLE etc.
- #
- # Example: flash the screen to scare the player:
- #! {FLASH_GREEN ()}
- #! {FLASH_RED ()}
- #! {FLASH_BLUE ()}
- #! {FLASH_WHITE ()}
-
- #define FLASH_WHITE ACTION_WML
- # Flash the screen momentarily white.
- {COLOR_ADJUST 67 67 67}
- {COLOR_ADJUST 100 100 100}
- {ACTION_WML}
- {COLOR_ADJUST 33 33 33}
- {COLOR_ADJUST 0 0 0}
- #enddef
-
- #define FLASH_RED ACTION_WML
- # Flash the screen momentarily red.
- {COLOR_ADJUST 67 0 0}
- {COLOR_ADJUST 100 0 0}
- {ACTION_WML}
- {COLOR_ADJUST 33 0 0}
- {COLOR_ADJUST 0 0 0}
- #enddef
-
- #define FLASH_GREEN ACTION_WML
- # Flash the screen momentarily green.
- {COLOR_ADJUST 0 67 0}
- {COLOR_ADJUST 0 100 0}
- {ACTION_WML}
- {COLOR_ADJUST 0 33 0}
- {COLOR_ADJUST 0 0 0}
- #enddef
-
- #define FLASH_BLUE ACTION_WML
- # Flash the screen momentarily blue.
- {COLOR_ADJUST 0 0 67}
- {COLOR_ADJUST 0 0 100}
- {ACTION_WML}
- {COLOR_ADJUST 0 0 33}
- {COLOR_ADJUST 0 0 0}
- #enddef
-
- #define THUNDER ACTION_WML
- # Creates a thunder-and-lightning effect while performing ACTION_WML.
- # For example, player 3 might disappear in the flash of lightning:
- #! {THUNDER (
- #! [store_unit]
- #! [filter]
- #! side=3
- #! [/filter]
- #! variable=player3
- #! kill=yes
- #! [/store_unit]
- #! )}
- [sound]
- name=lightning.ogg
- [/sound]
- {FLASH_WHITE ({ACTION_WML}) }
- #enddef
-
- #The macro that all the following macros work off
- #define FADE_STEP_RGB RED GREEN BLUE DELAY_TIME
- [colour_adjust]
- red,green,blue={RED},{GREEN},{BLUE}
- [/colour_adjust]
- [delay]
- time={DELAY_TIME}
- [/delay]
- [redraw][/redraw]
- #enddef
-
- #The macro that the following fade to black macros rely on
- #define FADE_STEP NUMBER DELAY_TIME
- {FADE_STEP_RGB {NUMBER} {NUMBER} {NUMBER} {DELAY_TIME}}
- #enddef
-
- #define FADE_TO_BLACK
- # Fades the screen to black. Use {FADE_IN} to return to normal
- {FADE_STEP -32 5}
- {FADE_STEP -64 5}
- {FADE_STEP -96 5}
- {FADE_STEP -128 5}
- {FADE_STEP -160 5}
- {FADE_STEP -192 5}
- {FADE_STEP -224 5}
- #enddef
-
- #define FADE_TO_BLACK_HOLD TIME
- # Fades the screen to black and then pauses for TIME milliseconds.
- # Use {FADE_IN} to return to normal
- {FADE_STEP -32 5}
- {FADE_STEP -64 5}
- {FADE_STEP -96 5}
- {FADE_STEP -128 5}
- {FADE_STEP -160 5}
- {FADE_STEP -192 5}
- {FADE_STEP -224 {TIME}}
- #enddef
-
- #define FADE_IN
- # Brings the screen back from a {FADE_TO_BLACK}
- {FADE_STEP -224 5}
- {FADE_STEP -192 5}
- {FADE_STEP -160 5}
- {FADE_STEP -128 5}
- {FADE_STEP -96 5}
- {FADE_STEP -64 5}
- {FADE_STEP -32 5}
- {FADE_STEP 0 5}
- #enddef
-
- #define DEBUG TEXT
- # Logs a WML debug message to consol and the in-game chat.
- # It does nothing unless the 'wml' log domain is set to debug
- # level at application startup (usually with --log-debug=wml),
- # or in-game with the :log command (e.g. :log debug wml).
- #
- # Example:
- # ! {DEBUG "inconsistency: $unit.id is not loyal!"}
- [wml_message]
- logger=debug
- message={TEXT}
- [/wml_message]
- #enddef
-
- #define LOG TEXT
- # Logs a WML message to console and the in-game chat. It does
- # nothing unless the 'wml' log domain is set to log level at
- # application startup (usually with --log-info=wml), or in-game
- # with the :log command (e.g. :log info wml).
- #
- # Example:
- # ! {LOG "player moved to forbidden location"}
- [wml_message]
- logger=log
- message={TEXT}
- [/wml_message]
- #enddef
-
- #define WARNING TEXT
- # Logs a WML warning to console and the in-game chat. It does
- # nothing unless the 'wml' log domain is set to warning level at
- # application startup (usually with --log-warning=wml), or in-game
- # with the :log command (e.g. :log warning wml).
- #
- # Example:
- # ! {WARNING "malformed unit data"}
- [wml_message]
- logger=warn
- message={TEXT}
- [/wml_message]
- #enddef
-
- #define ERROR TEXT
- # Logs a WML error to console and the in-game chat.
- #
- # Example:
- # ! {ERROR "could not respawn hero at 2,4"}
- [wml_message]
- logger=err
- message={TEXT}
- [/wml_message]
- #enddef
-
- # Encapsulate text in conventional markup for characters whispering.
- # We do this so whispers can be restyled by tweaking this markup
- #define WHISPER TEXT
- "<small>(" + {TEXT} + ")</small>"#enddef
-
- # Encapsulate text in conventional markup for characters speaking aside.
- # We do this so whispers can be restyled by tweaking this markup
- #define ASIDE TEXT
- "<i>(" + {TEXT} + ")</i>"#enddef
-
- # Encapsulate text in conventional markup similar to how standard
- # character message dialogs are rendered. Intended for story screens
- # mainly.
- #define CAPTION TEXT
- "<span color='#bcb088'><b>" + {TEXT} + "</b></span>
-
- "#enddef
-