Search found 2155 matches
- Yesterday, 5:14 pm
- Forum: Lua Labs
- Topic: WML table navigation
- Replies: 2
- Views: 76
Re: WML table navigation
local u = wesnoth.units.get(wml.variables["unit.id"]) local u_table=u.__cfg First of all, that's completely pointless. It's roughly equivalent to: local u_table = wml.variables["unit"] Although there's always the possibility that the stored unit has been changed without being un...
- March 17th, 2024, 2:22 pm
- Forum: Lua Labs
- Topic: How to create a message with custom background
- Replies: 7
- Views: 226
Re: How to create a message with custom background
No, gui.show_narration is defined in C++ and WML. The WML part of the definition can be found in the data/gui/windows/wml_message.cfg file. If you loaded that file and passed the [resolution] tag to gui.show_dialog , you'd have a dialog that looks exactly like a message dialog, but probably lacks so...
- March 17th, 2024, 1:43 am
- Forum: Lua Labs
- Topic: How to create a message with custom background
- Replies: 7
- Views: 226
Re: How to create a message with custom background
You can create pretty much any dialog you can imagine, yes. The show_narration dialog is fairly complex, however. You could probably copy it WML definition from core and make a new dialog using it, though. By the way, show_narration is part of GUI2 – it's just one of the pre-built dialogs provided f...
- March 16th, 2024, 3:21 pm
- Forum: Lua Labs
- Topic: How to create a message with custom background
- Replies: 7
- Views: 226
Re: How to create a message with custom background
I could be wrong, but I don't think there's any way to do that without recreating the whole dialog. The closest idea that comes to mind would be changing the active definition, but there's no Lua API to change definitions, so I don't think it can be done in Lua. There is the idea of creating a custo...
- March 13th, 2024, 11:05 pm
- Forum: Lua Labs
- Topic: [solved] Storing a test condition as a string
- Replies: 5
- Views: 233
Re: [solved] Storing a test condition as a string
That's another good solution, yes. However, instead of a global function, I'd recommend namespacing it: -- I'm starting the global variable with a capital letter only because the linting systems I use -- consider lowercase names to be a probable error PrefFunctions = {} function PrefFunctions.blood_...
- March 13th, 2024, 7:21 am
- Forum: Lua Labs
- Topic: [solved] Storing a test condition as a string
- Replies: 5
- Views: 233
Re: Storing a test condition as a string
it will need to be saved between games (and perhaps even persist?). This means it will need to be WML, yes, so version #1 will not work for you. Solution #2 looks like the cleanest, though I'm unclear how it would handle errors. Broadly speaking, it more or less doesn't , but it shouldn't crash in ...
- March 13th, 2024, 2:03 am
- Forum: Lua Labs
- Topic: [solved] Storing a test condition as a string
- Replies: 5
- Views: 233
Re: Storing a test condition as a string
I'll answer your direct question in a moment, but before that I want to question why you're storing the condition as a string of Lua code. Is new_prefs a general Lua table, or does it need to be valid WML? Note : All these will assume you set the $quests.seen_blood_rain variable to yes instead of 1,...
- March 4th, 2024, 3:03 am
- Forum: Lua Labs
- Topic: [GUI] indentation_step_size vs data width
- Replies: 4
- Views: 267
Re: [GUI] indentation_step_size vs data width
It's one of the available widgets you can choose from.
- March 3rd, 2024, 6:37 am
- Forum: Lua Labs
- Topic: [GUI] indentation_step_size vs data width
- Replies: 4
- Views: 267
Re: [GUI] indentation_step_size vs data width
This also sounds like a bug.
(I'll refrain from asking why you're not using a unit preview pane.)
(I'll refrain from asking why you're not using a unit preview pane.)
- March 3rd, 2024, 6:35 am
- Forum: Lua Labs
- Topic: [GUI] removing containers/items
- Replies: 1
- Views: 163
Re: [GUI] removing containers/items
Well, I'm not entirely sure what you're doing wrong (or even if you're doing something wrong), but it definitely shouldn't crash. That's a bug for sure.
- March 2nd, 2024, 4:47 pm
- Forum: Lua Labs
- Topic: How to change golds description in upper gold counter?
- Replies: 11
- Views: 520
Re: How to change golds description in upper gold counter?
I think you're looking for wesnoth.interface.game_display.gold.
- March 1st, 2024, 3:10 am
- Forum: Lua Labs
- Topic: [solved] [GUI] Passing parameters to callbacks
- Replies: 3
- Views: 555
Re: [GUI] Passing parameters to callbacks
dialog.autorecall_tv[i].ar_up.on_button_click = move_up(i) No, what are you doing. That won't work. You can't call the function and assign its result as a callback. Just assign the function directly: dialog.autorecall_tv[i].ar_up.on_button_click = move_up If the issue is that your function needs a ...
- February 26th, 2024, 6:43 pm
- Forum: Lua Labs
- Topic: How to modify wesnoth save files?
- Replies: 9
- Views: 757
Re: How to modify wesnoth save files?
There's no facility to disable saving. That goes against the spirit of the game.
- February 25th, 2024, 5:07 pm
- Forum: Lua Labs
- Topic: How to modify wesnoth save files?
- Replies: 9
- Views: 757
Re: How to modify wesnoth save files?
The title of this topic is wrong. It should not be "How to modify wesnoth save files?" but rather "How to make an event one-time-seen?". You've started by deciding that you know the correct way to approach your problem and asking how to achieve that approach, rather than presenti...
- February 22nd, 2024, 4:24 am
- Forum: Coder’s Corner
- Topic: Seeking tricky WML examples
- Replies: 1
- Views: 318
Seeking tricky WML examples
I'm looking for samples of WML where the preprocessor or parser does something a bit unusual that you might not expect, or where you need to do something a little unusual to make it work correctly. Does anyone have any examples of such things? I'll start with one that I recently noticed: [my_tag] va...