[scroll_to_unit] seeing side filter

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
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [scroll_to_unit] seeing side filter

Post by Ravana »

For each side that is local, check if it can see unit. Then decide if you want all or any local side see unit.
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: [scroll_to_unit] seeing side filter

Post by ZombieKnight »

Ravana wrote: April 25th, 2025, 5:26 pm For each side that is local, check if it can see unit. Then decide if you want all or any local side see unit.
But, to the very question of this post... How do I do that?
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [scroll_to_unit] seeing side filter

Post by Ravana »

Too unspecific.
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: [scroll_to_unit] seeing side filter

Post by ZombieKnight »

Ravana wrote: April 25th, 2025, 5:26 pm check if it(side) can see unit.
How fo check for whether side can see unit?
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [scroll_to_unit] seeing side filter

Post by Ravana »

wml.tag.filter_vision{side=i}
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: [scroll_to_unit] seeing side filter

Post by ZombieKnight »

Ravana wrote: April 26th, 2025, 8:35 am wml.tag.filter_vision{side=i}
Could you tell me the whole condition that returns true only if side 1 sees my unit?
I can't drop out filter_vision out of nowhere, the standalone tag makes no sence.
Where should it be used? (Presumably in unit filter, but where tge hell to use the whole filter? And what the hell has to be in unit filter, that returns unit)
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [scroll_to_unit] seeing side filter

Post by Ravana »

If unit filter returns 1 unit, then side can see the unit. If unit filter returns 0 units, then side cant see the unit.
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: [scroll_to_unit] seeing side filter

Post by ZombieKnight »

Ravana wrote: April 26th, 2025, 1:14 pm If unit filter returns 1 unit, then side can see the unit. If unit filter returns 0 units, then side cant see the unit.
Ok, dumb me (this really makes sense to do with the local side )...
Is it absolutelly bug free and does it not bring any syncing issues/ problems with replay?
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [scroll_to_unit] seeing side filter

Post by Ravana »

If you do anything that needs sync it obviously breaks.
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: [scroll_to_unit] seeing side filter

Post by ZombieKnight »

Still, this is f*cking complicated, why does [filter_side] has to have that stupid [has_unit] tag which does nothing new, only restricts existing tag???
Aaand I can't find a way to do this simply... how should I do it? (First iterate through sides and then iterate through units, time is even worse as when I would just iterate all sides for one unit (which would also achieve more work))
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: [scroll_to_unit] seeing side filter

Post by ZombieKnight »

Ravana wrote: April 23rd, 2025, 5:38 am You filter side by is_local.
How the hell is that supposed to shrink the f*cking side list?

Code: Select all

$ wesnoth.sides.find({is_local=true})
{side: <1 Bandits>,side: <2 Humans>,side: <3 Wenrys>,side: <4 Dwarves>,side: <5 Dwarves>,side: <6 Dwarves>,side: <7 Nagas>,side: <8 Wild>,side: <9 Wild>,side: <10 Wild>}
User avatar
Ravana
Forum Moderator
Posts: 3313
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [scroll_to_unit] seeing side filter

Post by Ravana »

It is not part of SSF. is_local is only provided in side proxy.

wesnoth.require("functional").map(wesnoth.sides.find{}, function (s) return s.is_local end)
Post Reply