[terrain] & [filter_location]
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.
-
- Developer
- Posts: 546
- Joined: January 12th, 2011, 2:18 am
- Location: Pennsylvania, USA
[terrain] & [filter_location]
On my map I want to change all Castles (Ch) to Desert Castles (Cd)wiki wrote:[terrain]
Changes the terrain on the map.
terrain: the character of the terrain to use. See TerrainCodesWML to see what letter a type of terrain uses.
x,y: the position (or range of positions) to change. (Version 1.9 and later only) : [terrain] accepts a StandardLocationFilter. This StandardLocationFilter's terrain= key is used for the new terrain, filtering by terrain can be done with a nested StandardLocationFilter: [and]terrain=terrain_string_to_be_filtered_for.
I thought
Code: Select all
[terrain]
terrain=Cd
[filter_location]
terrain=Ch
[/filter_location]
[/terrain]
I tried a couple other things, but can't figure out what to do from the wiki & can't find an example. How would I do this?
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
Re: [terrain] & [filter_location]
If it's on 1.9 then this should work:
yeah... part of me thinks it should be changed to work like you wrote it though, since that would be more intuitive.
Code: Select all
[terrain]
terrain=Cd
[and]
terrain=Ch
[/and]
[/terrain]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: [terrain] & [filter_location]
It would break backwards compatibility.Sapient wrote:yeah... part of me thinks it should be changed to work like you wrote it though, since that would be more intuitive.
Previously the syntax was [terrain]x,y= without SLF. I however suggested to reintroduce the former letter= key substituting [terrain]terrain= to [terrain]letter= to solve the issue. The problem is that the argument specifying the new terrain collides with the SLF's terrain= key.
What was unclear about my wiki docs btw:
This StandardLocationFilter's terrain= key is used for the new terrain, filtering by terrain can be done with a nested StandardLocationFilter: [and]terrain=terrain_string_to_be_filtered_for.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: [terrain] & [filter_location]
Not necessarily... it could convert convert the terrain filter to this if either x or y are supplied:Anonymissimus wrote: It would break backwards compatibility.
Code: Select all
[and]
x={OUTER_X} # if supplied
y={OUTER_Y} # if supplied
[/and]
[and]
{INNER_FILTER}
[/and]
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
-
- Developer
- Posts: 546
- Joined: January 12th, 2011, 2:18 am
- Location: Pennsylvania, USA
Re: [terrain] & [filter_location]
Thanks Sapient, that worked.
Is there a way to do it under 1.8 without a SLF?
1. I want to swap (Ch) for (Cd) in an event. I realize that [terrain] can do this. Never used [terrain] before.
2. go to [terrain] wiki on the DirectWML page. Seems simple enough, just have to specify original terrain and new terrain. Oh, in 1.9 I can use a SLF. Never used that before.
3. I go the the StandardLocationFilter wiki page. No examples, but I see the bit about 'terrain' key.
4. I check the FilterWML page. Ohhhh..an example under the subheading 'Filtering Terrains'. I try that. (First what I posted above, then [filter]&[filter_location] nested in[terrain])Doesn't work right.
4a. I'm a little confused. I used a ([filter] id=Dummy [/filter] ) in a [store_unit] tag before. Thought that [filter_location] terrain=Ch [/filter_location] would have worked similarly.
5. I review SLFWML & FilterWML, & [terrain]. I notice again the [and]. Realizing it must be there intentionally, and noting the comments under FilterWML calling [and] an extra location filter, which I find confusing for my purposes, I try the following:
6. Doesn't work. I am stumped. I think it must be another nuance of the code I'm just not getting. I post to the forums.
Is there a way to do it under 1.8 without a SLF?
Maybe a journey over my point of view might explain it.Anonymissimus wrote:What was unclear about my wiki docs btw:This StandardLocationFilter's terrain= key is used for the new terrain, filtering by terrain can be done with a nested StandardLocationFilter: [and]terrain=terrain_string_to_be_filtered_for.
1. I want to swap (Ch) for (Cd) in an event. I realize that [terrain] can do this. Never used [terrain] before.
2. go to [terrain] wiki on the DirectWML page. Seems simple enough, just have to specify original terrain and new terrain. Oh, in 1.9 I can use a SLF. Never used that before.
3. I go the the StandardLocationFilter wiki page. No examples, but I see the bit about 'terrain' key.
4. I check the FilterWML page. Ohhhh..an example under the subheading 'Filtering Terrains'. I try that. (First what I posted above, then [filter]&[filter_location] nested in[terrain])Doesn't work right.
4a. I'm a little confused. I used a ([filter] id=Dummy [/filter] ) in a [store_unit] tag before. Thought that [filter_location] terrain=Ch [/filter_location] would have worked similarly.
5. I review SLFWML & FilterWML, & [terrain]. I notice again the [and]. Realizing it must be there intentionally, and noting the comments under FilterWML calling [and] an extra location filter, which I find confusing for my purposes, I try the following:
Code: Select all
[terrain]
terrain=Cd
[filter_location]
[and]
terrain=Ch
[/and]
[/filter_location]
[/terrain]
Co-Author of Winds of Fate
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
My Add-ons: Random Campaign, Custom Campaign, Ultimate Random Maps, Era of Legends, Gui Debug Tools
Erfworld: The comic that lead me to find Wesnoth.
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: [terrain] & [filter_location]
You'd need to [store_locations]terrain=Ch and {FOREACH } over the resulting array while doing [terrain]x,y=$current_hex.x etc in the loop in the same way like e.g. modifying several units at once.SigurdTheDragon wrote:Is there a way to do it under 1.8 without a SLF?
Thanks for that review - so you got confused whether you need to put a [filter_location] tag or not. I agree that it is confusing, the SUF suffers from the same problem because there are some situations where a [filter] tag is needed while in other situations it is not. Analogically for the SLF with its [filter_location] tag...
EDIT
I added something in the SLF's documentation so that its definition is analog to the SUF one and that it's clear that the [filter_location] tag isn't always needed...
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign