print scenario id
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.
print scenario id
Hi,
I want to print the scenario id to the console so I could tell which scenarios produced the console errors and warnings.
Anyone knows how to grab the id of the current scenario?
Thanks!
I want to print the scenario id to the console so I could tell which scenarios produced the console errors and warnings.
Anyone knows how to grab the id of the current scenario?
Code: Select all
-- This event is loaded in each scenario
[event]
name=prestart
[wml_message]
message="Loading scenario <$what should go here???>"
logger=err
[/wml_message]
[/event]
Re: print scenario id
I've called the variable here
nfw_...
just because this code is in the Non-Fatal Wounds mod:Code: Select all
[lua]
# This seems to be readable only via Lua
code=<<
wml.variables["nfw_current_scenario_id"] = wesnoth.scenario.id
>>
[/lua]
# WML can use the value in nfw_current_scenario_id here
Re: print scenario id
Ah, thank you!octalot wrote: ↑January 8th, 2022, 7:25 am I've called the variable herenfw_...
just because this code is in the Non-Fatal Wounds mod:
Code: Select all
[lua] # This seems to be readable only via Lua code=<< wml.variables["nfw_current_scenario_id"] = wesnoth.scenario.id >> [/lua] # WML can use the value in nfw_current_scenario_id here
wesnoth.scenario.id
didn't work on 1.14, but taking a peek at 1.14's Non-Fatal Wounds I found wesnoth.game_config.scenario_id
.Neither of which are documented under the wiki's LuaWML/LuaAPI pages btw.
- Celtic_Minstrel
- Developer
- Posts: 2222
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: print scenario id
wesnoth.scenario
is documented on the main Wesnoth module page; wesnoth.game_config.scenario_id
is still documented on one of the LuaWML subpages for the time being.- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: print scenario id
Is there any reason why we don't have a [store_scenario] tag? There are several values in a scenario that aren't exposed to WML.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
- Celtic_Minstrel
- Developer
- Posts: 2222
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: print scenario id
I don't think there's any reason, other than that no-one bothered to add it.
Re: print scenario id
Ah, I missed them. Thank you.Celtic_Minstrel wrote: ↑January 9th, 2022, 7:11 pmwesnoth.scenario
is documented on the main Wesnoth module page;wesnoth.game_config.scenario_id
is still documented on one of the LuaWML subpages for the time being.