Questions about the Source Code

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

User avatar
jieverson
Posts: 17
Joined: February 26th, 2013, 8:27 pm

Re: Questions about the Source Code

Post by jieverson »

8680 wrote:Normal variables, the ones that wesnoth.get_variable accesses, are not accessible across multiple playthroughs of a campaign or multiple multiplayer games, whereas persistent variables are.

To access persistent variables from Lua, call the WML action tag handlers through the wesnoth.wml_actions table, then use normal wesnoth.get_variable to access the resultant normal WML variables.
Do you have some example of access the wml_actions?
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Questions about the Source Code

Post by 8680 »

jieverson wrote:Do you have some example of access the wml_actions?
In general?

Code: Select all

wesnoth.wml_actions.message {
    speaker = "narrator";
    message = "...";
}
Or for persistent variables in particular? I’ve never used persistent variables, so I have no examples for you of accessing them in Lua, but you should be able to extrapolate from the documentation on the WML side.
Post Reply