Custom WML access
Moderator: Forum Moderators
- trickitiki
- Posts: 9
- Joined: May 31st, 2018, 3:14 pm
Custom WML access
Hallo. Does API for addons allows to read some random tags? Hmm, wat i'm trying to say... For example, may i create some custom file with proper tag structure but using totally unknown (new) tag names and then read it from script? Thanks.
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Custom WML access
Yep - wml actions, and wml conditions.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
-
- Inactive Developer
- Posts: 503
- Joined: April 24th, 2016, 4:18 pm
Re: Custom WML access
This is actually a Lua question. Moved.
I forked real life and now I'm getting merge conflicts.
- Celtic_Minstrel
- Developer
- Posts: 2214
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Custom WML access
The answer to this as stated is no. The Lua API provides no direct access to the WML parser. It wouldn't be particularly difficult to add it, though, so I've opened #3696 on the topic.
If what you want is specifically custom tags in scenarios, then what you need is
If what you want is specifically custom tags in scenarios, then what you need is
wesnoth.wml_actions
, wesnoth.wml_conditions
, wesnoth.effects
, wesnoth.persistent_tags
, or wesnoth.custom_synced_commands
, depending on your specific needs.wml_actions
defines new tags that can be used as actions within an[event]
or[command]
tag.wml_conditions
defines new tags that can be used as a condition in an[if]
or[filter_condition]
tag as well as other similar tags.effects
defines new valid values ofapply_to
in an[effect]
tag, which can parse the remaining contents of the tag however it wants.persistent_tags
defines new tags that are valid directly inside the[scenario]
tag; though usually used for saving data in the saved game (which also contains a[scenario]
tag internally), tags so defined can also be placed deliberately in a scenario.custom_synced_commands
defines custom commands that can be executed by the AI or a[do_command]
tag. I'm not sure if this is documented yet, but you can check out an example use in Son of the Black Eye for loading units onto transport ships.