LuaWML changes for 1.9
Moderator: Forum Moderators
LuaWML changes for 1.9
Below is a list of most of the changes for LuaWML in 1.9.0. As always, the complete documentation can be found at LuaWML.
- Action handlers, sides, and unit types, are now stored as simple tables, so as to simplify their handling. Function accessors (e.g. register_wml_action, get_unit_type_ids) are still supported for backward-compatibility; they will be removed in 1.11.
- Units on the recall lists are now handled like any other units by proxy userdata.
- Unit status, hitpoints, and hidden property, can now be directly accessed and modified.
- Effects (traits or objects) can be directly applied to units. Active abilities can be queried from units.
- Locations can now be filtered.
- Music, sounds, and scrolling, are now supported.
- Custom dialog boxes can now be displayed. This allows for a scenario to do everything the engine can do with the user interface. (Except for defining new widgets, so you can only use: buttons, toggle buttons, lists, panels, and so on.)
- Data can now be sent to other clients and stored into replays. This is mostly useful for broadcasting the results of custom dialog boxes.
Spoiler:
Re: LuaWML changes for 1.9
Below is a list of most of the changes for LuaWML in 1.9.1. As always, the complete documentation can be found at LuaWML.
- Custom tags can now be stored and retrieved from savefiles by overloading the on_load and on_save hooks from wesnoth.game_events. They are intended to avoid polluting [variables] with data that are neither meant to be substituted nor forwarded to the next level, e.g. [item].
- The [lua] tag no longer merges the event context into the [args] data. As a consequence, these data are now passed as a userdata performing variable substitution.
Re: LuaWML changes for 1.9
Below is a list of most of the changes for LuaWML in 1.9.2. As always, the complete documentation can be found at LuaWML.
- Unit proxies now have a "valid" field to check the presence of the target unit. They also have a "variables" table to access unit variables; only the toplevel fields are proxied, the other ones should be accessed through "variables.__cfg" (read/write).
- Side proxies now have a "controller" field.
- wesnoth.set_terrain supports some extra arguments.
- A library for handling location sets and location maps is now provided: LuaWML:Location_set.
- An on_event hook has been added to wesnoth.game_events.
Re: LuaWML changes for 1.9
Below is a list of most of the changes for LuaWML in 1.9.4. As always, the complete documentation can be found at LuaWML.
- The interface of synchronize_choice has been improved a bit to help writing AIs.
- math.random has been added back, despite it being OoS-prone, as it is the only sensible function for writing AIs and synchronized choices.
- It is now possible to customize the user interface (e.g. adding new unit status) by filling wesnoth.theme_items to modify the functions the engine calls to draw interface elements.
- The type of a unit can now be changed with wesnoth.transform_unit.
- Unit proxies now have a writable "experience" field.
- New miscellaneous functions: get_image_size (to help compute ~BLIT image modifiers), get_mouseover_tile, get_displayed_unit.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: LuaWML changes for 1.9
The standard changelog has now a section containing Lua changes.
As far as compatibility-breaking changes are concerned, compared to the very first beginnings of the lua interface, there are currently none which I know of.
There's a thing to consider when changing wesnoth.fire("some_tag", ...) to wesnoth.wml_actions.some_tag calls (which I got caught in): If you call wml action tags which are implemented in lua in this way, the wml table you pass does no longer automatically become (vconfig wml table) userdata. (wesnoth.tovconfig does this conversion). This means that if your wml table might contain variables which might need to be substituted you need to either call wesnoth.wml_actions.some_tag(wesnoth.tovconfig(...)) or stick with wesnoth.fire.
The issue isn't that easy to understand so I guess wesnoth.fire won't get deprecated.
As far as compatibility-breaking changes are concerned, compared to the very first beginnings of the lua interface, there are currently none which I know of.
There's a thing to consider when changing wesnoth.fire("some_tag", ...) to wesnoth.wml_actions.some_tag calls (which I got caught in): If you call wml action tags which are implemented in lua in this way, the wml table you pass does no longer automatically become (vconfig wml table) userdata. (wesnoth.tovconfig does this conversion). This means that if your wml table might contain variables which might need to be substituted you need to either call wesnoth.wml_actions.some_tag(wesnoth.tovconfig(...)) or stick with wesnoth.fire.
The issue isn't that easy to understand so I guess wesnoth.fire won't get deprecated.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign