[SOLVED] [variable] Get a variable from the "game settings" panel
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
[SOLVED] [variable] Get a variable from the "game settings" panel
Hello!
So I'm building a small multiplayer scenario and I want to get a variable from the "game settings" panel when the user creates his game. For example here I want to know if the user choose to set a random start time for his game. So i want to get this value from my WML code and use it in a "if" tag, like this:
where "random_start_time" should be the value defined by the user in the "game settings" panel. I would accept LUA solution too.
Thanks!
So I'm building a small multiplayer scenario and I want to get a variable from the "game settings" panel when the user creates his game. For example here I want to know if the user choose to set a random start time for his game. So i want to get this value from my WML code and use it in a "if" tag, like this:
Code: Select all
[if]
[variable]
name="random_start_time"
equals=yes
[/variable]
[then]
...
[/then]
[/if]
Thanks!
Last edited by Zatiranyk on June 30th, 2019, 8:43 pm, edited 2 times in total.
Re: [variable] Get a variable from the "game settings" pannel
In Lua it is wesnoth.game_config.mp_settings.mp_random_start_time.
- Pentarctagon
- Project Manager
- Posts: 5527
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: [variable] Get a variable from the "game settings" panel
You could also put that into a WML variable via:
Code: Select all
[lua]
code=<<
wml.variables["random_start_time"] = wesnoth.game_config.mp_settings.mp_random_start_time
>>
[/lua]
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
Re: [variable] Get a variable from the "game settings" panel
So i guess there is no pure WML solution for that ^^ I'll try this! Ty very much, you reply so quickly