female and [object] description

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
vghetto
Posts: 75
Joined: November 2nd, 2019, 5:12 pm

female and [object] description

Post by vghetto »

Hi,

I have a pickupable object that needs to show a different string depending the unit's gender. Is there a way of doing that without having to define the same object twice with 2 descriptions inside an [if] unit.gender?

Code: Select all

        [object]
            name= _ "Poison"
            image=items/potion-poison.png
            duration=scenario
            description= _ "$unit.name pricked her finger on a rusty nail."
            [effect]
                apply_to=hitpoints
                increase=-10%
            [/effect]
            [effect]
                apply_to=status
                add=poisoned
            [/effect]
        [/object]
https://github.com/virtualghetto/Vaelia ... .cfg#L1831

User avatar
Elvish_Hunter
Forum Moderator
Posts: 1421
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: female and [object] description

Post by Elvish_Hunter »

Maybe before that [object] you can store the correct pronoun in a variable, then use $pronoun instead of "her" in the message.
Current maintainer of these add-ons:
1.14: The Sojournings of Grog, A Rough Life, The White Troll (co-author), Wesnoth Lua Pack
1.12: Children of Dragons

vghetto
Posts: 75
Joined: November 2nd, 2019, 5:12 pm

Re: female and [object] description

Post by vghetto »

Yes thank you, I was hoping to avoid the extra [IF], but there might not be a way around that. I guess [object] could be a good candidate for a new female_description field?

Tad_Carlucci
Developer
Posts: 499
Joined: April 24th, 2016, 4:18 pm

Re: female and [object] description

Post by Tad_Carlucci »

Check out OBJ_SWORD_FIRE in HttT httt_utils.cfg
I forked real life and now I'm getting merge conflicts.

vghetto
Posts: 75
Joined: November 2nd, 2019, 5:12 pm

Re: female and [object] description

Post by vghetto »

Thank you so much for that. I didn't know I could use message inside of object, it helped a lot.

User avatar
Celtic_Minstrel
Developer
Posts: 1582
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: female and [object] description

Post by Celtic_Minstrel »

Elvish_Hunter wrote:
December 10th, 2019, 8:44 pm
Maybe before that [object] you can store the correct pronoun in a variable, then use $pronoun instead of "her" in the message.
No, that won't work for localization. You would need to store the entire correct string, not just the pronoun.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

Post Reply