https://wiki.wesnoth.org/api.php?action=feedcontributions&user=Dorn&feedformat=atomThe Battle for Wesnoth Wiki - User contributions [en]2024-03-29T12:21:49ZUser contributionsMediaWiki 1.31.16https://wiki.wesnoth.org/index.php?title=TerrainWML&diff=57208TerrainWML2016-02-23T08:21:11Z<p>Dorn: /* the toplevel [terrain_type] tag */ heals: removed note about deprecated and now removed support for boolean</p>
<hr />
<div>{{WML Tags}}<br />
== the toplevel [terrain_type] tag ==<br />
<br />
The [terrain_type] tag describes a terrain in WML.<br />
Terrains are usually described in the terrain.cfg file<br />
<br />
the [terrain_type] tag has the following keys and subtags<br />
* '''symbol_image''': an image used for this terrain in the minimap<br />
* '''editor_image''': an image used for this terrain in the map editor; if not defined uses symbol_image<br />
* '''icon_image''': an image used for this terrain to indicate defence/movement; shown in the help, and in the sidebar when the terrain is highlighted<br />
* '''id''': a non-translatable string identifying this terrain. It is used as the key for attributes in some parts of WML, such as {{tag|UnitsWML|movetype}} (but see also the aliasof= attribute below; not all ids need to be listed under movetypes).<br />
* '''name''': the name of the terrain, a translatable string used for the display of terrain type in the game and the map editor<br />
* '''description''': the detailed description of the terrain, a translatable string used for the display of terrain type in the game and the map editor. If this is not present, the game and editor will fall back to the '''name''' attribute. The difference is that the name tends to describe the game effect of the terrain type (e.g., "Forest") but the description attribute also carries information about visual subtype (e.g. "Summer Deciduous Forest").<br />
* '''editor_name''': a detailed name for the terrain used only in the map editor. Terrains are presented in the editor as "''<editor_name>''/''<name>'' (''<aliases>'')" when this attribute is used.<br />
* '''string''': this is the string that represents the terrain in maps and scenarios<br />
* '''unit_height_adjust''': how much the unit graphic should be moved up or down when on that terrain<br />
* '''submerge''': float, between 0 and 1: specifies how much of the unit graphic should be submerged by the terrain<br />
* '''light''': signed value: this will modify the local light level on that hex by that amount for gameplay.<br />
* '''max_light''': signed value: this is the maximum local light level that may be indicated by light=. Defaults to the value of light= and is effectively overridden by the time-of-day lighting, if that is higher.<br />
* '''min_light''': signed value: this is the minimum local light level that may be indicated by light=. Defaults to the value of light= and is effectively overridden by the time-of-day lighting, if that is lower.<br />
* '''heals''': positive value: the amount of HP a unit on this terrain will be healed at the start of every turn.<br />
* '''gives_income''': if set to true, this terrain will give income every turn when flagged, as if it were a village<br />
* '''recruit_onto''': if set to true, it is possible to recruit or recall on that terrain<br />
* '''recruit_from''': if set to true it is possible to recruit when a unit that can recruit is on that terrain<br />
* '''aliasof''': comma separated string of terrains of which this terrain will be an alias. This is a list of terrains, with + and - signs having special meanings. The string is read left to right taking the best value until a minus sign is encountered, after which it takes the worst value instead. The plus sign reverts to best value. (Note: after a + or - a comma is also required. In order to include a + sign the entire line must be placed between double quotes.)<br />
* '''def_alias''': like ''aliasof'' but overides it for defense calculation only<br />
* '''mvt_alias''': like ''aliasof'' but overides it for movement calculation only<br />
* '''vision_alias''': like ''aliasof'' but overides it for vision calculation only<br />
* '''income_description''': for terrains with ''gives_income'' and owned by nobody this text is shown in the terrain description in the top bar before the brackets. This tag is optional, if not supplied Wesnoth will assume the terrain is a village and sets an appropriate message.<br />
* '''income_description_ally''': like ''income_description'' but if owned by an ally<br />
* '''income_description_enemy''': like ''income_description'' but if owned by an enemy<br />
* '''income_description_own''': like ''income_description'' but if owned by yourself<br />
* '''editor_group''': a comma separated list of editor_group ids to which this terrain belongs.<br />
* '''hidden''': (boolean) if set to 'yes', makes this terrain not appear in the map editor palettes.<br />
* '''hide_help''': (boolean) if set to 'yes', makes this terrain not appear in the terrain help browser.<br />
<br />
== See Also ==<br />
<br />
* [[ReferenceWML]]<br />
* [[TerrainCodesWML]]<br />
* [[EditorWML]]<br />
<br />
<br />
[[Category: WML Reference]]</div>Dornhttps://wiki.wesnoth.org/index.php?title=LuaWML/Sides&diff=57207LuaWML/Sides2016-02-23T07:49:47Z<p>Dorn: fix functions syntax</p>
<hr />
<div>This page describes the [[LuaWML]] functions and helpers for handling sides and villages.<br />
<br />
==== wesnoth.sides ====<br />
<br />
This is not a function but a table indexed by side numbers. Its elements are proxy tables with these fields:<br />
* '''side''': the side number<br />
* '''gold''', '''village_gold''', '''base_income''': integers (read/write)<br />
* '''total_income''': integer (read only)<br />
* '''objectives''', '''user_team_name''': translatable strings (read/write)<br />
* '''objectives_changed''': boolean (read/write)<br />
* '''team_name''': string (read/write)<br />
* '''controller''': string (read/write) :<br />
:''note: In networked multiplayer, the controller attribute is ambiguous. Be very careful or you have OOS errors.''<br />
: The controller attribute has 6 possible values: human, network, ai, network_ai, null, idle. <br />
<br />
: A local human should always be "human", a local ai should always be "ai", a remote human should always be "network". and a remote ai should always be "network_ai". An empty side should be null on all clients. <br />
<br />
: An idle side should appear similarly as a "human" side for all sides that don't own the idle side, i.e. as "network".<br />
<br />
: These values may be checked using lua, or the :controller command in game.<br />
<br />
: This value can only be set to 'human', 'ai' or 'null'.<br />
* '''fog''': boolean (read)<br />
* '''shroud''': boolean (read)<br />
* '''hidden''': boolean (read/write)<br />
* '''name''': string (read)<br />
* '''color''': string (read/write)<br />
* '''recruit''': table of strings (read/write)<br />
* '''scroll_to_leader''': boolean (read/write)<br />
* '''village_support''': string (read/write)<br />
* '''flag''': string (read)<br />
* '''flag_icon''': string (read)<br />
* '''defeat_condition''': string (read/write) See description at [[SideWML]], [[ScenarioWML#Scenario_End_Conditions]]<br />
* '''lost''': bool (read/write) If lost=true this side will be removed from the persitent list at the end of the scenario. This key can also be used to stop the engine from removing a side by setting it to false. Writing this key only works in a victory/defeat event.<br />
* '''__cfg''': WML table (dump)<br />
<br />
The metatable of these proxy tables appears as '''"side"'''.<br />
<br />
local team = wesnoth.sides[1]<br />
team.gold = team.gold + 50<br />
wesnoth.message(string.format("%d sides", #wesnoth.sides))<br />
<br />
==== wesnoth.get_sides ====<br />
<br />
* '''wesnoth.get_sides(''filter'')'''<br />
<br />
Returns a table array containing proxy tables for these sides matching the passed [[StandardSideFilter]].<br />
--set gold to 0 for all sides with a leader<br />
local sides = wesnoth.get_sides({ {"has_unit", { canrecruit = true }} })<br />
for i,v in ipairs(sides) do<br />
v.gold = 0<br />
end<br />
<br />
==== wesnoth.get_village_owner ====<br />
<br />
* '''wesnoth.get_village_owner(''x'', ''y'')'''<br />
<br />
Returns the side that owns the village at the given location.<br />
<br />
local owned_by_side_1 = wesnoth.get_village_owner(12, 15) == 1<br />
<br />
==== wesnoth.set_village_owner ====<br />
<br />
* '''wesnoth.set_village_owner(''x'', ''y'', ''side'', [''fire_events''])'''<br />
<br />
Gives ownership of the village at the given location to the given side (or remove ownership if none). Ownership is also removed if nil or 0 is passed for the third parameter, but no capture events are fired in this case.<br />
An optional 4th parameter (boolean true|false, default: false) can be passed determining whether to fire any capture events.<br />
<br />
wesnoth.set_village_owner(12, 15, 1)<br />
<br />
==== wesnoth.is_enemy ====<br />
<br />
* '''wesnoth.is_enemy(''side1'', ''side2'')'''<br />
<br />
Returns true if side A is enemy of side B, false otherwise.<br />
<br />
local enemy_flag = wesnoth.is_enemy(1, 3)<br />
<br />
==== wesnoth.match_side ====<br />
<br />
* '''wesnoth.match_side(''side'', ''filter'')'''<br />
<br />
Matches a side against a given [[StandardSideFilter]].<br />
<br />
wesnoth.message(tostring(wesnoth.match_side(1, {{"has_unit", { type = "Troll" }}})))<br />
<br />
==== wesnoth.get_starting_location ====<br />
<br />
* '''wesnoth.get_starting_location(''side'')'''<br />
<br />
Returns the starting location of the given side.<br />
<br />
local loc = wesnoth.get_starting_location(1)<br />
wesnoth.message(string.format("side 1 starts at (%u, %u)", loc[1], loc[2]))<br />
<br />
==== helper.all_teams ====<br />
<br />
* '''helper.all_teams()'''<br />
<br />
Returns an iterator over teams that can be used in a for-in loop.<br />
<br />
for team in helper.all_teams() do team.gold = 200 end<br />
<br />
[[Category: Lua Reference]]</div>Dornhttps://wiki.wesnoth.org/index.php?title=LuaWML/Display&diff=57161LuaWML/Display2016-02-19T19:06:43Z<p>Dorn: /* wesnoth.set_dialog_canvas */ fixed function syntax</p>
<hr />
<div>This page describes the [[LuaWML]] functions and helpers for interfacing with the user.<br />
<br />
==== wesnoth.message ====<br />
<br />
* '''wesnoth.message([''speaker'',] ''message'')'''<br />
<br />
Displays a string in the chat window and dumps it to the lua/info log domain (''--log-info=scripting/lua'' on the command-line).<br />
<br />
wesnoth.message "Hello World!"<br />
<br />
The chat line header is "<Lua>" by default, but it can be changed by passing a string before the message.<br />
<br />
wesnoth.message("Big Brother", "I'm watching you.") -- will result in "&lt;Big Brother&gt; I'm watching you."<br />
<br />
See also [[LuaWML:Events#helper.wml_error|helper.wml_error]] for displaying error messages.<br />
<br />
==== wesnoth.clear_messages ====<br />
<br />
* '''wesnoth.clear_messages()'''<br />
<br />
Removes all messages from the chat window. No argument or returned values.<br />
<br />
==== wesnoth.textdomain ====<br />
<br />
* '''wesnoth.textdomain(''domain'')'''<br />
<br />
Creates a function proxy for lazily translating strings from the given domain.<br />
<br />
-- #textdomain "my-campaign"<br />
-- the comment above ensures the subsequent strings will be extracted to the proper domain<br />
_ = wesnoth.textdomain "my-campaign"<br />
wesnoth.set_variable("my_unit.description", _ "the unit formerly known as Hero")<br />
<br />
The metatable of the function proxy appears as '''"message domain"'''. The metatable of the translatable strings (results of the proxy) appears as '''"translatable string"'''.<br />
<br />
The translatable strings can be appended to other strings/numbers with the standard '''..''' operator. Translation can be forced with the standard '''tostring''' operator in order to get a plain string.<br />
<br />
wesnoth.message(string.format(tostring(_ "You gain %d gold."), amount))<br />
<br />
==== wesnoth.delay ====<br />
<br />
* '''wesnoth.delay(''milliseconds'')'''<br />
<br />
Delays the engine like the [delay] tag. one argument: time to delay in milliseconds<br />
<br />
wesnoth.delay(500)<br />
<br />
==== wesnoth.float_label ====<br />
<br />
* '''wesnoth.float_label(''x'', ''y'', ''text'')'''<br />
<br />
Pops some text above a map tile.<br />
<br />
wesnoth.float_label(unit.x, unit.y, "&lt;span color='#ff0000'&gt;Ouch&lt;/span&gt;")<br />
<br />
==== wesnoth.select_hex ====<br />
<br />
* '''wesnoth.select_hex(''x'', ''y'', [''show_movement'', [''fire_events'']])'''<br />
<br />
Selects the given location in the game map as if the player would have clicked onto it.<br />
Argument 3: boolean, whether to show the movement range of any unit on that location (def: true)<br />
Argument 4: boolean, whether to fire any select events (def: false)<br />
<br />
wesnoth.select_hex(14,6, true, true)<br />
<br />
==== wesnoth.deselect_hex ====<br />
<br />
* '''wesnoth.deselect_hex()'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Reverses any select_hex call, leaving all locations unhighlighted. Takes no arguments.<br />
<br />
==== wesnoth.scroll_to_tile ====<br />
<br />
* '''wesnoth.scroll_to_tile(''x'', ''y'', [''only_if_visible'', [''instant'']])'''<br />
<br />
Scrolls the map to the given location. If true is passed as the third parameter, scrolling is disabled if the tile is hidden under the fog. If true is passed as the fourth parameter, the view instantly warps to the location regardless of the scroll speed setting in Preferences.<br />
<br />
local u = wesnoth.get_units({ id = "hero" })[1]<br />
wesnoth.scroll_to_tile(u.x, u.y)<br />
<br />
==== wesnoth.lock_view ====<br />
<br />
* '''wesnoth.lock_view(''lock'')'''<br />
<br />
Locks or unlocks gamemap view scrolling for human players. If true is passed as the first parameter, the view is locked; pass false to unlock.<br />
<br />
Human players cannot scroll the gamemap view as long as it is locked, but Lua or WML actions such as wesnoth.scroll_to_tile still can; the locked/unlocked state is preserved when saving the current game. This feature is generally intended to be used in cutscenes to prevent the player scrolling away from scripted actions.<br />
<br />
wesnoth.lock_view(true)<br />
wesnoth.scroll_to_tile(12, 14, false, true)<br />
<br />
==== wesnoth.view_locked ====<br />
<br />
* '''wesnoth.view_locked()'''<br />
<br />
Returns a boolean indicating whether gamemap view scrolling is currently locked.<br />
<br />
==== wesnoth.play_sound ====<br />
<br />
* '''wesnoth.play_sound(''sound'', [''repeat_count''])'''<br />
<br />
Plays the given sound file once, optionally repeating it one or more more times if an integer value is provided as a second argument (note that the sound is ''repeated'' the number of times specified in the second argument, i.e. a second argument of 4 will cause the sound to be played once and then repeated four more times for a total of 5 plays. See the example below).<br />
<br />
wesnoth.play_sound "ambient/birds1.ogg"<br />
wesnoth.play_sound("magic-holy-miss-3.ogg", 4) -- played 1 + 4 = 5 times<br />
<br />
==== wesnoth.set_music ====<br />
<br />
* '''wesnoth.set_music(''music_entry'')'''<br />
<br />
Sets the given table as an entry into the music list. See [[MusicListWML]] for the recognized attributes.<br />
<br />
wesnoth.set_music { name = "traveling_minstrels.ogg" }<br />
<br />
Passing no argument forces the engine to take into account all the recent changes to the music list. (Note: this is done automatically when sequences of WML commands end, so it is useful only for long events.)<br />
<br />
==== wesnoth.show_message_dialog ====<br />
<br />
* '''wesnoth.show_message_dialog(''attributes'', [''options'', [''text_input_attributes'']])'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Shows a message dialog, of the type used by the [message] ActionWML tag. Unlike the [message] tag, this is unsynced; if you need it synced, you must do it yourself. The first argument is a table describing the dialog with the following keys:<br />
<br />
* ''title'' - The title to show on the message. For example, the speaker's name.<br />
* ''message'' - The message content.<br />
* ''portrait'' - An image to show along with the message. By default, no image is shown.<br />
* ''left_side'' - The default is true; set to false to show the image on the right.<br />
* ''mirror'' - If true, the image will be flipped horizontally.<br />
<br />
The second argument is a list of options as a Lua array. Each option is either a (possibly-translatable) string or a config with [[DescriptionWML#WML_Format|DescriptionWML]] keys. The array itself can also have an optional '''default''' key which if present should be the index of the initially selected option (useful if you don't need full DescriptionWML but want to set a default). If present it overrides any defaults set in individual options.<br />
<br />
The third argument is a table describing the text input field with the following keys:<br />
<br />
* ''label'' - A label to show to the left of the text field.<br />
* ''text'' - Initial contents of the text field.<br />
* ''max_length'' - Maximum input length in characters (defaults to 256).<br />
<br />
You need at least one key for the text input to be shown. Both the second arguments are option, but if you want text input with no options, you must pass nil for the second parameter.<br />
<br />
This function returns two values. The first is the numeric result of the dialog. If there are no options and no text input, this is -2 if the user closed by pressing Escape, otherwise it's -1. If there are options, this is the index of the option chosen (starting from 1). If there is text input but no options, the first return value is 0. If there was text input, the second value contains the text entered.<br />
<br />
Example:<br />
<br />
wesnoth.show_message_dialog({<br />
title = "Make your choice:",<br />
message = "Select an option and enter some text.",<br />
portrait = "wesnoth-icon.png",<br />
}, {<br />
"The first choice is always the best!",<br />
"Pick me! Second choices are better!",<br />
"You know you want the third option!",<br />
}, {<br />
label = "Text:",<br />
text = "?",<br />
max_length = 16<br />
})<br />
<br />
(You don't have to format it like that, of course.)<br />
<br />
==== wesnoth.show_popup_dialog ====<br />
<br />
* '''wesnoth.show_popup_dialog(''title'', ''message'', [''image''])'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Shows a simple popup dialog in the centre of the screen. Takes three arguments, which in order are:<br />
<br />
# A title string for the dialog<br />
# The message content for the dialog.<br />
# An image to show.<br />
<br />
Both the title and the message support Pango markup. The image is optional.<br />
<br />
==== wesnoth.show_dialog ====<br />
<br />
* '''wesnoth.show_dialog(''wml_dialog_table'', [''pre_show_function'', [''post_show_function'']])'''<br />
<br />
Displays a dialog box described by a WML table and returns:<br />
* if the dialog was dismissed by a button click, the integer value associated to the button via the "return_value" keyword.<br />
* if the dialog was closed with the enter key, -1.<br />
* if the dialog was closed with the escape key, -2.<br />
<br />
The dialog box is equivalent to the resolution section of a GUI window as described in [[GUIToolkitWML#Window_definition|GUIToolkitWML]] and must therefore contain at least the following children: '''[tooltip]''', '''[helptip]''', and '''[grid]'''. The [grid] must contain nested [row], [column] and [grid] tags which describe the layout of the window. (More information can be found in [[GUILayout]]; suffice to say that the basic structure is grid -> row -> column -> widget, where the widget is considered to be in a cell defined by the row and column of the grid. A list of widgets can be found at [[GUIWidgetInstanceWML]].)<br />
<br />
Two optional functions can be passed as second and third arguments; the first one is called once the dialog is created and before it is shown; the second one is called once the dialog is closed. These functions are helpful in setting the initial values of the fields and in recovering the final user values. These functions can call the [[#wesnoth.set_dialog_value]], [[#wesnoth.get_dialog_value]], and [[#wesnoth.set_dialog_callback]] functions for this purpose.<br />
<br />
This function should be called in conjunction with [[LuaWML:Misc#wesnoth.synchronize_choice|#wesnoth.synchronize_choice]], in order to ensure that only one client displays the dialog and that the other ones recover the same input values from this single client.<br />
<br />
The example below defines a dialog with a list and two buttons on the left, and a big image on the right. The ''preshow'' function fills the list and defines a callback on it. This ''select'' callback changes the displayed image whenever a new list item is selected. The ''postshow'' function recovers the selected item before the dialog is destroyed.<br />
<br />
local helper = wesnoth.require "lua/helper.lua"<br />
local T = helper.set_wml_tag_metatable {}<br />
local _ = wesnoth.textdomain "wesnoth"<br />
<br />
local dialog = {<br />
T.tooltip { id = "tooltip_large" },<br />
T.helptip { id = "tooltip_large" },<br />
T.grid { T.row {<br />
T.column { T.grid {<br />
T.row { T.column { horizontal_grow = true, T.listbox { id = "the_list",<br />
T.list_definition { T.row { T.column { horizontal_grow = true,<br />
T.toggle_panel { T.grid { T.row {<br />
T.column { horizontal_alignment = "left", T.label { id = "the_label" } },<br />
T.column { T.image { id = "the_icon" } }<br />
} } }<br />
} } }<br />
} } },<br />
T.row { T.column { T.grid { T.row {<br />
T.column { T.button { id = "ok", label = _"OK" } },<br />
T.column { T.button { id = "cancel", label = _"Cancel" } }<br />
} } } }<br />
} },<br />
T.column { T.image { id = "the_image" } }<br />
} }<br />
}<br />
<br />
local function preshow()<br />
local t = { "Ancient Lich", "Ancient Wose", "Elvish Avenger" }<br />
local function select()<br />
local i = wesnoth.get_dialog_value "the_list"<br />
local ut = wesnoth.unit_types[t[i]].__cfg<br />
wesnoth.set_dialog_value(string.gsub(ut.profile, "([^/]+)$", "transparent/%1"), "the_image")<br />
end<br />
wesnoth.set_dialog_callback(select, "the_list")<br />
for i,v in ipairs(t) do<br />
local ut = wesnoth.unit_types[v].__cfg<br />
wesnoth.set_dialog_value(ut.name, "the_list", i, "the_label")<br />
wesnoth.set_dialog_value(ut.image, "the_list", i, "the_icon")<br />
end<br />
wesnoth.set_dialog_value(2, "the_list")<br />
select()<br />
end<br />
<br />
local li = 0<br />
local function postshow()<br />
li = wesnoth.get_dialog_value "the_list"<br />
end<br />
<br />
local r = wesnoth.show_dialog(dialog, preshow, postshow)<br />
wesnoth.message(string.format("Button %d pressed. Item %d selected.", r, li))<br />
<br />
==== wesnoth.set_dialog_value ====<br />
<br />
* '''wesnoth.set_dialog_value(''value'', ''path, to, widget, id'')'''<br />
<br />
Sets the value of a widget on the current dialog. The value is given by the first argument; its semantic depends on the type of widget it is applied to. The last argument is the ''id'' of the widget. If it does not point to a unique widget in the dialog, some discriminating parents should be given on its left, making a path that is read from left to right by the engine. The row of a list is specified by giving the ''id' of the list as a first argument and the 1-based row number as the next argument.<br />
<br />
-- sets the value of a widget "bar" in the 7th row of the list "foo"<br />
wesnoth.set_dialog_value(_"Hello world", "foo", 7, "bar")<br />
<br />
Notes: When the row of a list does not exist, it is created. The value associated to a list is the selected row.<br />
<br />
==== wesnoth.get_dialog_value ====<br />
<br />
* '''wesnoth.get_dialog_value(''path, to, widget, id'')'''<br />
<br />
Gets the value of a widget on the current dialog. The arguments described the path for reaching the widget (see [[#wesnoth.set_dialog_value]]).<br />
<br />
{{DevFeature1.13|0}}<br />
For treeviews this function returns a table descibing the currently selected node.<br />
If for example in this treeview<br />
+Section1<br />
+Subsection11<br />
*Item1<br />
*Item2<br />
*Item3<br />
+Subsection12<br />
*Item4<br />
*Item5<br />
*Item6<br />
+Section2<br />
+Subsection21<br />
*Item7<br />
*Item8<br />
*Item9<br />
+Subsection22<br />
*Item10<br />
*Item11<br />
*Item12<br />
Item 9 is selcted the value will be {2,1,3}<br />
<br />
==== wesnoth.set_dialog_active ====<br />
<br />
* '''wesnoth.set_dialog_active(''active?'', ''path, to, widget, id'')'''<br />
<br />
Enables or disables a widget. The first argument is a boolean specifying whether the widget should be active (true) or inactive (false). The remaining arguments are the path to locate the widget in question (see [[#wesnoth.set_dialog_value]]).<br />
<br />
==== wesnoth.set_dialog_callback ====<br />
<br />
* '''wesnoth.set_dialog_callback(''callback_function'', ''path, to, widget, id'')'''<br />
<br />
Sets the first argument as a callback function for the widget obtained by following the path of the other arguments (see [[#wesnoth.set_dialog_value]]). This function will be called whenever the user modifies something about the widget, so that the dialog can react to it.<br />
<br />
==== wesnoth.set_dialog_markup ====<br />
<br />
* '''wesnoth.set_dialog_markup(''allowed?'', ''path, to, widget, id'')'''<br />
<br />
Sets the flag associated to a widget to enable or disable Pango markup. The new flag value is passed as the first argument (boolean), and the widget to modify is obtained by following the path of the other arguments (see [[#wesnoth.set_dialog_value]]). Most widgets start with Pango markup disabled unless this function is used to set their flag to true.<br />
<br />
wesnoth.set_dialog_markup(true, "notice_label")<br />
wesnoth.set_dialog_value("&lt;big&gt;NOTICE!&lt;/big&gt;", "notice_label")<br />
<br />
==== wesnoth.set_dialog_focus ====<br />
<br />
* '''wesnoth.set_dialog_focus(''focused?'', ''path, to, widget, id'')'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Switches the keyboard focus to the widget found following the given path (see [[#wesnoth.set_dialog_value]]). This is often useful for dialogs containing a central listbox, so that it can be controlled with the keyboard as soon as it is displayed.<br />
<br />
wesnoth.set_dialog_focus("my_listbox")<br />
<br />
==== wesnoth.set_dialog_visible ====<br />
<br />
* '''wesnoth.set_dialog_visible(''visible?'', ''path, to, widget, id'')'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Sets a widget's visibility status. The new status is passed as the first argument, and the path to the widget is specified by the remaining arguments (see [[#wesnoth.set_dialog_value]]). The following visibility statuses are recognized:<br />
<br />
{| clasS="wikitable"<br />
! String value !! Boolean shorthand !! Meaning<br />
|-<br />
| visible || true || The widget is visible and handles events.<br />
|-<br />
| hidden || || The widget is not visible, doesn't handle events, but still takes up space on the dialog grid.<br />
|-<br />
| invisible || false || The widget is not visible, doesn't handle events, and does not take up space on the dialog grid.<br />
|}<br />
<br />
wesnoth.set_dialog_visible(false, "secret_button")<br />
<br />
==== wesnoth.set_dialog_canvas ====<br />
<br />
* '''wesnoth.set_dialog_canvas(''index'', ''content'', ''path, to, widget, id'')'''<br />
<br />
Sets the WML passed as the second argument as the canvas content (index given by the first argument) of the widget obtained by following the path of the other arguments (see [[#wesnoth.set_dialog_value]]). The content of the WML table is described at [[GUICanvasWML]].<br />
<br />
-- draw two rectangles in the upper-left corner of the window (empty path = window widget)<br />
wesnoth.set_dialog_canvas(2, {<br />
T.rectangle { x = 20, y = 20, w = 20, h = 20, fill_color= "0,0,255,255" },<br />
T.rectangle { x = 30, y = 30, w = 20, h = 20, fill_color = "255,0,0,255" }<br />
})<br />
<br />
The meaning of the canvas index depends on the chosen widget. It may be the disabled / enabled states of the widget, or its background / foreground planes, or... For instance, overwriting canvas 1 of the window with an empty canvas causes the window to become transparent.<br />
<br />
==== wesnoth.add_dialog_tree_node ====<br />
<br />
* '''wesnoth.add_dialog_tree_node(''type'', ''index'', ''path, to, widget, id'')'''<br />
<br />
{{DevFeature1.13|0}}<br />
<br />
Adds a childnode to a treeview widget or a treeview node. The type (id of the node definition) of the node is passed in the first parameter. The second parameter (integer) spcifies where the node should be inserted in the parentnode. The other arguments describe the path of the parent treeview (-node)<br />
<br />
==== wesnoth.remove_dialog_item ====<br />
<br />
* '''wesnoth.remove_dialog_item(''index'', ''count'', ''path, to, widget, id'')'''<br />
<br />
{{DevFeature1.13|1}}<br />
<br />
Removes an item from a listbox, a multipage or a treeview. First parameter is the index of the item to delete, second parameter is the number of items to delete and the remaining parameters describe the path to the listbox, the multipage or the parent treview node.<br />
<br />
==== wesnoth.is_skipping_messages ====<br />
<br />
* '''wesnoth.is_skipping_messages()'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Returns true if messages are currently being skipped, for example because the player has chosen to skip replay, or has pressed escape to dismiss a message.<br />
<br />
==== wesnoth.skip_messages ====<br />
<br />
* '''wesnoth.skip_messages([''skip?'')'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Sets the skip messages flag. By default it sets it to true, but you can also pass false to unset the flag.<br />
<br />
==== wesnoth.get_displayed_unit ====<br />
<br />
* '''wesnoth.get_displayed_unit()'''<br />
<br />
Returns a proxy to the unit currently displayed in the side pane of the user interface, if any.<br />
<br />
local name = tostring(wesnoth.get_displayed_unit().name)<br />
<br />
==== wesnoth.theme_items ====<br />
<br />
This field is not a function but an associative table. It links item names to the functions that describe their content. These functions are called whenever the user interface is refreshed. The description of an item is a WML table containing '''[element]''' children. Each subtag shall contain either a '''text''' or an '''image''' field that is displayed to the user. It can also contain a '''tooltip''' field that is displayed to the user when moused over, and a "help" field that points to the help section that is displayed when the user clicks on the theme item.<br />
<br />
Note that the ''wesnoth.theme_items'' table is originally empty and using ''pairs'' or ''next'' on it will not return the items from the current theme. Its metatable ensures that the drawing functions of existing items can be recovered though, as long as their name is known. The example below shows how to modify the ''unit_status'' item to display a custom status:<br />
<br />
local old_unit_status = wesnoth.theme_items.unit_status<br />
function wesnoth.theme_items.unit_status()<br />
local u = wesnoth.get_displayed_unit()<br />
if not u then return {} end<br />
local s = old_unit_status()<br />
if u.status.entangled then<br />
table.insert(s, { "element", {<br />
image = "entangled.png",<br />
tooltip = _"entangled: This unit is entangled. It cannot move but it can still attack."<br />
} })<br />
end<br />
return s<br />
end<br />
<br />
The following is a list of valid entries in wesnoth.theme_items which will have an effect in the game. Unfortunately when this feature was created the full range of capabilities of the feature was never properly documented. The following list is automatically generated. To find out what each entry will do, you will have to make guesses and experiment, or read the source code at src/reports.cpp. If you find out what an entry does, you are more than welcome to edit the wiki and give a proper description to any of these fields.<br />
<br />
* '''unit_name'''<br />
* '''selected_unit_name'''<br />
* '''unit_type'''<br />
* '''selected_unit_type'''<br />
* '''unit_race'''<br />
* '''selected_unit_race'''<br />
* '''unit_side'''<br />
* '''selected_unit_side'''<br />
* '''unit_level'''<br />
* '''selected_unit_level'''<br />
* '''unit_amla'''<br />
* '''unit_traits'''<br />
* '''selected_unit_traits'''<br />
* '''unit_status'''<br />
* '''selected_unit_status'''<br />
* '''unit_alignment'''<br />
* '''selected_unit_alignment'''<br />
* '''unit_abilities'''<br />
* '''selected_unit_abilities'''<br />
* '''unit_hp'''<br />
* '''selected_unit_hp'''<br />
* '''unit_xp'''<br />
* '''selected_unit_xp'''<br />
* '''unit_advancement_options'''<br />
* '''selected_unit_advancement_options'''<br />
* '''unit_defense'''<br />
* '''selected_unit_defense'''<br />
* '''unit_vision'''<br />
* '''selected_unit_vision'''<br />
* '''unit_moves'''<br />
* '''selected_unit_moves'''<br />
* '''unit_weapons'''<br />
* '''highlighted_unit_weapons'''<br />
* '''selected_unit_weapons'''<br />
* '''unit_image'''<br />
* '''selected_unit_image'''<br />
* '''selected_unit_profile'''<br />
* '''unit_profile'''<br />
* '''tod_stats'''<br />
* '''time_of_day'''<br />
* '''unit_box'''<br />
* '''turn'''<br />
* '''gold'''<br />
* '''villages'''<br />
* '''num_units'''<br />
* '''upkeep'''<br />
* '''expenses'''<br />
* '''income'''<br />
* '''terrain_info'''<br />
* '''terrain'''<br />
* '''zoom_level'''<br />
* '''position'''<br />
* '''side_playing'''<br />
* '''observers'''<br />
* '''selected_terrain'''<br />
* '''edit_left_button_function'''<br />
* '''report_clock'''<br />
* '''report_countdown'''<br />
<br />
==== helper.get_user_choice ====<br />
<br />
* '''helper.get_user_choice(''message_table'', ''options'')'''<br />
<br />
Displays a WML message box querying a choice from the user. Attributes and options are taken from given tables (see [[InterfaceActionsWML#.5Bmessage.5D|[message]]]). The index of the selected option is returned.<br />
<br />
local result = helper.get_user_choice({ speaker = "narrator" }, { "Choice 1", "Choice 2" })<br />
<br />
[[Category: Lua Reference]]</div>Dornhttps://wiki.wesnoth.org/index.php?title=LuaWML/Display&diff=57160LuaWML/Display2016-02-19T19:04:27Z<p>Dorn: /* wesnoth.set_dialog_value */ fixed example</p>
<hr />
<div>This page describes the [[LuaWML]] functions and helpers for interfacing with the user.<br />
<br />
==== wesnoth.message ====<br />
<br />
* '''wesnoth.message([''speaker'',] ''message'')'''<br />
<br />
Displays a string in the chat window and dumps it to the lua/info log domain (''--log-info=scripting/lua'' on the command-line).<br />
<br />
wesnoth.message "Hello World!"<br />
<br />
The chat line header is "<Lua>" by default, but it can be changed by passing a string before the message.<br />
<br />
wesnoth.message("Big Brother", "I'm watching you.") -- will result in "&lt;Big Brother&gt; I'm watching you."<br />
<br />
See also [[LuaWML:Events#helper.wml_error|helper.wml_error]] for displaying error messages.<br />
<br />
==== wesnoth.clear_messages ====<br />
<br />
* '''wesnoth.clear_messages()'''<br />
<br />
Removes all messages from the chat window. No argument or returned values.<br />
<br />
==== wesnoth.textdomain ====<br />
<br />
* '''wesnoth.textdomain(''domain'')'''<br />
<br />
Creates a function proxy for lazily translating strings from the given domain.<br />
<br />
-- #textdomain "my-campaign"<br />
-- the comment above ensures the subsequent strings will be extracted to the proper domain<br />
_ = wesnoth.textdomain "my-campaign"<br />
wesnoth.set_variable("my_unit.description", _ "the unit formerly known as Hero")<br />
<br />
The metatable of the function proxy appears as '''"message domain"'''. The metatable of the translatable strings (results of the proxy) appears as '''"translatable string"'''.<br />
<br />
The translatable strings can be appended to other strings/numbers with the standard '''..''' operator. Translation can be forced with the standard '''tostring''' operator in order to get a plain string.<br />
<br />
wesnoth.message(string.format(tostring(_ "You gain %d gold."), amount))<br />
<br />
==== wesnoth.delay ====<br />
<br />
* '''wesnoth.delay(''milliseconds'')'''<br />
<br />
Delays the engine like the [delay] tag. one argument: time to delay in milliseconds<br />
<br />
wesnoth.delay(500)<br />
<br />
==== wesnoth.float_label ====<br />
<br />
* '''wesnoth.float_label(''x'', ''y'', ''text'')'''<br />
<br />
Pops some text above a map tile.<br />
<br />
wesnoth.float_label(unit.x, unit.y, "&lt;span color='#ff0000'&gt;Ouch&lt;/span&gt;")<br />
<br />
==== wesnoth.select_hex ====<br />
<br />
* '''wesnoth.select_hex(''x'', ''y'', [''show_movement'', [''fire_events'']])'''<br />
<br />
Selects the given location in the game map as if the player would have clicked onto it.<br />
Argument 3: boolean, whether to show the movement range of any unit on that location (def: true)<br />
Argument 4: boolean, whether to fire any select events (def: false)<br />
<br />
wesnoth.select_hex(14,6, true, true)<br />
<br />
==== wesnoth.deselect_hex ====<br />
<br />
* '''wesnoth.deselect_hex()'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Reverses any select_hex call, leaving all locations unhighlighted. Takes no arguments.<br />
<br />
==== wesnoth.scroll_to_tile ====<br />
<br />
* '''wesnoth.scroll_to_tile(''x'', ''y'', [''only_if_visible'', [''instant'']])'''<br />
<br />
Scrolls the map to the given location. If true is passed as the third parameter, scrolling is disabled if the tile is hidden under the fog. If true is passed as the fourth parameter, the view instantly warps to the location regardless of the scroll speed setting in Preferences.<br />
<br />
local u = wesnoth.get_units({ id = "hero" })[1]<br />
wesnoth.scroll_to_tile(u.x, u.y)<br />
<br />
==== wesnoth.lock_view ====<br />
<br />
* '''wesnoth.lock_view(''lock'')'''<br />
<br />
Locks or unlocks gamemap view scrolling for human players. If true is passed as the first parameter, the view is locked; pass false to unlock.<br />
<br />
Human players cannot scroll the gamemap view as long as it is locked, but Lua or WML actions such as wesnoth.scroll_to_tile still can; the locked/unlocked state is preserved when saving the current game. This feature is generally intended to be used in cutscenes to prevent the player scrolling away from scripted actions.<br />
<br />
wesnoth.lock_view(true)<br />
wesnoth.scroll_to_tile(12, 14, false, true)<br />
<br />
==== wesnoth.view_locked ====<br />
<br />
* '''wesnoth.view_locked()'''<br />
<br />
Returns a boolean indicating whether gamemap view scrolling is currently locked.<br />
<br />
==== wesnoth.play_sound ====<br />
<br />
* '''wesnoth.play_sound(''sound'', [''repeat_count''])'''<br />
<br />
Plays the given sound file once, optionally repeating it one or more more times if an integer value is provided as a second argument (note that the sound is ''repeated'' the number of times specified in the second argument, i.e. a second argument of 4 will cause the sound to be played once and then repeated four more times for a total of 5 plays. See the example below).<br />
<br />
wesnoth.play_sound "ambient/birds1.ogg"<br />
wesnoth.play_sound("magic-holy-miss-3.ogg", 4) -- played 1 + 4 = 5 times<br />
<br />
==== wesnoth.set_music ====<br />
<br />
* '''wesnoth.set_music(''music_entry'')'''<br />
<br />
Sets the given table as an entry into the music list. See [[MusicListWML]] for the recognized attributes.<br />
<br />
wesnoth.set_music { name = "traveling_minstrels.ogg" }<br />
<br />
Passing no argument forces the engine to take into account all the recent changes to the music list. (Note: this is done automatically when sequences of WML commands end, so it is useful only for long events.)<br />
<br />
==== wesnoth.show_message_dialog ====<br />
<br />
* '''wesnoth.show_message_dialog(''attributes'', [''options'', [''text_input_attributes'']])'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Shows a message dialog, of the type used by the [message] ActionWML tag. Unlike the [message] tag, this is unsynced; if you need it synced, you must do it yourself. The first argument is a table describing the dialog with the following keys:<br />
<br />
* ''title'' - The title to show on the message. For example, the speaker's name.<br />
* ''message'' - The message content.<br />
* ''portrait'' - An image to show along with the message. By default, no image is shown.<br />
* ''left_side'' - The default is true; set to false to show the image on the right.<br />
* ''mirror'' - If true, the image will be flipped horizontally.<br />
<br />
The second argument is a list of options as a Lua array. Each option is either a (possibly-translatable) string or a config with [[DescriptionWML#WML_Format|DescriptionWML]] keys. The array itself can also have an optional '''default''' key which if present should be the index of the initially selected option (useful if you don't need full DescriptionWML but want to set a default). If present it overrides any defaults set in individual options.<br />
<br />
The third argument is a table describing the text input field with the following keys:<br />
<br />
* ''label'' - A label to show to the left of the text field.<br />
* ''text'' - Initial contents of the text field.<br />
* ''max_length'' - Maximum input length in characters (defaults to 256).<br />
<br />
You need at least one key for the text input to be shown. Both the second arguments are option, but if you want text input with no options, you must pass nil for the second parameter.<br />
<br />
This function returns two values. The first is the numeric result of the dialog. If there are no options and no text input, this is -2 if the user closed by pressing Escape, otherwise it's -1. If there are options, this is the index of the option chosen (starting from 1). If there is text input but no options, the first return value is 0. If there was text input, the second value contains the text entered.<br />
<br />
Example:<br />
<br />
wesnoth.show_message_dialog({<br />
title = "Make your choice:",<br />
message = "Select an option and enter some text.",<br />
portrait = "wesnoth-icon.png",<br />
}, {<br />
"The first choice is always the best!",<br />
"Pick me! Second choices are better!",<br />
"You know you want the third option!",<br />
}, {<br />
label = "Text:",<br />
text = "?",<br />
max_length = 16<br />
})<br />
<br />
(You don't have to format it like that, of course.)<br />
<br />
==== wesnoth.show_popup_dialog ====<br />
<br />
* '''wesnoth.show_popup_dialog(''title'', ''message'', [''image''])'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Shows a simple popup dialog in the centre of the screen. Takes three arguments, which in order are:<br />
<br />
# A title string for the dialog<br />
# The message content for the dialog.<br />
# An image to show.<br />
<br />
Both the title and the message support Pango markup. The image is optional.<br />
<br />
==== wesnoth.show_dialog ====<br />
<br />
* '''wesnoth.show_dialog(''wml_dialog_table'', [''pre_show_function'', [''post_show_function'']])'''<br />
<br />
Displays a dialog box described by a WML table and returns:<br />
* if the dialog was dismissed by a button click, the integer value associated to the button via the "return_value" keyword.<br />
* if the dialog was closed with the enter key, -1.<br />
* if the dialog was closed with the escape key, -2.<br />
<br />
The dialog box is equivalent to the resolution section of a GUI window as described in [[GUIToolkitWML#Window_definition|GUIToolkitWML]] and must therefore contain at least the following children: '''[tooltip]''', '''[helptip]''', and '''[grid]'''. The [grid] must contain nested [row], [column] and [grid] tags which describe the layout of the window. (More information can be found in [[GUILayout]]; suffice to say that the basic structure is grid -> row -> column -> widget, where the widget is considered to be in a cell defined by the row and column of the grid. A list of widgets can be found at [[GUIWidgetInstanceWML]].)<br />
<br />
Two optional functions can be passed as second and third arguments; the first one is called once the dialog is created and before it is shown; the second one is called once the dialog is closed. These functions are helpful in setting the initial values of the fields and in recovering the final user values. These functions can call the [[#wesnoth.set_dialog_value]], [[#wesnoth.get_dialog_value]], and [[#wesnoth.set_dialog_callback]] functions for this purpose.<br />
<br />
This function should be called in conjunction with [[LuaWML:Misc#wesnoth.synchronize_choice|#wesnoth.synchronize_choice]], in order to ensure that only one client displays the dialog and that the other ones recover the same input values from this single client.<br />
<br />
The example below defines a dialog with a list and two buttons on the left, and a big image on the right. The ''preshow'' function fills the list and defines a callback on it. This ''select'' callback changes the displayed image whenever a new list item is selected. The ''postshow'' function recovers the selected item before the dialog is destroyed.<br />
<br />
local helper = wesnoth.require "lua/helper.lua"<br />
local T = helper.set_wml_tag_metatable {}<br />
local _ = wesnoth.textdomain "wesnoth"<br />
<br />
local dialog = {<br />
T.tooltip { id = "tooltip_large" },<br />
T.helptip { id = "tooltip_large" },<br />
T.grid { T.row {<br />
T.column { T.grid {<br />
T.row { T.column { horizontal_grow = true, T.listbox { id = "the_list",<br />
T.list_definition { T.row { T.column { horizontal_grow = true,<br />
T.toggle_panel { T.grid { T.row {<br />
T.column { horizontal_alignment = "left", T.label { id = "the_label" } },<br />
T.column { T.image { id = "the_icon" } }<br />
} } }<br />
} } }<br />
} } },<br />
T.row { T.column { T.grid { T.row {<br />
T.column { T.button { id = "ok", label = _"OK" } },<br />
T.column { T.button { id = "cancel", label = _"Cancel" } }<br />
} } } }<br />
} },<br />
T.column { T.image { id = "the_image" } }<br />
} }<br />
}<br />
<br />
local function preshow()<br />
local t = { "Ancient Lich", "Ancient Wose", "Elvish Avenger" }<br />
local function select()<br />
local i = wesnoth.get_dialog_value "the_list"<br />
local ut = wesnoth.unit_types[t[i]].__cfg<br />
wesnoth.set_dialog_value(string.gsub(ut.profile, "([^/]+)$", "transparent/%1"), "the_image")<br />
end<br />
wesnoth.set_dialog_callback(select, "the_list")<br />
for i,v in ipairs(t) do<br />
local ut = wesnoth.unit_types[v].__cfg<br />
wesnoth.set_dialog_value(ut.name, "the_list", i, "the_label")<br />
wesnoth.set_dialog_value(ut.image, "the_list", i, "the_icon")<br />
end<br />
wesnoth.set_dialog_value(2, "the_list")<br />
select()<br />
end<br />
<br />
local li = 0<br />
local function postshow()<br />
li = wesnoth.get_dialog_value "the_list"<br />
end<br />
<br />
local r = wesnoth.show_dialog(dialog, preshow, postshow)<br />
wesnoth.message(string.format("Button %d pressed. Item %d selected.", r, li))<br />
<br />
==== wesnoth.set_dialog_value ====<br />
<br />
* '''wesnoth.set_dialog_value(''value'', ''path, to, widget, id'')'''<br />
<br />
Sets the value of a widget on the current dialog. The value is given by the first argument; its semantic depends on the type of widget it is applied to. The last argument is the ''id'' of the widget. If it does not point to a unique widget in the dialog, some discriminating parents should be given on its left, making a path that is read from left to right by the engine. The row of a list is specified by giving the ''id' of the list as a first argument and the 1-based row number as the next argument.<br />
<br />
-- sets the value of a widget "bar" in the 7th row of the list "foo"<br />
wesnoth.set_dialog_value(_"Hello world", "foo", 7, "bar")<br />
<br />
Notes: When the row of a list does not exist, it is created. The value associated to a list is the selected row.<br />
<br />
==== wesnoth.get_dialog_value ====<br />
<br />
* '''wesnoth.get_dialog_value(''path, to, widget, id'')'''<br />
<br />
Gets the value of a widget on the current dialog. The arguments described the path for reaching the widget (see [[#wesnoth.set_dialog_value]]).<br />
<br />
{{DevFeature1.13|0}}<br />
For treeviews this function returns a table descibing the currently selected node.<br />
If for example in this treeview<br />
+Section1<br />
+Subsection11<br />
*Item1<br />
*Item2<br />
*Item3<br />
+Subsection12<br />
*Item4<br />
*Item5<br />
*Item6<br />
+Section2<br />
+Subsection21<br />
*Item7<br />
*Item8<br />
*Item9<br />
+Subsection22<br />
*Item10<br />
*Item11<br />
*Item12<br />
Item 9 is selcted the value will be {2,1,3}<br />
<br />
==== wesnoth.set_dialog_active ====<br />
<br />
* '''wesnoth.set_dialog_active(''active?'', ''path, to, widget, id'')'''<br />
<br />
Enables or disables a widget. The first argument is a boolean specifying whether the widget should be active (true) or inactive (false). The remaining arguments are the path to locate the widget in question (see [[#wesnoth.set_dialog_value]]).<br />
<br />
==== wesnoth.set_dialog_callback ====<br />
<br />
* '''wesnoth.set_dialog_callback(''callback_function'', ''path, to, widget, id'')'''<br />
<br />
Sets the first argument as a callback function for the widget obtained by following the path of the other arguments (see [[#wesnoth.set_dialog_value]]). This function will be called whenever the user modifies something about the widget, so that the dialog can react to it.<br />
<br />
==== wesnoth.set_dialog_markup ====<br />
<br />
* '''wesnoth.set_dialog_markup(''allowed?'', ''path, to, widget, id'')'''<br />
<br />
Sets the flag associated to a widget to enable or disable Pango markup. The new flag value is passed as the first argument (boolean), and the widget to modify is obtained by following the path of the other arguments (see [[#wesnoth.set_dialog_value]]). Most widgets start with Pango markup disabled unless this function is used to set their flag to true.<br />
<br />
wesnoth.set_dialog_markup(true, "notice_label")<br />
wesnoth.set_dialog_value("&lt;big&gt;NOTICE!&lt;/big&gt;", "notice_label")<br />
<br />
==== wesnoth.set_dialog_focus ====<br />
<br />
* '''wesnoth.set_dialog_focus(''focused?'', ''path, to, widget, id'')'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Switches the keyboard focus to the widget found following the given path (see [[#wesnoth.set_dialog_value]]). This is often useful for dialogs containing a central listbox, so that it can be controlled with the keyboard as soon as it is displayed.<br />
<br />
wesnoth.set_dialog_focus("my_listbox")<br />
<br />
==== wesnoth.set_dialog_visible ====<br />
<br />
* '''wesnoth.set_dialog_visible(''visible?'', ''path, to, widget, id'')'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Sets a widget's visibility status. The new status is passed as the first argument, and the path to the widget is specified by the remaining arguments (see [[#wesnoth.set_dialog_value]]). The following visibility statuses are recognized:<br />
<br />
{| clasS="wikitable"<br />
! String value !! Boolean shorthand !! Meaning<br />
|-<br />
| visible || true || The widget is visible and handles events.<br />
|-<br />
| hidden || || The widget is not visible, doesn't handle events, but still takes up space on the dialog grid.<br />
|-<br />
| invisible || false || The widget is not visible, doesn't handle events, and does not take up space on the dialog grid.<br />
|}<br />
<br />
wesnoth.set_dialog_visible(false, "secret_button")<br />
<br />
==== wesnoth.set_dialog_canvas ====<br />
<br />
* '''wesnoth.set_dialog_value(''index'', ''content'', ''path, to, widget, id'')'''<br />
<br />
Sets the WML passed as the second argument as the canvas content (index given by the first argument) of the widget obtained by following the path of the other arguments (see [[#wesnoth.set_dialog_value]]). The content of the WML table is described at [[GUICanvasWML]].<br />
<br />
-- draw two rectangles in the upper-left corner of the window (empty path = window widget)<br />
wesnoth.set_dialog_canvas(2, {<br />
T.rectangle { x = 20, y = 20, w = 20, h = 20, fill_color= "0,0,255,255" },<br />
T.rectangle { x = 30, y = 30, w = 20, h = 20, fill_color = "255,0,0,255" }<br />
})<br />
<br />
The meaning of the canvas index depends on the chosen widget. It may be the disabled / enabled states of the widget, or its background / foreground planes, or... For instance, overwriting canvas 1 of the window with an empty canvas causes the window to become transparent.<br />
<br />
==== wesnoth.add_dialog_tree_node ====<br />
<br />
* '''wesnoth.add_dialog_tree_node(''type'', ''index'', ''path, to, widget, id'')'''<br />
<br />
{{DevFeature1.13|0}}<br />
<br />
Adds a childnode to a treeview widget or a treeview node. The type (id of the node definition) of the node is passed in the first parameter. The second parameter (integer) spcifies where the node should be inserted in the parentnode. The other arguments describe the path of the parent treeview (-node)<br />
<br />
==== wesnoth.remove_dialog_item ====<br />
<br />
* '''wesnoth.remove_dialog_item(''index'', ''count'', ''path, to, widget, id'')'''<br />
<br />
{{DevFeature1.13|1}}<br />
<br />
Removes an item from a listbox, a multipage or a treeview. First parameter is the index of the item to delete, second parameter is the number of items to delete and the remaining parameters describe the path to the listbox, the multipage or the parent treview node.<br />
<br />
==== wesnoth.is_skipping_messages ====<br />
<br />
* '''wesnoth.is_skipping_messages()'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Returns true if messages are currently being skipped, for example because the player has chosen to skip replay, or has pressed escape to dismiss a message.<br />
<br />
==== wesnoth.skip_messages ====<br />
<br />
* '''wesnoth.skip_messages([''skip?'')'''<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
Sets the skip messages flag. By default it sets it to true, but you can also pass false to unset the flag.<br />
<br />
==== wesnoth.get_displayed_unit ====<br />
<br />
* '''wesnoth.get_displayed_unit()'''<br />
<br />
Returns a proxy to the unit currently displayed in the side pane of the user interface, if any.<br />
<br />
local name = tostring(wesnoth.get_displayed_unit().name)<br />
<br />
==== wesnoth.theme_items ====<br />
<br />
This field is not a function but an associative table. It links item names to the functions that describe their content. These functions are called whenever the user interface is refreshed. The description of an item is a WML table containing '''[element]''' children. Each subtag shall contain either a '''text''' or an '''image''' field that is displayed to the user. It can also contain a '''tooltip''' field that is displayed to the user when moused over, and a "help" field that points to the help section that is displayed when the user clicks on the theme item.<br />
<br />
Note that the ''wesnoth.theme_items'' table is originally empty and using ''pairs'' or ''next'' on it will not return the items from the current theme. Its metatable ensures that the drawing functions of existing items can be recovered though, as long as their name is known. The example below shows how to modify the ''unit_status'' item to display a custom status:<br />
<br />
local old_unit_status = wesnoth.theme_items.unit_status<br />
function wesnoth.theme_items.unit_status()<br />
local u = wesnoth.get_displayed_unit()<br />
if not u then return {} end<br />
local s = old_unit_status()<br />
if u.status.entangled then<br />
table.insert(s, { "element", {<br />
image = "entangled.png",<br />
tooltip = _"entangled: This unit is entangled. It cannot move but it can still attack."<br />
} })<br />
end<br />
return s<br />
end<br />
<br />
The following is a list of valid entries in wesnoth.theme_items which will have an effect in the game. Unfortunately when this feature was created the full range of capabilities of the feature was never properly documented. The following list is automatically generated. To find out what each entry will do, you will have to make guesses and experiment, or read the source code at src/reports.cpp. If you find out what an entry does, you are more than welcome to edit the wiki and give a proper description to any of these fields.<br />
<br />
* '''unit_name'''<br />
* '''selected_unit_name'''<br />
* '''unit_type'''<br />
* '''selected_unit_type'''<br />
* '''unit_race'''<br />
* '''selected_unit_race'''<br />
* '''unit_side'''<br />
* '''selected_unit_side'''<br />
* '''unit_level'''<br />
* '''selected_unit_level'''<br />
* '''unit_amla'''<br />
* '''unit_traits'''<br />
* '''selected_unit_traits'''<br />
* '''unit_status'''<br />
* '''selected_unit_status'''<br />
* '''unit_alignment'''<br />
* '''selected_unit_alignment'''<br />
* '''unit_abilities'''<br />
* '''selected_unit_abilities'''<br />
* '''unit_hp'''<br />
* '''selected_unit_hp'''<br />
* '''unit_xp'''<br />
* '''selected_unit_xp'''<br />
* '''unit_advancement_options'''<br />
* '''selected_unit_advancement_options'''<br />
* '''unit_defense'''<br />
* '''selected_unit_defense'''<br />
* '''unit_vision'''<br />
* '''selected_unit_vision'''<br />
* '''unit_moves'''<br />
* '''selected_unit_moves'''<br />
* '''unit_weapons'''<br />
* '''highlighted_unit_weapons'''<br />
* '''selected_unit_weapons'''<br />
* '''unit_image'''<br />
* '''selected_unit_image'''<br />
* '''selected_unit_profile'''<br />
* '''unit_profile'''<br />
* '''tod_stats'''<br />
* '''time_of_day'''<br />
* '''unit_box'''<br />
* '''turn'''<br />
* '''gold'''<br />
* '''villages'''<br />
* '''num_units'''<br />
* '''upkeep'''<br />
* '''expenses'''<br />
* '''income'''<br />
* '''terrain_info'''<br />
* '''terrain'''<br />
* '''zoom_level'''<br />
* '''position'''<br />
* '''side_playing'''<br />
* '''observers'''<br />
* '''selected_terrain'''<br />
* '''edit_left_button_function'''<br />
* '''report_clock'''<br />
* '''report_countdown'''<br />
<br />
==== helper.get_user_choice ====<br />
<br />
* '''helper.get_user_choice(''message_table'', ''options'')'''<br />
<br />
Displays a WML message box querying a choice from the user. Attributes and options are taken from given tables (see [[InterfaceActionsWML#.5Bmessage.5D|[message]]]). The index of the selected option is returned.<br />
<br />
local result = helper.get_user_choice({ speaker = "narrator" }, { "Choice 1", "Choice 2" })<br />
<br />
[[Category: Lua Reference]]</div>Dornhttps://wiki.wesnoth.org/index.php?title=LuaWML/Variables&diff=57159LuaWML/Variables2016-02-19T19:00:22Z<p>Dorn: /* helper.get_nth_child */ fixed function syntax</p>
<hr />
<div>This page describes the [[LuaWML]] functions and helpers for handling WML variables and containers.<br />
<br />
==== wesnoth.get_variable ====<br />
<br />
* '''wesnoth.get_variable(''var_name'')'''<br />
<br />
Loads a WML variable with the given qualified name (argument 1) and converts it into a Lua object. Returns ''nil'' if the name does not point to anything, a scalar for a WML attribute, and a table for a WML object. The format of the table is described in [[LuaWML#Encoding WML objects into Lua tables]].<br />
<br />
wesnoth.fire("store_unit", { variable="my_unit", { "filter", { id="hero" } } })<br />
local heros_hp = wesnoth.get_variable("my_unit[0].hitpoints")<br />
wesnoth.message(string.format("The 'hero' unit has %d hitpoints.", heros_hp))<br />
<br />
Argument 2, if ''true'', prevents the recursive conversion when the name points to an object; a fresh empty table is returned in this case. This is mainly used for writing proxy objects, e.g. in [[#helper.set_wml_var_metatable]].<br />
<br />
Note that, if the variable name happens to designate a sequence of WML objects, only the first one (index 0) is fetched. If all the WML objects with this name should have been returned, use [[#helper.get_variable_array]] instead.<br />
<br />
==== wesnoth.set_variable ====<br />
<br />
* '''wesnoth.set_variable(''var_name'', ''value'')'''<br />
<br />
Converts and stores a Lua object (argument 2) to a WML variable (argument 1). A WML object is created for a table, an attribute otherwise.<br />
<br />
wesnoth.set_variable("my_unit.hitpoints", heros_hp + 10)<br />
<br />
Setting a WML variable to nil erases it.<br />
<br />
==== wesnoth.get_all_vars ====<br />
<br />
* '''wesnoth.get_all_vars()'''<br />
<br />
{{DevFeature1.13|0}} Returns all the WML variables currently set in form of a WML table. This function accepts no arguments.<br />
<br />
for key, value in pairs( wesnoth.get_all_vars() ) do<br />
if type( value ) == "table" then<br />
print( key, value[1], value[2] )<br />
else<br />
print( key, value )<br />
end<br />
end<br />
<br />
==== helper.set_wml_var_metatable ====<br />
<br />
* '''helper.set_wml_var_metatable{}'''<br />
<br />
Sets the metatable of a table so that it can be used to access WML variables. Returns the table. The fields of the tables are then proxies to the WML objects with the same names; reading/writing to them will directly access the WML variables.<br />
<br />
helper.set_wml_var_metatable(_G)<br />
my_persistent_variable = 42<br />
<br />
<br />
it's not reccomended to use helper.set_wml_var_metatable(_G) because that limits possible gobal variables to valid wml attributes or tables. This can have some surprising effects:<br />
<br />
c = { a= 9}<br />
d = c<br />
c.a = 8<br />
wesnoth.message(d.a) -- normaly prints 8 but prints 9 with helper.set_wml_var_metatable(_G)<br />
<br />
local lla = { {"a", {}}}<br />
lla[1][2] = lla<br />
la = lla -- crashes wesnoth with helper.set_wml_var_metatable(_G)<br />
<br />
helper = wesnoth.require("lua/helper.lua")<br />
helper.set_wml_var_metatable(_G)<br />
-- some code later (maybe in another addon)<br />
H = wesnoth.require("lua/helper.lua") -- fails because wesnoth.require("lua/helper.lua") doesn' return a valid wmltable..<br />
<br />
helper = wesnoth.require("lua/helper.lua")<br />
helper.set_wml_var_metatable(_G)<br />
-- some code later (maybe in another addon)<br />
T = helper.set_wml_tag_metatable {} -- doesn't work<br />
V = helper.set_wml_var_metatable({}) -- doesn't work<br />
<br />
even if you don't use such code in your addon it's still bad because other code of modifications or eras to be used with your addon might do. And you'll mess up their code. This is also true for SP campaigns because it might interfere with ai code and we plan to enable modifications in SP too.<br />
Instead you should use set_wml_var_metatable with another table ('V' in this example):<br />
<br />
V = helper.set_wml_var_metatable({})<br />
V.my_persistent_variable = 42<br />
<br />
==== helper.get_child ====<br />
<br />
* '''helper.get_child(''config'', ''child_tag_name'')'''<br />
<br />
Returns the first sub-tag of a WML object with the given name.<br />
<br />
local u = wesnoth.get_units({ id = "Delfador" })[1]<br />
local costs = helper.get_child(u.__cfg, "movement_costs")<br />
wesnoth.message(string.format("Delfador needs %d points to move through a forest.", costs.forest))<br />
<br />
If a third parameter is passed, only children having a ''id'' attribute equal to it are considered.<br />
<br />
==== helper.get_nth_child ====<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
* '''helper.get_nth_child(''config'', ''child_tag_name'', ''n'')'''<br />
<br />
Returns the ''n''th sub-tag of a WML object with the given name.<br />
<br />
==== helper.child_count ====<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
* '''helper.child_count(''config'', ''child_tag_name'')<br />
<br />
Returns the number of children in the config with the given tag name.<br />
<br />
==== helper.child_range ====<br />
<br />
* '''helper.child_range(''config'', ''child_tag_name'')'''<br />
<br />
Returns an iterator over all the sub-tags of a WML object with the given name.<br />
<br />
local u = wesnoth.get_units({ id = "Delfador" })[1]<br />
for att in helper.child_range(u.__cfg, "attack") do<br />
wesnoth.message(tostring(att.description))<br />
end<br />
<br />
==== helper.child_array ====<br />
<br />
{{DevFeature1.13|2}}<br />
<br />
* '''helper.child_array(''config'', ''child_tag_name'')'''<br />
<br />
Like helper.child_range, but returns an array instead of an iterator. Useful if you need random access to the children.<br />
<br />
==== helper.get_variable_array ====<br />
<br />
* '''helper.get_variable_array(''var_name'')'''<br />
<br />
Fetches all the WML container variables with given name and returns a table containing them (starting at index 1).<br />
<br />
function get_recall_list(side)<br />
wesnoth.fire("store_unit", { x = "recall", variable = "LUA_recall_list })<br />
local l = get_variable_array "LUA_recall_list"<br />
wesnoth.set_variable "LUA_recall_list"<br />
return l<br />
end<br />
<br />
==== helper.get_variable_proxy_array ====<br />
<br />
* '''helper.get_variable_proxy_array(''var_name'')'''<br />
<br />
Creates proxies for all the WML container variables with given name and returns a table containing them (starting at index 1). This function is similar to [[#helper.get_variable_array]], except that the proxies can be used for modifying WML containers.<br />
<br />
==== helper.set_variable_array ====<br />
<br />
* '''helper.set_variable_array(''varname'', ''array'')'''<br />
<br />
Creates WML container variables with given name from given table.<br />
<br />
helper.set_variable_array("target", { t1, t2, t3 })<br />
-- target[0] <- t1; target[1] <- t2; target[2] <- t3<br />
<br />
[[Category: Lua Reference]]</div>Dornhttps://wiki.wesnoth.org/index.php?title=SpellingMistakes&diff=56150SpellingMistakes2015-03-11T14:03:43Z<p>Dorn: /* The Hammer of Thursagan */</p>
<hr />
<div>This page is meant to be a list of spelling mistakes in campaigns and other translatable texts in the en_US development version of the game.<br />
<br />
Note: The house style of Wesnoth uses a good many words and constructions that are archaic, poetic, or dialectal. If you speak modern English as a second language you may incorrectly read these as errors. Please see [[NotSpellingMistakes]] for a list of things you will encounter that may look like spelling or usage errors but are not. Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.<br />
<br />
==Mainline Campaigns==<br />
<br />
===An Orcish Incursion===<br />
<br />
===Dead Water===<br />
<br />
===Delfador’s Memoirs===<br />
<br />
===Descent into Darkness===<br />
<br />
===Eastern Invasion===<br />
<br />
===Heir to the Throne===<br />
<br />
===Liberty===<br />
<br />
===Northern Rebirth===<br />
<br />
===Sceptre of Fire===<br />
Scenario 6_Towards_the_Caves<br />
<br />
Durstorn: It’s not yours to give, '''its''' mine, and Rugnur’s, and Baglur’s. > '''it’s''' mine<br />
<br />
Alanin: I’m not going to do that, '''its''' suicide! >> '''it’s''' suicide<br />
<br />
===Son of the Black Eye===<br />
<br />
===The Hammer of Thursagan===<br />
Scenario 07_Mages_and_Drakes<br />
<br />
* Ratheln: I’ll return with your apprentices as soon as I may.<br />
<br />
>> On NORMAL difficulty there is only one apprentice (Master Perrin: I’d like to send one of our senior apprentices with you to the east. It has come time for him to be journeyman...)<br />
<br />
<br />
Scenario 08_Fear<br />
<br />
* The presence of Master Perrin’s journeymen gives you the ability to recruit mages.<br />
<br />
>> There is only one journeyman on NORMAL/HARD difficulties<br />
<br />
* Aiglondur: "They are defeated" >> missing punctuation mark<br />
<br />
===The Legend of Wesmere===<br />
<br />
===The Rise of Wesnoth===<br />
<br />
===The South Guard===<br />
<br />
===Two Brothers===<br />
<br />
===Under the Burning Suns===<br />
<br />
==Wesnoth Game==<br />
<br />
===Editor===<br />
<br />
===Help===<br />
<br />
===Tutorial===<br />
<br />
===Manual===<br />
<br />
===Manpages===<br />
<br />
===Units===<br />
<br />
===Other (unit descriptions, ...)===<br />
<br />
===Multiplayer maps===<br />
<br />
===Translation code bugs===<br />
<br />
==Announcements==<br />
<br />
[[Category:Writing]]</div>Dornhttps://wiki.wesnoth.org/index.php?title=SpellingMistakes&diff=56149SpellingMistakes2015-03-11T14:00:36Z<p>Dorn: /* The Hammer of Thursagan */</p>
<hr />
<div>This page is meant to be a list of spelling mistakes in campaigns and other translatable texts in the en_US development version of the game.<br />
<br />
Note: The house style of Wesnoth uses a good many words and constructions that are archaic, poetic, or dialectal. If you speak modern English as a second language you may incorrectly read these as errors. Please see [[NotSpellingMistakes]] for a list of things you will encounter that may look like spelling or usage errors but are not. Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.<br />
<br />
==Mainline Campaigns==<br />
<br />
===An Orcish Incursion===<br />
<br />
===Dead Water===<br />
<br />
===Delfador’s Memoirs===<br />
<br />
===Descent into Darkness===<br />
<br />
===Eastern Invasion===<br />
<br />
===Heir to the Throne===<br />
<br />
===Liberty===<br />
<br />
===Northern Rebirth===<br />
<br />
===Sceptre of Fire===<br />
Scenario 6_Towards_the_Caves<br />
<br />
Durstorn: It’s not yours to give, '''its''' mine, and Rugnur’s, and Baglur’s. > '''it’s''' mine<br />
<br />
Alanin: I’m not going to do that, '''its''' suicide! >> '''it’s''' suicide<br />
<br />
===Son of the Black Eye===<br />
<br />
===The Hammer of Thursagan===<br />
Scenario 07_Mages_and_Drakes<br />
<br />
* Ratheln: I’ll return with your apprentices as soon as I may.<br />
<br />
>> On NORMAL difficulty there is only one apprentice (Master Perrin: I’d like to send one of our senior apprentices with you to the east. It has come time for him to be journeyman...)<br />
<br />
<br />
Scenario 08_Fear<br />
<br />
* The presence of Master Perrin’s journeymen gives you the ability to recruit mages.<br />
<br />
>> There is only one journeyman on NORMAL difficulty<br />
<br />
* Aiglondur: "They are defeated" >> missing punctuation mark<br />
<br />
===The Legend of Wesmere===<br />
<br />
===The Rise of Wesnoth===<br />
<br />
===The South Guard===<br />
<br />
===Two Brothers===<br />
<br />
===Under the Burning Suns===<br />
<br />
==Wesnoth Game==<br />
<br />
===Editor===<br />
<br />
===Help===<br />
<br />
===Tutorial===<br />
<br />
===Manual===<br />
<br />
===Manpages===<br />
<br />
===Units===<br />
<br />
===Other (unit descriptions, ...)===<br />
<br />
===Multiplayer maps===<br />
<br />
===Translation code bugs===<br />
<br />
==Announcements==<br />
<br />
[[Category:Writing]]</div>Dornhttps://wiki.wesnoth.org/index.php?title=SpellingMistakes&diff=56148SpellingMistakes2015-03-11T13:47:10Z<p>Dorn: /* Sceptre of Fire */</p>
<hr />
<div>This page is meant to be a list of spelling mistakes in campaigns and other translatable texts in the en_US development version of the game.<br />
<br />
Note: The house style of Wesnoth uses a good many words and constructions that are archaic, poetic, or dialectal. If you speak modern English as a second language you may incorrectly read these as errors. Please see [[NotSpellingMistakes]] for a list of things you will encounter that may look like spelling or usage errors but are not. Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.<br />
<br />
==Mainline Campaigns==<br />
<br />
===An Orcish Incursion===<br />
<br />
===Dead Water===<br />
<br />
===Delfador’s Memoirs===<br />
<br />
===Descent into Darkness===<br />
<br />
===Eastern Invasion===<br />
<br />
===Heir to the Throne===<br />
<br />
===Liberty===<br />
<br />
===Northern Rebirth===<br />
<br />
===Sceptre of Fire===<br />
Scenario 6_Towards_the_Caves<br />
<br />
Durstorn: It’s not yours to give, '''its''' mine, and Rugnur’s, and Baglur’s. > '''it’s''' mine<br />
<br />
Alanin: I’m not going to do that, '''its''' suicide! >> '''it’s''' suicide<br />
<br />
===Son of the Black Eye===<br />
<br />
===The Hammer of Thursagan===<br />
<br />
===The Legend of Wesmere===<br />
<br />
===The Rise of Wesnoth===<br />
<br />
===The South Guard===<br />
<br />
===Two Brothers===<br />
<br />
===Under the Burning Suns===<br />
<br />
==Wesnoth Game==<br />
<br />
===Editor===<br />
<br />
===Help===<br />
<br />
===Tutorial===<br />
<br />
===Manual===<br />
<br />
===Manpages===<br />
<br />
===Units===<br />
<br />
===Other (unit descriptions, ...)===<br />
<br />
===Multiplayer maps===<br />
<br />
===Translation code bugs===<br />
<br />
==Announcements==<br />
<br />
[[Category:Writing]]</div>Dornhttps://wiki.wesnoth.org/index.php?title=SpellingMistakes&diff=54322SpellingMistakes2014-04-01T23:20:21Z<p>Dorn: /* Under the Burning Suns */ Typo in WML code comment</p>
<hr />
<div>This page is meant to be a list of spelling mistakes in campaigns and other translatable texts in the en_US development version of the game.<br />
<br />
Note: The house style of Wesnoth uses a good many words and constructions that are archaic, poetic, or dialectal. If you speak modern English as a second language you may incorrectly read these as errors. Please see [[NotSpellingMistakes]] for a list of things you will encounter that may look like spelling or usage errors but are not. Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.<br />
<br />
==Mainline Campaigns==<br />
<br />
===An Orcish Incursion===<br />
scenario 06: for side=2, user_team_name=_"Orcs" should read user_team_name=_"Undead"<br />
<br />
===Dead Water===<br />
<br />
===Delfador’s Memoirs===<br />
<br />
===Descent into Darkness===<br />
<br />
===Eastern Invasion===<br />
<br />
===Heir to the Throne===<br />
<br />
===Liberty===<br />
<br />
===Northern Rebirth===<br />
*scenario 07a: "# Teleport three <b>spelccasters</b> near the sidekick to do some asskicking" should read <b>spellcasters</b><br />
*scenario 10a: "# Krash smells other drakes and leaves. If he's <b>allive</b> at this point." should read <b>alive</b><br />
<br />
===Sceptre of Fire===<br />
<br />
===Son of the Black Eye===<br />
<br />
===The Hammer of Thursagan===<br />
*scenario 01: "The dwarves <b>begin</b> mining their past for inspiration" should read <b>began</b><br />
*scenario 02: message=_"The Order thanks you, Lord Hamel" : punctuation mark is missing<br />
*scenario 12: "Freeing these prisoners is more of a blow to Karrag <b>then</b> we thought" should read <b>than</b><br />
<br />
*scenario 12: "If we can but find the key, we will able to open these doors." should read <b>we will be able</b><br />
<br />
===The Legend of Wesmere===<br />
<br />
===The Rise of Wesnoth===<br />
<br />
===The South Guard===<br />
<br />
03_A_Desperate_Errand NORMAL difficulty. When you kill off the bandits it says "I hope that’s the last of the bandits! How many more of these foul undead must we fight?" but there are no undead at this difficulty. Perhaps it could be changed to "foul creatures" or perhaps some weak undead could be added to the scenario.<br />
<br />
===Two Brothers===<br />
<br />
There seems to be a discrepancy in the dates given in the four scenarios:<br />
<br />
Scenario 1: 12 V, 363 YW<br />
<br><br />
Scenario 2: 16 V, 363 YW<br />
<br><br />
Scenario 3: 19 '''IV''', 363 YW<br />
<br><br />
Scenario 4: 27 V, 363 YW<br />
<br />
Should the date in scenario 3 be "19 '''V''', 363 YW"?<br />
<br />
(Note that the date appears twice in scenario 3.)<br />
<br />
('''not fixed''' as of commit b58d40d9fb8e9942591604b02b26f15343899f9b)<br />
<br />
===Under the Burning Suns===<br />
scenario 06a: "# damage done by <b>sanding</b> in lava" should read <b>standing</b><br />
<br />
==Wesnoth Game==<br />
<br />
===Editor===<br />
<br />
===Help===<br />
<br />
*"Undead", 1st paragraph: "An undead creature does not require the constant attention of the necromancer to command and sustain, but can work autonomously according to the commands of it's master." should be changed to "...of '''its''' master." (fixed in 74991da8aefad26c3745ee9dd508343e93431ce2)<br />
"Mountains", 1st paragraph, last sentence: "Both dwarves and trolls re native to mountainous terrain, and have a very easiy time getting around." should have "re" changed to "are", no comma before "and", and "easiy" to "easy". (fixed in faf00cb278b89906287d1c221e75ee83d090f371, with the exception of the comma still present)<br />
<br />
===Tutorial===<br />
<br />
===Manual===<br />
<br />
===Manpages===<br />
<br />
===Units===<br />
<br />
===1.11 Announcement===<br />
<br />
*One line of the development release line says this: "which might include quite many bugs." "Quite many" is not proper grammar. It should instead read: "which might include many bugs."<br />
<br />
===Other (unit descriptions, ...)===<br />
<br />
===Multiplayer maps===<br />
<br />
===Translation code bugs===<br />
<br />
==Unofficial campaigns==<br />
<br />
===Invasion from the Unknown===</div>Dornhttps://wiki.wesnoth.org/index.php?title=SpellingMistakes&diff=54288SpellingMistakes2014-03-28T21:07:40Z<p>Dorn: /* The Hammer of Thursagan */</p>
<hr />
<div>This page is meant to be a list of spelling mistakes in campaigns and other translatable texts in the en_US development version of the game.<br />
<br />
Note: The house style of Wesnoth uses a good many words and constructions that are archaic, poetic, or dialectal. If you speak modern English as a second language you may incorrectly read these as errors. Please see [[NotSpellingMistakes]] for a list of things you will encounter that may look like spelling or usage errors but are not. Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.<br />
<br />
==Mainline Campaigns==<br />
<br />
===An Orcish Incursion===<br />
scenario 06: for side=2, user_team_name=_"Orcs" should read user_team_name=_"Undead"<br />
<br />
===Dead Water===<br />
<br />
===Delfador’s Memoirs===<br />
<br />
===Descent into Darkness===<br />
<br />
===Eastern Invasion===<br />
<br />
===Heir to the Throne===<br />
<br />
===Liberty===<br />
<br />
===Northern Rebirth===<br />
*scenario 07a: "# Teleport three <b>spelccasters</b> near the sidekick to do some asskicking" should read <b>spellcasters</b><br />
*scenario 10a: "# Krash smells other drakes and leaves. If he's <b>allive</b> at this point." should read <b>alive</b><br />
<br />
===Sceptre of Fire===<br />
<br />
===Son of the Black Eye===<br />
<br />
===The Hammer of Thursagan===<br />
*scenario 01: "The dwarves <b>begin</b> mining their past for inspiration" should read <b>began</b><br />
*scenario 02: message=_"The Order thanks you, Lord Hamel" : punctuation mark is missing<br />
*scenario 12: "Freeing these prisoners is more of a blow to Karrag <b>then</b> we thought" should read <b>than</b><br />
<br />
*scenario 12: "If we can but find the key, we will able to open these doors." should read <b>we will be able</b><br />
<br />
===The Legend of Wesmere===<br />
<br />
===The Rise of Wesnoth===<br />
<br />
===The South Guard===<br />
<br />
03_A_Desperate_Errand NORMAL difficulty. When you kill off the bandits it says "I hope that’s the last of the bandits! How many more of these foul undead must we fight?" but there are no undead at this difficulty. Perhaps it could be changed to "foul creatures" or perhaps some weak undead could be added to the scenario.<br />
<br />
===Two Brothers===<br />
<br />
There seems to be a discrepancy in the dates given in the four scenarios:<br />
<br />
Scenario 1: 12 V, 363 YW<br />
<br><br />
Scenario 2: 16 V, 363 YW<br />
<br><br />
Scenario 3: 19 '''IV''', 363 YW<br />
<br><br />
Scenario 4: 27 V, 363 YW<br />
<br />
Should the date in scenario 3 be "19 '''V''', 363 YW"?<br />
<br />
(Note that the date appears twice in scenario 3.)<br />
<br />
('''not fixed''' as of commit b58d40d9fb8e9942591604b02b26f15343899f9b)<br />
<br />
===Under the Burning Suns===<br />
<br />
==Wesnoth Game==<br />
<br />
===Editor===<br />
<br />
===Help===<br />
<br />
*"Undead", 1st paragraph: "An undead creature does not require the constant attention of the necromancer to command and sustain, but can work autonomously according to the commands of it's master." should be changed to "...of '''its''' master." (fixed in 74991da8aefad26c3745ee9dd508343e93431ce2)<br />
"Mountains", 1st paragraph, last sentence: "Both dwarves and trolls re native to mountainous terrain, and have a very easiy time getting around." should have "re" changed to "are", no comma before "and", and "easiy" to "easy". (fixed in faf00cb278b89906287d1c221e75ee83d090f371, with the exception of the comma still present)<br />
<br />
===Tutorial===<br />
<br />
===Manual===<br />
<br />
===Manpages===<br />
<br />
===Units===<br />
<br />
===1.11 Announcement===<br />
<br />
*One line of the development release line says this: "which might include quite many bugs." "Quite many" is not proper grammar. It should instead read: "which might include many bugs."<br />
<br />
===Other (unit descriptions, ...)===<br />
<br />
===Multiplayer maps===<br />
<br />
===Translation code bugs===<br />
<br />
==Unofficial campaigns==<br />
<br />
===Invasion from the Unknown===</div>Dornhttps://wiki.wesnoth.org/index.php?title=SpellingMistakes&diff=54287SpellingMistakes2014-03-28T21:01:20Z<p>Dorn: /* Northern Rebirth */</p>
<hr />
<div>This page is meant to be a list of spelling mistakes in campaigns and other translatable texts in the en_US development version of the game.<br />
<br />
Note: The house style of Wesnoth uses a good many words and constructions that are archaic, poetic, or dialectal. If you speak modern English as a second language you may incorrectly read these as errors. Please see [[NotSpellingMistakes]] for a list of things you will encounter that may look like spelling or usage errors but are not. Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.<br />
<br />
==Mainline Campaigns==<br />
<br />
===An Orcish Incursion===<br />
scenario 06: for side=2, user_team_name=_"Orcs" should read user_team_name=_"Undead"<br />
<br />
===Dead Water===<br />
<br />
===Delfador’s Memoirs===<br />
<br />
===Descent into Darkness===<br />
<br />
===Eastern Invasion===<br />
<br />
===Heir to the Throne===<br />
<br />
===Liberty===<br />
<br />
===Northern Rebirth===<br />
*scenario 07a: "# Teleport three <b>spelccasters</b> near the sidekick to do some asskicking" should read <b>spellcasters</b><br />
*scenario 10a: "# Krash smells other drakes and leaves. If he's <b>allive</b> at this point." should read <b>alive</b><br />
<br />
===Sceptre of Fire===<br />
<br />
===Son of the Black Eye===<br />
<br />
===The Hammer of Thursagan===<br />
scenario 12: "Freeing these prisoners is more of a blow to Karrag <b>then</b> we thought" should read <b>than</b><br />
<br />
===The Legend of Wesmere===<br />
<br />
===The Rise of Wesnoth===<br />
<br />
===The South Guard===<br />
<br />
03_A_Desperate_Errand NORMAL difficulty. When you kill off the bandits it says "I hope that’s the last of the bandits! How many more of these foul undead must we fight?" but there are no undead at this difficulty. Perhaps it could be changed to "foul creatures" or perhaps some weak undead could be added to the scenario.<br />
<br />
===Two Brothers===<br />
<br />
There seems to be a discrepancy in the dates given in the four scenarios:<br />
<br />
Scenario 1: 12 V, 363 YW<br />
<br><br />
Scenario 2: 16 V, 363 YW<br />
<br><br />
Scenario 3: 19 '''IV''', 363 YW<br />
<br><br />
Scenario 4: 27 V, 363 YW<br />
<br />
Should the date in scenario 3 be "19 '''V''', 363 YW"?<br />
<br />
(Note that the date appears twice in scenario 3.)<br />
<br />
('''not fixed''' as of commit b58d40d9fb8e9942591604b02b26f15343899f9b)<br />
<br />
===Under the Burning Suns===<br />
<br />
==Wesnoth Game==<br />
<br />
===Editor===<br />
<br />
===Help===<br />
<br />
*"Undead", 1st paragraph: "An undead creature does not require the constant attention of the necromancer to command and sustain, but can work autonomously according to the commands of it's master." should be changed to "...of '''its''' master." (fixed in 74991da8aefad26c3745ee9dd508343e93431ce2)<br />
"Mountains", 1st paragraph, last sentence: "Both dwarves and trolls re native to mountainous terrain, and have a very easiy time getting around." should have "re" changed to "are", no comma before "and", and "easiy" to "easy". (fixed in faf00cb278b89906287d1c221e75ee83d090f371, with the exception of the comma still present)<br />
<br />
===Tutorial===<br />
<br />
===Manual===<br />
<br />
===Manpages===<br />
<br />
===Units===<br />
<br />
===1.11 Announcement===<br />
<br />
*One line of the development release line says this: "which might include quite many bugs." "Quite many" is not proper grammar. It should instead read: "which might include many bugs."<br />
<br />
===Other (unit descriptions, ...)===<br />
<br />
===Multiplayer maps===<br />
<br />
===Translation code bugs===<br />
<br />
==Unofficial campaigns==<br />
<br />
===Invasion from the Unknown===</div>Dornhttps://wiki.wesnoth.org/index.php?title=SpellingMistakes&diff=54281SpellingMistakes2014-03-27T23:35:45Z<p>Dorn: /* An Orcish Incursion */</p>
<hr />
<div>This page is meant to be a list of spelling mistakes in campaigns and other translatable texts in the en_US development version of the game.<br />
<br />
Note: The house style of Wesnoth uses a good many words and constructions that are archaic, poetic, or dialectal. If you speak modern English as a second language you may incorrectly read these as errors. Please see [[NotSpellingMistakes]] for a list of things you will encounter that may look like spelling or usage errors but are not. Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.<br />
<br />
==Mainline Campaigns==<br />
<br />
===An Orcish Incursion===<br />
scenario 06: for side=2, user_team_name=_"Orcs" should read user_team_name=_"Undead"<br />
<br />
===Dead Water===<br />
<br />
===Delfador’s Memoirs===<br />
<br />
===Descent into Darkness===<br />
<br />
===Eastern Invasion===<br />
<br />
===Heir to the Throne===<br />
<br />
===Liberty===<br />
<br />
===Northern Rebirth===<br />
scenario 07a: # Teleport three spelccasters near the sidekick to do some asskicking<br />
<br />
scenario 10a: # Krash smells other drakes and leaves. If he's allive at this point.<br />
<br />
===Sceptre of Fire===<br />
<br />
===Son of the Black Eye===<br />
<br />
===The Hammer of Thursagan===<br />
scenario 12: "Freeing these prisoners is more of a blow to Karrag <b>then</b> we thought" should read <b>than</b><br />
<br />
===The Legend of Wesmere===<br />
<br />
===The Rise of Wesnoth===<br />
<br />
===The South Guard===<br />
<br />
03_A_Desperate_Errand NORMAL difficulty. When you kill off the bandits it says "I hope that’s the last of the bandits! How many more of these foul undead must we fight?" but there are no undead at this difficulty. Perhaps it could be changed to "foul creatures" or perhaps some weak undead could be added to the scenario.<br />
<br />
===Two Brothers===<br />
<br />
There seems to be a discrepancy in the dates given in the four scenarios:<br />
<br />
Scenario 1: 12 V, 363 YW<br />
<br><br />
Scenario 2: 16 V, 363 YW<br />
<br><br />
Scenario 3: 19 '''IV''', 363 YW<br />
<br><br />
Scenario 4: 27 V, 363 YW<br />
<br />
Should the date in scenario 3 be "19 '''V''', 363 YW"?<br />
<br />
(Note that the date appears twice in scenario 3.)<br />
<br />
('''not fixed''' as of commit b58d40d9fb8e9942591604b02b26f15343899f9b)<br />
<br />
===Under the Burning Suns===<br />
<br />
==Wesnoth Game==<br />
<br />
===Editor===<br />
<br />
===Help===<br />
<br />
*"Undead", 1st paragraph: "An undead creature does not require the constant attention of the necromancer to command and sustain, but can work autonomously according to the commands of it's master." should be changed to "...of '''its''' master." (fixed in 74991da8aefad26c3745ee9dd508343e93431ce2)<br />
"Mountains", 1st paragraph, last sentence: "Both dwarves and trolls re native to mountainous terrain, and have a very easiy time getting around." should have "re" changed to "are", no comma before "and", and "easiy" to "easy". (fixed in faf00cb278b89906287d1c221e75ee83d090f371, with the exception of the comma still present)<br />
<br />
===Tutorial===<br />
<br />
===Manual===<br />
<br />
===Manpages===<br />
<br />
===Units===<br />
<br />
===1.11 Announcement===<br />
<br />
*One line of the development release line says this: "which might include quite many bugs." "Quite many" is not proper grammar. It should instead read: "which might include many bugs."<br />
<br />
===Other (unit descriptions, ...)===<br />
<br />
===Multiplayer maps===<br />
<br />
===Translation code bugs===<br />
<br />
==Unofficial campaigns==<br />
<br />
===Invasion from the Unknown===</div>Dornhttps://wiki.wesnoth.org/index.php?title=SpellingMistakes&diff=54280SpellingMistakes2014-03-27T23:27:57Z<p>Dorn: /* The Hammer of Thursagan */</p>
<hr />
<div>This page is meant to be a list of spelling mistakes in campaigns and other translatable texts in the en_US development version of the game.<br />
<br />
Note: The house style of Wesnoth uses a good many words and constructions that are archaic, poetic, or dialectal. If you speak modern English as a second language you may incorrectly read these as errors. Please see [[NotSpellingMistakes]] for a list of things you will encounter that may look like spelling or usage errors but are not. Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.<br />
<br />
==Mainline Campaigns==<br />
<br />
===An Orcish Incursion===<br />
<br />
===Dead Water===<br />
<br />
===Delfador’s Memoirs===<br />
<br />
===Descent into Darkness===<br />
<br />
===Eastern Invasion===<br />
<br />
===Heir to the Throne===<br />
<br />
===Liberty===<br />
<br />
===Northern Rebirth===<br />
scenario 07a: # Teleport three spelccasters near the sidekick to do some asskicking<br />
<br />
scenario 10a: # Krash smells other drakes and leaves. If he's allive at this point.<br />
<br />
===Sceptre of Fire===<br />
<br />
===Son of the Black Eye===<br />
<br />
===The Hammer of Thursagan===<br />
scenario 12: "Freeing these prisoners is more of a blow to Karrag <b>then</b> we thought" should read <b>than</b><br />
<br />
===The Legend of Wesmere===<br />
<br />
===The Rise of Wesnoth===<br />
<br />
===The South Guard===<br />
<br />
03_A_Desperate_Errand NORMAL difficulty. When you kill off the bandits it says "I hope that’s the last of the bandits! How many more of these foul undead must we fight?" but there are no undead at this difficulty. Perhaps it could be changed to "foul creatures" or perhaps some weak undead could be added to the scenario.<br />
<br />
===Two Brothers===<br />
<br />
There seems to be a discrepancy in the dates given in the four scenarios:<br />
<br />
Scenario 1: 12 V, 363 YW<br />
<br><br />
Scenario 2: 16 V, 363 YW<br />
<br><br />
Scenario 3: 19 '''IV''', 363 YW<br />
<br><br />
Scenario 4: 27 V, 363 YW<br />
<br />
Should the date in scenario 3 be "19 '''V''', 363 YW"?<br />
<br />
(Note that the date appears twice in scenario 3.)<br />
<br />
('''not fixed''' as of commit b58d40d9fb8e9942591604b02b26f15343899f9b)<br />
<br />
===Under the Burning Suns===<br />
<br />
==Wesnoth Game==<br />
<br />
===Editor===<br />
<br />
===Help===<br />
<br />
*"Undead", 1st paragraph: "An undead creature does not require the constant attention of the necromancer to command and sustain, but can work autonomously according to the commands of it's master." should be changed to "...of '''its''' master." (fixed in 74991da8aefad26c3745ee9dd508343e93431ce2)<br />
"Mountains", 1st paragraph, last sentence: "Both dwarves and trolls re native to mountainous terrain, and have a very easiy time getting around." should have "re" changed to "are", no comma before "and", and "easiy" to "easy". (fixed in faf00cb278b89906287d1c221e75ee83d090f371, with the exception of the comma still present)<br />
<br />
===Tutorial===<br />
<br />
===Manual===<br />
<br />
===Manpages===<br />
<br />
===Units===<br />
<br />
===1.11 Announcement===<br />
<br />
*One line of the development release line says this: "which might include quite many bugs." "Quite many" is not proper grammar. It should instead read: "which might include many bugs."<br />
<br />
===Other (unit descriptions, ...)===<br />
<br />
===Multiplayer maps===<br />
<br />
===Translation code bugs===<br />
<br />
==Unofficial campaigns==<br />
<br />
===Invasion from the Unknown===</div>Dornhttps://wiki.wesnoth.org/index.php?title=SpellingMistakes&diff=54279SpellingMistakes2014-03-27T23:23:41Z<p>Dorn: /* Northern Rebirth */</p>
<hr />
<div>This page is meant to be a list of spelling mistakes in campaigns and other translatable texts in the en_US development version of the game.<br />
<br />
Note: The house style of Wesnoth uses a good many words and constructions that are archaic, poetic, or dialectal. If you speak modern English as a second language you may incorrectly read these as errors. Please see [[NotSpellingMistakes]] for a list of things you will encounter that may look like spelling or usage errors but are not. Note that the mainline campaigns are now using correct typography, including sexed quotes and en and em dashes. These will appear as three byte sequences if you are not using a viewer that supports UTF-8.<br />
<br />
==Mainline Campaigns==<br />
<br />
===An Orcish Incursion===<br />
<br />
===Dead Water===<br />
<br />
===Delfador’s Memoirs===<br />
<br />
===Descent into Darkness===<br />
<br />
===Eastern Invasion===<br />
<br />
===Heir to the Throne===<br />
<br />
===Liberty===<br />
<br />
===Northern Rebirth===<br />
scenario 07a: # Teleport three spelccasters near the sidekick to do some asskicking<br />
<br />
scenario 10a: # Krash smells other drakes and leaves. If he's allive at this point.<br />
<br />
===Sceptre of Fire===<br />
<br />
===Son of the Black Eye===<br />
<br />
===The Hammer of Thursagan===<br />
<br />
===The Legend of Wesmere===<br />
<br />
===The Rise of Wesnoth===<br />
<br />
===The South Guard===<br />
<br />
03_A_Desperate_Errand NORMAL difficulty. When you kill off the bandits it says "I hope that’s the last of the bandits! How many more of these foul undead must we fight?" but there are no undead at this difficulty. Perhaps it could be changed to "foul creatures" or perhaps some weak undead could be added to the scenario.<br />
<br />
===Two Brothers===<br />
<br />
There seems to be a discrepancy in the dates given in the four scenarios:<br />
<br />
Scenario 1: 12 V, 363 YW<br />
<br><br />
Scenario 2: 16 V, 363 YW<br />
<br><br />
Scenario 3: 19 '''IV''', 363 YW<br />
<br><br />
Scenario 4: 27 V, 363 YW<br />
<br />
Should the date in scenario 3 be "19 '''V''', 363 YW"?<br />
<br />
(Note that the date appears twice in scenario 3.)<br />
<br />
('''not fixed''' as of commit b58d40d9fb8e9942591604b02b26f15343899f9b)<br />
<br />
===Under the Burning Suns===<br />
<br />
==Wesnoth Game==<br />
<br />
===Editor===<br />
<br />
===Help===<br />
<br />
*"Undead", 1st paragraph: "An undead creature does not require the constant attention of the necromancer to command and sustain, but can work autonomously according to the commands of it's master." should be changed to "...of '''its''' master." (fixed in 74991da8aefad26c3745ee9dd508343e93431ce2)<br />
"Mountains", 1st paragraph, last sentence: "Both dwarves and trolls re native to mountainous terrain, and have a very easiy time getting around." should have "re" changed to "are", no comma before "and", and "easiy" to "easy". (fixed in faf00cb278b89906287d1c221e75ee83d090f371, with the exception of the comma still present)<br />
<br />
===Tutorial===<br />
<br />
===Manual===<br />
<br />
===Manpages===<br />
<br />
===Units===<br />
<br />
===1.11 Announcement===<br />
<br />
*One line of the development release line says this: "which might include quite many bugs." "Quite many" is not proper grammar. It should instead read: "which might include many bugs."<br />
<br />
===Other (unit descriptions, ...)===<br />
<br />
===Multiplayer maps===<br />
<br />
===Translation code bugs===<br />
<br />
==Unofficial campaigns==<br />
<br />
===Invasion from the Unknown===</div>Dorn