Search found 15 matches

by Sventimir
December 17th, 2025, 9:57 am
Forum: Lua Labs
Topic: [SOLVED] Wesnoth hanging on map generation
Replies: 4
Views: 276

Re: Wesnoth hanging on map generation

I think I have found the problem. I made a mistake when setting metatables for my internal objects, apparently creating a reference cycle between my prototypes. That was most likely the source of the issue. It explains why Wesnoth choked when trying to display these objects or call their methods ...
by Sventimir
December 16th, 2025, 6:48 pm
Forum: Lua Labs
Topic: [SOLVED] Wesnoth hanging on map generation
Replies: 4
Views: 276

Re: Wesnoth hanging on map generation

gnombat wrote: December 16th, 2025, 1:49 pm It would probably be better to use std_print(message) or wesnoth.log('error', message, false) here - that will log to a file rather than the Lua console.
Thanks for the pointer, that's useful.

I didn't realise there was a Discord server for Wesnoth. Thanks!
by Sventimir
December 16th, 2025, 12:57 pm
Forum: Lua Labs
Topic: [SOLVED] Wesnoth hanging on map generation
Replies: 4
Views: 276

[SOLVED] Wesnoth hanging on map generation

Hello,
I'm developing a random map generator for my campaign. It's currently over 3000 lines of Lua code and probably not a very well-optimized at that. As I try to add a new feature to it. I'm going into the situation, where Wesnoth hangs on map generation. The window stops refreshing. When I call ...
by Sventimir
September 30th, 2025, 7:01 pm
Forum: Lua Labs
Topic: [SOLVED] wesnoth.game_events and undoing moves.
Replies: 3
Views: 710

Re: wesnoth.game_events and undoing moves.

I can see now that events don't prevent undos if they were filtered out by their filters. So in my case it's actually sufficient to use wesnoth.game_events.add instead of wesnoth.game_event.add_repeating and provide a filter. That said it would still be very nice to have wesnoth.experimental ...
by Sventimir
September 30th, 2025, 5:06 pm
Forum: Lua Labs
Topic: [SOLVED] wesnoth.game_events and undoing moves.
Replies: 3
Views: 710

[SOLVED] wesnoth.game_events and undoing moves.

Hello,
the EventWML documentation describes allow_undo and on_undo direct action tags. However, there seems to be no equivalent for them in the LUA API, wesnorth.game_events.add and wesnoth.game_events.add_menu don't mention any option of allowing undo. wesnoth.game_events.add_repeating does have an ...
by Sventimir
July 23rd, 2024, 2:22 pm
Forum: Lua Labs
Topic: [solved] Updating side variables from LUA script.
Replies: 2
Views: 5185

Re: Updating side variables from LUA script.

Thanks for the pointer, I think I've figured it out now.
by Sventimir
July 23rd, 2024, 1:24 pm
Forum: Lua Labs
Topic: [solved] Updating side variables from LUA script.
Replies: 2
Views: 5185

[solved] Updating side variables from LUA script.

In Wesnoth 1.18.2, in my scenario WML, for some sides I have the following variables section:

[variables]
[tactics]
[tactic]
role=assassin
count=0
weigth=3
[/tactic]
[tactic]
role=hunter
count=0
weight=2
[/tactic]
[tactic] # no particular role
count=0
weight=1
[/tactic]
total ...
by Sventimir
August 17th, 2023, 7:06 am
Forum: WML Workshop
Topic: [SOLVED] Side filter does not seem to work
Replies: 8
Views: 4308

Re: [SOLVED] Side filter does not seem to work

But set_extra_recruits will define additional recruits attached to the leader, right? To achieve what I want I'd need to set the side's standard recruit list to be empty and only use extra recruits. Right?
by Sventimir
August 14th, 2023, 7:38 am
Forum: WML Workshop
Topic: [SOLVED] Side filter does not seem to work
Replies: 8
Views: 4308

Re: Side filter does not seem to work

Okay, I debugged the issue and understood it. The problem was actually not in the piece of code that I have shown, buit in another, handling another type of castle, of which there were multiple instances. The reason for error was my misunderstanding of how [or] tag works. I wrote:


[filter]
side ...
by Sventimir
August 14th, 2023, 7:13 am
Forum: WML Workshop
Topic: [SOLVED] WML prestart event misbehaviour in on-line games
Replies: 7
Views: 4004

Re: WML prestart event misbehaviour in on-line games

I managed to solve it using formula condition instead of controller within filter_side like this:

[event]
name=prestart
[kill]
[filter_side]
side=1,2,3,4
formula="not (is_human or is_network or is_ai)"
[/filter_side]
[/kill]
[/event]
by Sventimir
August 14th, 2023, 6:20 am
Forum: WML Workshop
Topic: [SOLVED] WML prestart event misbehaviour in on-line games
Replies: 7
Views: 4004

Re: WML prestart event misbehaviour in on-line games

I thought to leave it there for the moment, while I'm still developing the scenario. Otherwise, what is the editor/scenarios directory good for if files in there don't load macros by default? In any case, this doesn't seem to work. When I enter any multiplayer game setup, I get Error: Macro/file ...
by Sventimir
August 13th, 2023, 5:55 pm
Forum: WML Workshop
Topic: [SOLVED] WML prestart event misbehaviour in on-line games
Replies: 7
Views: 4004

Re: WML prestart event misbehaviour in on-line games

Thanks a lot for the explanation and the workaround. I'll try to make it work!

BTW, macros don't seem to work for me for some reason. I verified they're where they're supposed to be in /usr/share/wesnoth, but whenever I try to use one, I get file-not-found error mentioning the macro name. I place ...
by Sventimir
August 13th, 2023, 5:29 pm
Forum: WML Workshop
Topic: [SOLVED] Side filter does not seem to work
Replies: 8
Views: 4308

Re: Side filter does not seem to work

Initially I didn't write side=$unit.side, I added it later thinking maybe it'd solve the problem, but it didn't/ Thanks for explanation, anyway.
Have you verified with :inspect that
Not yet. But I observed that other sides' recruitment lists change in a way consistent with what I described above.
by Sventimir
August 13th, 2023, 1:54 pm
Forum: WML Workshop
Topic: [SOLVED] Side filter does not seem to work
Replies: 8
Views: 4308

[SOLVED] Side filter does not seem to work

In a multiplayer scenario that I'm working on, I want a mechanics inspired by games like Heroes of Might and Magic. Namely, I want the list of units a leader can recruit depend on the type of castle they're currently in. To do it, I'm using moveto and exit_hex events as follows:


# recruiting ...
by Sventimir
August 13th, 2023, 1:01 pm
Forum: WML Workshop
Topic: [SOLVED] WML prestart event misbehaviour in on-line games
Replies: 7
Views: 4004

[SOLVED] WML prestart event misbehaviour in on-line games

I'm building a multiplayer scenario, intended to be played by 1-4 players. Each side has a predefined leader, so if there is less than 4 players I need to remove non-playing leaders in a prestart event. I wrote the following code to accomplish this:

[event]
name=prestart
[kill]
[filter_side ...