female and [object] description

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
vghetto
Posts: 755
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
Posts: 1576
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, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
vghetto
Posts: 755
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
Inactive Developer
Posts: 503
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: 755
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: 2222
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.
Former maintainer of Steelhive.
Post Reply