Filtering unit list of modifications
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.
- hermestrismi
- Posts: 632
- Joined: February 6th, 2016, 11:28 pm
- Location: Tunisia
- Contact:
Filtering unit list of modifications
Let's say that I have a unit with a list of custom variables inside modifications.
Now, I need to filter the list of modifications to check if it had a match.
The result will turn false if it had this variables value and true if it hadn't.
If I use [foreach] tag, the process will be repeated.
For example:
Now, if I used
The result will be : true then false.
Briefly, how to check the whole array before return the final result
Now, I need to filter the list of modifications to check if it had a match.
The result will turn false if it had this variables value and true if it hadn't.
If I use [foreach] tag, the process will be repeated.
For example:
Code: Select all
[indent][modifications]
[object]
have_sword=magic
[/object]
[object]
have_sword_iron=yes
[/object]
[/modifications][/indent]
Code: Select all
[indent]
[foreach]
array=unit.modifications.object
[do]
[if]
[variable]
name=unit.modifications.object[$i]
equals=have_sword_iron
[/variable]
[message]
....briefly say HELLO for example...
[/message]
[else]
....briefly say Noway for example...
[/else]
[/if]
[/do]
[/foreach][/indent]
Briefly, how to check the whole array before return the final result
The Dark Master, The Dark Hordes (Unofficial version), Return of the Legion , Eternal Kingdom, An Elvish Scout,Unrest in Elfland , Hidden War ...
The Dark Master Project, Arabic tra. maintainer
"But he loves you" G. Carlin
The Dark Master Project, Arabic tra. maintainer
"But he loves you" G. Carlin
Re: Filtering unit list of modifications
name=unit.modifications.object[$i] should be name=unit.modifications.object[$i].have_sword
- hermestrismi
- Posts: 632
- Joined: February 6th, 2016, 11:28 pm
- Location: Tunisia
- Contact:
Re: Filtering unit list of modifications
how did I mess that ? it was in front of me for one hour... thank you
The Dark Master, The Dark Hordes (Unofficial version), Return of the Legion , Eternal Kingdom, An Elvish Scout,Unrest in Elfland , Hidden War ...
The Dark Master Project, Arabic tra. maintainer
"But he loves you" G. Carlin
The Dark Master Project, Arabic tra. maintainer
"But he loves you" G. Carlin