Examples of [adjacent_filter]
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.
Examples of [adjacent_filter]
Hello,
I am reading wiki on it, and I would like to ask for directions to find some comprehensive examples. Ctrl+F on forum gives a lot of results but not what I am looking for.
I need to define locations as "empty hex that belongs to the location A and has adjacent unit on e,ne orse, but no adjacent units on w, nw or sw".
Thanks in advance,
I am reading wiki on it, and I would like to ask for directions to find some comprehensive examples. Ctrl+F on forum gives a lot of results but not what I am looking for.
I need to define locations as "empty hex that belongs to the location A and has adjacent unit on e,ne orse, but no adjacent units on w, nw or sw".
Thanks in advance,
-
- Posts: 1456
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: Examples of [adjacent_filter]
So, don't quote me on this, but I'm pretty sure [filter_adjacent] is a Standard Unit Filter, so you probably can't use it on a location that doesn't contain a unit.
You're probably looking for [filter_location], or [filter_adjacent_location]
You're probably looking for [filter_location], or [filter_adjacent_location]
Speak softly, and carry Doombringer.
- Celtic_Minstrel
- Developer
- Posts: 2371
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Examples of [adjacent_filter]
So, you want the filter to return an empty hex, right? But there must be a unit vaguely to the east? I think something like this should work:
I'm not sure what you mean by "belongs to the location A" though.
Code: Select all
[filter_location]
# Ensure there is no unit here.
[not]
[filter]
[/filter]
[/not]
[filter_adjacent_location]
adjacent=e,ne,se
# Ensure there IS a unit here
# count=1 # Uncomment this if you want exactly one unit. Otherwise up to 3 adjacent units will match.
[filter]
[/filter]
[/filter_adjacent_location]
[filter_adjacent_location]
adjacent=w,nw,sw
# Ensure there are NO units on any of these spaces
count=3
[not]
[filter]
[/filter]
[/not]
[/filter_adjacent_location]
[/filter_location]