Search found 2155 matches

by Celtic_Minstrel
Yesterday, 5:14 pm
Forum: Lua Labs
Topic: WML table navigation
Replies: 2
Views: 72

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...
by Celtic_Minstrel
March 17th, 2024, 2:22 pm
Forum: Lua Labs
Topic: How to create a message with custom background
Replies: 7
Views: 222

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...
by Celtic_Minstrel
March 17th, 2024, 1:43 am
Forum: Lua Labs
Topic: How to create a message with custom background
Replies: 7
Views: 222

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...
by Celtic_Minstrel
March 16th, 2024, 3:21 pm
Forum: Lua Labs
Topic: How to create a message with custom background
Replies: 7
Views: 222

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...
by Celtic_Minstrel
March 13th, 2024, 11:05 pm
Forum: Lua Labs
Topic: [solved] Storing a test condition as a string
Replies: 5
Views: 232

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_...
by Celtic_Minstrel
March 13th, 2024, 7:21 am
Forum: Lua Labs
Topic: [solved] Storing a test condition as a string
Replies: 5
Views: 232

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 ...
by Celtic_Minstrel
March 13th, 2024, 2:03 am
Forum: Lua Labs
Topic: [solved] Storing a test condition as a string
Replies: 5
Views: 232

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,...
by Celtic_Minstrel
March 4th, 2024, 3:03 am
Forum: Lua Labs
Topic: [GUI] indentation_step_size vs data width
Replies: 4
Views: 266

Re: [GUI] indentation_step_size vs data width

It's one of the available widgets you can choose from.
by Celtic_Minstrel
March 3rd, 2024, 6:37 am
Forum: Lua Labs
Topic: [GUI] indentation_step_size vs data width
Replies: 4
Views: 266

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.)
by Celtic_Minstrel
March 3rd, 2024, 6:35 am
Forum: Lua Labs
Topic: [GUI] removing containers/items
Replies: 1
Views: 162

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.
by Celtic_Minstrel
March 1st, 2024, 3:10 am
Forum: Lua Labs
Topic: [solved] [GUI] Passing parameters to callbacks
Replies: 3
Views: 554

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 ...
by Celtic_Minstrel
February 26th, 2024, 6:43 pm
Forum: Lua Labs
Topic: How to modify wesnoth save files?
Replies: 9
Views: 755

Re: How to modify wesnoth save files?

There's no facility to disable saving. That goes against the spirit of the game.
by Celtic_Minstrel
February 25th, 2024, 5:07 pm
Forum: Lua Labs
Topic: How to modify wesnoth save files?
Replies: 9
Views: 755

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...
by Celtic_Minstrel
February 22nd, 2024, 4:24 am
Forum: Coder’s Corner
Topic: Seeking tricky WML examples
Replies: 1
Views: 316

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...