Quantcast
Channel: The Battle for Wesnoth Forums
Viewing all articles
Browse latest Browse all 2118

WML Workshop • Re: filter : help_taxonomy

$
0
0
Quick thought (haven't got time to properly think about or test this right now, am busy with rl stuff):

Arrays (lists) of types, races etc. can be used (this worked in my test campaign).
(Apologies for the awful indenting, was scribbled down in a mad rush!)

Code:

[event]  name=ftest  first_time_only=no[if]  [have_unit]    type=$ftypetest    race=$fracetest  [/have_unit][then]  [message]    type=$ftypetest    race=$fracetest    message=_"I am the first unit matching filter""type=$ftypetest""""race=$fracetest"""  [/message][/then][else]  [message]    speaker=narrator    message=_"No unit matched filter""type=$ftypetest""""race=$fracetest"""  [/message][/else][/if][/event]   [event]    name=side 1 turn 1{DEBUG_MSG (_"Filter test")}{VARIABLE ftypetest "Skeleton,Spearman,Ghoul"}{VARIABLE fracetest "drake,human,wolf"}[fire_event]  name=ftest[/fire_event]  [/event]
If you always use the same arrangement of conditions (same [and], [not], [or]) then this should do most of what you need?
If you also want to dynamically add conditions there may be clever ways to do this in WML with, possibly, [have_unit] with count=0 (to test if the [not] is satisfied), $$, [insert_tag] and/or glob_on. But I'm afraid I'm out of time, sorry. :(
No doubt kind folk cleverer than me can help you out!
Good luck,
cheers!
-- Spannerbag
thank you so much . I will test it asap

Statistics: Posted by hermestrismi — Today, 8:20 am



Viewing all articles
Browse latest Browse all 2118

Trending Articles