[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
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

[scroll_to_unit] seeing side filter

Post by ZombieKnight »

Hi
I have [scroll_to_unit], for unit vith invisible ability and I want to highlight it's action (coded teleport) but only for sides, who actually do see the unit.
How to do so?
There's [filter_side] but I can't find a way to filter for sides, which do see my unit.
Docs:
https://wiki.wesnoth.org/InterfaceActio ... to_unit.5D
https://wiki.wesnoth.org/StandardUnitFilter
Thanks
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 unsynced code its bettter to use Lua. That runs on each client independently.
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 22nd, 2025, 7:47 pm For unsynced code its bettter to use Lua. That runs on each client independently.
Oh, didn't knew that.
I do run it in Lua actually.
But I still don't know how to filter the sides for which to scroll the screen for.
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 »

You know which side is_local, and then you can check if that side can 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 22nd, 2025, 8:46 pm You know which side is_local, and then you can check if that side can see unit.
Yrah... but how?
There's no [filter_vision] in side filter.
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 »

You filter side by is_local.
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.
Yes and how to filter, whether my is_local side actually sees the unit?
User avatar
lhybrideur
Posts: 454
Joined: July 9th, 2019, 1:46 pm

Re: [scroll_to_unit] seeing side filter

Post by lhybrideur »

Maybe [have_unit][filter_vision]
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 »

lhybrideur wrote: April 25th, 2025, 6:58 am Maybe [have_unit][filter_vision]
Sadly, it states in wiki that [have_unit] automatically excludes all non side's units.
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 doesnt.
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, 7:35 amIt doesnt.
Correction: [have_unit] isn't valid side filter, side filter features only [has_unit] which...
[has_unit]:

StandardUnitFilter: filter matches only if side controls a unit matched by it
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 »

You filter side by side number.
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, 4:42 pm You filter side by side number.
Ok, and how to find out which sides see the unit then???
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 »

With 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 25th, 2025, 4:49 pm With wml.tag.filter_vision{side=i}
Ok, but used where, I kinda don't get first step, the obvious thing?
Post Reply