Search found 2204 matches

by Celtic_Minstrel
March 1st, 2024, 3:10 am
Forum: Lua Labs
Topic: [solved] [GUI] Passing parameters to callbacks
Replies: 3
Views: 1719

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: 1967

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: 1967

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: 14
Views: 2807

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...
by Celtic_Minstrel
February 21st, 2024, 6:40 pm
Forum: WML Workshop
Topic: how fire_event works?
Replies: 10
Views: 907

Re: how fire_event works?

However I am consufed because previously, re. the lua method, you said: That code doesn't clean up after itself though, so it'll leave all those variables littering the global scope when it's done. I'm not clear what you mean (sorry to be dim). By all those variables do you mean: These are WML vari...
by Celtic_Minstrel
February 20th, 2024, 2:52 pm
Forum: WML Workshop
Topic: how fire_event works?
Replies: 10
Views: 907

Re: how fire_event works?

I think the [data] support is missing a piece. It probably should be exposed either as something like $event_data or by injecting its contents as temporary variables. Your second attempt used the correct syntax, so if $event_data existed, you should've been able to access the sent variable as $event...
by Celtic_Minstrel
February 13th, 2024, 4:22 am
Forum: WML Workshop
Topic: Terrain - Removing village healing
Replies: 6
Views: 588

Re: Terrain - Removing village healing

That's not even a village anymore, since you removed not only heals=8 but also gives_income=yes. If that's what you wanted, then that's fine, it just didn't sound like it was.
by Celtic_Minstrel
February 11th, 2024, 2:56 am
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2194

Re: Lua type annotations

Just letting you know that I pushed several fixes to #7359, including the gui.simple_widget.label change you suggested. I also added |number to it, as there are probably use-cases where you want a label to just show a number, and we don't currently have functions to convert a number to a tstring.
by Celtic_Minstrel
February 10th, 2024, 6:08 am
Forum: WML Workshop
Topic: creating delayed events (replacing variable with its value) issue
Replies: 7
Views: 1109

Re: creating delayed events (replacing variable with its value) issue

You can also put [set_variable] inside [modify_unit]. That would change Ravana's example to this:

Code: Select all

[modify_unit]
	id=$tempUnit.id
	[set_variable]
		name=new_value
		value=123
	[/set_variable]
[/modify_unit]
by Celtic_Minstrel
February 9th, 2024, 12:05 am
Forum: Lua Labs
Topic: Like feeding but affects undead too
Replies: 5
Views: 1508

Re: Like feeding but affects undead too

You can pretty much copy the feeding Lua file and customize it however you want. In this case, just deleting the test that the killed unit is not unplagueable should be enough.
by Celtic_Minstrel
February 8th, 2024, 2:58 pm
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2194

Re: Lua type annotations

It's probably better for gui.image to override the field to string, I think. Though I guess that doesn't really solve the issue of getting a warning when you assign it… I guess I could make it string|tstring…
by Celtic_Minstrel
February 7th, 2024, 6:50 pm
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2194

Re: Lua type annotations

Another one : it seems that the definitions for interface.remove_item interface.add_item_halo are missing in wesnoth/interface.lua Those ones are a little weird. They're actually defined in lua/wml/items.lua, since they access local variables in that file. I'll make the other corrections you noted....
by Celtic_Minstrel
February 5th, 2024, 6:42 pm
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2194

Re: Lua type annotations

I wouldn't recommend just taking #7359 wholesale, as some of the changes to code seem to be incorrect. Cherry-picking all the [LuaDoc]-tagged commits should be safe, however.
by Celtic_Minstrel
February 4th, 2024, 6:25 pm
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2194

Re: Lua type annotations

Those annotations are used throughout the parts of our Lua API that are implemented in Lua. The engine does nothing special with them, however – it's up to you to choose an editing program that supports them and set it up to recognize them correctly. I know Visual Studio Code's Lua plugin supports t...
by Celtic_Minstrel
February 2nd, 2024, 6:27 pm
Forum: Lua Labs
Topic: [closed] Where is current attack weapon stored/how it's marked?
Replies: 18
Views: 3002

Re: Where is current attack weapon stored/how it's marked?

wesnoth.current.event_context is all the information about the currently-running event.

I don't understand what the second line of your post means.