filter_self and formula or filter_wml

The place to post your WML questions and answers.

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.
User avatar
Celtic_Minstrel
Developer
Posts: 2436
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: filter_self and formula or filter_wml

Post by Celtic_Minstrel »

Ah, right – so that's the main difference. [filter] determines whether or not the ability is active, so if that filter doesn't pass, the ability is inactive and had no effect whatsoever. On the other hand [filter_self] determines whether or not the ability affects the owner – even if the filter doesn't pass, it might affect other units.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Spannerbag
Posts: 876
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: filter_self and formula or filter_wml

Post by Spannerbag »

Celtic_Minstrel wrote: November 11th, 2025, 7:03 pm ...[filter] determines...
Many thanks for the clarification, the documentation makes sense now.
Previously when I read:
https://wiki.wesnoth.org/AbilitiesWML#Common_keys_and_tags_for_every_ability wrote:[filter]: StandardUnitFilter If the unit owning the ability does not match this filter, the ability will be inactive.
I'd understood that to mean that it has the same effect as [filter_self] - I hadn't thought of the situation you describe.
So [filter_self] was working but not producing the effect I expected. D'Oh! :doh:
Celtic_Minstrel wrote: November 11th, 2025, 3:07 am I'm pretty sure the two tags do slightly different things, but… the documentation does a very bad job of explaining it, that's for sure.
:thumbsup:
Do you think it would be clearer/more consistent if [filter_self] was renamed [affect_self]?
(Cf. [affect_adjacent] & [filter_adjacent].)

Thanks again for the clarification, very helpful!
Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
gnombat
Posts: 981
Joined: June 10th, 2010, 8:49 pm

Re: filter_self and formula or filter_wml

Post by gnombat »

There are some issues in the bug tracker which seem to be proposing renaming and/or changing [filter_self] (although I find it kind of hard to follow what exactly is being proposed):

#9240
#10500
User avatar
Spannerbag
Posts: 876
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: filter_self and formula or filter_wml

Post by Spannerbag »

gnombat wrote: November 12th, 2025, 1:39 pm There are some issues in the bug tracker which seem to be proposing renaming and/or changing [filter_self] (although I find it kind of hard to follow what exactly is being proposed):

#9240
#10500
Interesting and live topics/discussions (both have recent posts), thanks for letting me know. :)

FWIW I kinda view abilities and specials as close relatives and although this'll never happen (and may not be possible as I haven't thought it through fully) I wonder if it's possible to have abilities and specials share the same keys and tags but differ only in that abiltities have a [filter] as their on/off switch whereas specials have [filter][filter_weapon]. If an ability needs a weapon filter it could go in the appropriate "sub-filter" (e.g. [filter_self] etc.) rather than [filter].

Thanks again.

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Ravana
Forum Moderator
Posts: 3416
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: filter_self and formula or filter_wml

Post by Ravana »

Some of complexity is due to abilities that grant weapon special to unit. At this point I dont think we will get any agreement to make changes, so just need to make sure documentation is understandable.
User avatar
Celtic_Minstrel
Developer
Posts: 2436
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: filter_self and formula or filter_wml

Post by Celtic_Minstrel »

They are certainly close relatives, but I would say that they are very much not the same thing. That said, using [filter_self] for two completely different meanings in each of them seems bad.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply