[solved] Formula yes compare

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
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

[solved] Formula yes compare

Post by ZombieKnight »

Hi,
I have an ability which should be active when wielders variable flee = yes

Code: Select all

#define ABILITY_FLEE
    [chance_to_hit]
        id=flee
        name= _ "flee"
        female_name= _ "female^flee"
        description=_ "When faced with imminent defeat, the unit can execute a strategic retreat, swiftly disengaging from combat to avoid certain death.
        
The more space this unit has around, the more likely it can evade."
        special_note=_ "This unit can flee combat, to fight another day."
        apply_to=opponent
        divide=2
        [filter_self]
            formula="(self.wml_vars.flee = yes)"
        [/filter_self]
    [/chance_to_hit]
#enddef
Any idea what's wrong with this formula?
looks like it compares variable with yes variable ... but idk how to solve it (= 'yes' doesn't work)
formula="(self.wml_vars.flee = yes)"
Last edited by ZombieKnight on June 24th, 2024, 11:19 am, edited 1 time in total.
white_haired_uncle
Posts: 1456
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Formula yes compare

Post by white_haired_uncle »

So WML treats 1, yes, and true as the same thing as I understand it. And I totally don't get WFL at all, so I am just guessing here, but have you tried things like:

Code: Select all

formula="(self.wml_vars.flee = 'yes')"

formula="(self.wml_vars.flee = 1)"

formula="(self.wml_vars.flee)"
or just

Code: Select all

formula="(wml_vars.flee)"
Speak softly, and carry Doombringer.
User avatar
ZombieKnight
Posts: 371
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Formula yes compare

Post by ZombieKnight »

I thought yes itself is recognized as a 1...
Thanks ^^ works fine now!
Post Reply