How to filter on AMLA chosen in post advance event?

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.
Post Reply
lea
Posts: 301
Joined: October 1st, 2016, 7:25 pm

How to filter on AMLA chosen in post advance event?

Post by lea »

how can I find out in "advance" and "post advance" events what advancement was chosen by player?

EDIT: there may be no point in doing so in "advance" event as gfgtdf pointed out
Last edited by lea on December 27th, 2016, 8:21 pm, edited 2 times in total.
author of: Altered Era/Ruleset (AKA "Altera"), latest version is on add-ons servers for BfW 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10, 1.10 server is stuck with older buggy version)
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: How to filter on AMLA chosen in post advance event?

Post by zookeeper »

With [filter_wml]? Check with :inspect how the advancements appear in units, and write a corresponding filter which will match if the unit has advancement X.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: How to filter on AMLA chosen in post advance event?

Post by gfgtdf »

The "advance" event fire after the advancement is cosen but before it is added to the unit. Afaik there is no way to know which advancements waas chosen.

The "post advance" event fires after the modification was added ot the unit so you can just check the last [advancement] addded to that unit
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
lea
Posts: 301
Joined: October 1st, 2016, 7:25 pm

Re: How to filter on AMLA chosen in post advance event?

Post by lea »

zookeeper wrote:With [filter_wml]? Check with :inspect how the advancements appear in units, and write a corresponding filter which will match if the unit has advancement X.
I would like to detect that certain advancement was chosen, not if it is present on unit (perhaps from previous advances). is it possible to get a list of advancements from $unit variable or result of [store_unit] tag?
author of: Altered Era/Ruleset (AKA "Altera"), latest version is on add-ons servers for BfW 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10, 1.10 server is stuck with older buggy version)
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: How to filter on AMLA chosen in post advance event?

Post by beetlenaut »

lea wrote:is it possible to get a list of advancements from $unit variable or result of [store_unit] tag?
You can use :inspect to find all the keys that are stored using [store_unit]. ($unit is the same, it's just automatically stored.) The key advances_to holds a comma-separated list of advancements. You can load that list into an array using [split] in [set_variables].
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
lea
Posts: 301
Joined: October 1st, 2016, 7:25 pm

Re: How to filter on AMLA chosen in post advance event?

Post by lea »

beetlenaut wrote:
lea wrote:is it possible to get a list of advancements from $unit variable or result of [store_unit] tag?
You can use :inspect to find all the keys that are stored using [store_unit]. ($unit is the same, it's just automatically stored.) The key advances_to holds a comma-separated list of advancements. You can load that list into an array using [split] in [set_variables].
thanks, will last chosen one be always last in this list? experiments supply this assumption but could not find any info on that on the wiki
author of: Altered Era/Ruleset (AKA "Altera"), latest version is on add-ons servers for BfW 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10, 1.10 server is stuck with older buggy version)
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: How to filter on AMLA chosen in post advance event?

Post by beetlenaut »

No, that list just contains the unit types the unit can level into. I think I was answering the wrong question, so this isn't what you need.

The [advancement] that gfgtdf mentioned is an array of AMLAs that you can access with [store_unit]. In that list, the last one would always be the most recently chosen. (Unless they are added in reverse order, in which case it would be the first. I don't remember which way it goes.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: How to filter on AMLA chosen in post advance event?

Post by gfgtdf »

note that the actual tagnames has changes in 1.13 from [advance] to [advancement]to you miht need some
#ifdef here to make sure your code works in 1.12 and 1.13
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
lea
Posts: 301
Joined: October 1st, 2016, 7:25 pm

Re: How to filter on AMLA chosen in post advance event?

Post by lea »

beetlenaut wrote:No, that list just contains the unit types the unit can level into. I think I was answering the wrong question, so this isn't what you need.

The [advancement] that gfgtdf mentioned is an array of AMLAs that you can access with [store_unit]. In that list, the last one would always be the most recently chosen. (Unless they are added in reverse order, in which case it would be the first. I don't remember which way it goes.)
it works and since my advancement can be removed (it has no lasting effects but I did not know that advancements can be removed with [clear_variable]) I can search for it in a loop

thanks to everybody for help
author of: Altered Era/Ruleset (AKA "Altera"), latest version is on add-ons servers for BfW 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10, 1.10 server is stuck with older buggy version)
Post Reply