defining mass character pronouns

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
monkeykg
Regular
Posts: 48
Joined: Mon Jan 01, 2018 6:36 pm
Projects: DATE KNIGHT
Tumblr: monkeywiki
Contact:

defining mass character pronouns

#1 Post by monkeykg »

I'm aware of the variables out there letting you determine your player character's pronouns, but for the game I'm working on, the pronoun picked at the beginning determines the pronouns of /every/ other character in the game.

Like how to take this kind of code to apply it to all of the other characters simultaneously.

Code: Select all

 if gender == "male":
        $pgender_they = "he"
        $pgender_them = "him"
        $pgender_their = "his"
I'm pretty new at this and a bit stunted trying to figure it out, any ideas? I hope I make sense.

User avatar
Empish
Veteran
Posts: 221
Joined: Thu Jan 14, 2016 9:52 pm
Projects: Efemural Hearts, It Ends With Graduation
itch: empish
Contact:

Re: defining mass character pronouns

#2 Post by Empish »

I think what most people do is only make the main character change pronouns based on the gender. The other ones are fixed and therefore just written into dialogue normally.

But if you want to have multiple characters that can be different genders, you can either define a set of pronouns for each, or do something like this:

Code: Select all

default males = ["Bob", "Joe"]
default females = ["Eileen", "Lucy"]

python:
    def getThey(name):
        if name in males:
            return "he"
        elif name in females:
           return "she"
        else:
            return "they"

    def getThem(name):
        if name in males:
            return "him"
        elif name in females:
            return "her"
        else:
            return "them"

    def getTheir(name):
        if name in males:
            return "his"
        elif name in females:
            return "hers"
        else:
            return "their"

User avatar
monkeykg
Regular
Posts: 48
Joined: Mon Jan 01, 2018 6:36 pm
Projects: DATE KNIGHT
Tumblr: monkeywiki
Contact:

Re: defining mass character pronouns

#3 Post by monkeykg »

Empish wrote: Mon Jan 01, 2018 7:12 pm I think what most people do is only make the main character change pronouns based on the gender. The other ones are fixed and therefore just written into dialogue normally.

But if you want to have multiple characters that can be different genders, you can either define a set of pronouns for each, or do something like this:

hmmm, that's definitely useful but I'm not sure if it's exactly what I'm looking for. Basically-- from the get go every NPC character is ambiguous in gender so I figure all of their pronouns would be a defined term/variable (probably defaulted at they/them/theirs)

and would all sub sequentially change depending on what the player chooses for the main character's pronouns-- IE if the character chose to go by she every character would then be using she for themselves as well, if that makes sense?
(Thanks for the fast reply, by the way!)

User avatar
Empish
Veteran
Posts: 221
Joined: Thu Jan 14, 2016 9:52 pm
Projects: Efemural Hearts, It Ends With Graduation
itch: empish
Contact:

Re: defining mass character pronouns

#4 Post by Empish »

Oh, okay. That makes it much easier. Then you just have to define your three pronouns the way you did in your first post, and use interpolation to have the right one inserted into the dialogue.

Code: Select all

"I saw [pgender_them] get out of [pgender_their] car."

User avatar
monkeykg
Regular
Posts: 48
Joined: Mon Jan 01, 2018 6:36 pm
Projects: DATE KNIGHT
Tumblr: monkeywiki
Contact:

Re: defining mass character pronouns

#5 Post by monkeykg »

Empish wrote: Mon Jan 01, 2018 7:31 pm Oh, okay. That makes it much easier. Then you just have to define your three pronouns the way you did in your first post, and use interpolation to have the right one inserted into the dialogue.

Code: Select all

"I saw [pgender_them] get out of [pgender_their] car."
Oh damn, that's simple. Thanks a ton!

User avatar
Empish
Veteran
Posts: 221
Joined: Thu Jan 14, 2016 9:52 pm
Projects: Efemural Hearts, It Ends With Graduation
itch: empish
Contact:

Re: defining mass character pronouns

#6 Post by Empish »

Yeah. Just be careful about capitalization. You may want to define a set of capitalized pronouns as well so you can also use interpolation at the beginning of a sentence.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: defining mass character pronouns

#7 Post by trooper6 »

And you'll also have to deal with verbs. "[pgender_they] is nice." will be fine when pgender_they is he or she, but if it is they, you'll probably want "[pgender_they] are nice." So you may also want to make a variable for the verb to be.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
monkeykg
Regular
Posts: 48
Joined: Mon Jan 01, 2018 6:36 pm
Projects: DATE KNIGHT
Tumblr: monkeywiki
Contact:

Re: defining mass character pronouns

#8 Post by monkeykg »

trooper6 wrote: Tue Jan 02, 2018 12:07 am And you'll also have to deal with verbs. "[pgender_they] is nice." will be fine when pgender_they is he or she, but if it is they, you'll probably want "[pgender_they] are nice." So you may also want to make a variable for the verb to be.
Thanks both of you. Yeah, I hadn't thought about that. I've mostly been concerned about making sure its functional and grammatically correct. I'll keep that in mind!

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: defining mass character pronouns

#9 Post by Remix »

You could use a gender object rather than mapping.
A quick search brought up this example which could easily toggle the main pronouns...

Personally I would write it with a __getattr__ to map shorthand abbreviations to properties, e.g. pn.acc => GenderObj.accusative_pronoun
Frameworks & Scriptlets:

User avatar
monkeykg
Regular
Posts: 48
Joined: Mon Jan 01, 2018 6:36 pm
Projects: DATE KNIGHT
Tumblr: monkeywiki
Contact:

Re: defining mass character pronouns (see most recent reply)

#10 Post by monkeykg »

Ok I'm bringing this thread back because now that I'm actually implementing the system I'm finding myself coming across some troubles.


I'm having an issue with how the player would go about inputing the pronoun selection.

I don't want it to be typed in-- I want it to be selected from a list. So sort of like a character question route but I don't think it'd function the same way??

so right now I have this code, and I need to figure out what to change the first part to---

Code: Select all

label give_gender:
    
    $ gender = renpy.input("What are your pronouns?")
    $ gender = name.strip() 
    
    if gender == "he":
        $ they = "he"
        $ them = "him"
        $ theirs = "his"
        $ They = "He"
        $ Them = "Him"
        $ Theirs = "His"
        
    if gender == "she":
        $ they = "she"
        $ them = "her"
        $ theirs = "hers"
        $ They = "She"
        $ Them = "Her"
        $ Theirs = "Hers"
        
    if gender == "they":
        $ they = "they"
        $ them = "them"
        $ theirs = "theirs"
        $ They = "They"
        $ Them = "Them"
        $ Theirs = "Theirs"
                                   
    return
Actually I'm not even sure if the entire code is working right now. Here's what I have at the top of the script to try to work in the interpolation of pronouns for player and all characters. I'm just having trouble figuring it out and getting it to work right.

Code: Select all

def they = Pronounthey("[they]") 
def them = Pronounthem("[them]")
def theirs = Pronountheirs("[theirs]")
def They = PronountheyC("[They]") 
def Them = PronounthemC("[Them]")
def Theirs = PronountheirsC("[Theirs]")

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: defining mass character pronouns

#11 Post by xavimat »

(PLEASE FORGIVE MY BAD ENGLISH GRAMMAR...)

For the selection, use a "menu".

For the text, I wouldn't use the functions. I remember an older post in the forums about this, and I found this idea interesting, because it allows you to write directly in a gender and only need to add brackets []

Code: Select all

label give_gender:

    menu:
        "What are your pronouns?"
        "He":            
            $ gender = "he"
        "She":
            $ gender = "she"
        "They":
            $ gender = "they"

    if gender == "he":
        $ they = "he"
        $ them = "him"
        $ their = "his"
        $ theirs = "his"        
        $ They = "He"
        $ Them = "Him"
        $ Theirs = "His"
        $ were = "was"
        $ s = "s"
        $ es = "es"
        $ selves = "self"

    elif gender == "she":
        $ they = "she"
        $ them = "her"
        $ their = "her"
        $ theirs = "hers"
        $ They = "She"
        $ Them = "Her"
        $ Theirs = "Hers"
        $ were = "was"
        $ s = "s"
        $ es = "es"
        $ selves = "self"

    elif gender == "they":
        $ they = "they"
        $ them = "them"
        $ their = "their"
        $ theirs = "theirs"
        $ They = "They"
        $ Them = "Them"
        $ Theirs = "Theirs"
        $ were = "were"
        $ s = ""
        $ es = ""
        $ selves = "selves"

    return

label start:

    call give_gender

    "You overhear Lucie talking about you..."
    "Lucie" "Can you believe it? I've seen [them] walking by the park with [their] dog... [They] [were] talking to [them][selves] as crazy people do! Creepy, isn't it?"
    "Eileen" "Mmmm. Maybe [they] [were] simply talking on the phone with earphones..."
    "Lucie" "No, no! I'm telling you. [They] talk[s] to [them][selves]!"
    "Eileen is not convinced. [They] raise[s] an eyebrow..."
    "Eileen" "Do[es] [they]?"
Note the variables "s" and "es" for the third person verbs; they make some sentences not real English (for example: "[They] do[es]"); but if you pick "he" or "she" as a default, the sentences will be -mostly- real English with added brackets ("[She] do[es]?").
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
monkeykg
Regular
Posts: 48
Joined: Mon Jan 01, 2018 6:36 pm
Projects: DATE KNIGHT
Tumblr: monkeywiki
Contact:

Re: defining mass character pronouns

#12 Post by monkeykg »

xavimat wrote: Sat Jan 20, 2018 9:57 am (PLEASE FORGIVE MY BAD ENGLISH GRAMMAR...)

"Eileen" "Do[es] [they]?"[/code]Note the variables "s" and "es" for the third person verbs; they make some sentences not real English (for example: "[They] do[es]"); but if you pick "he" or "she" as a default, the sentences will be -mostly- real English with added brackets ("[She] do[es]?").
This worked perfectly! Thank you so much, It'll take a bit to make sure all the grammar works but I got some grammar fixed for are vs is!


[Edit] Okay... it was working until I tested out they pronouns with the grammar. Now i think it's giving me the return label glitch and I'm not sure how to fix it...

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00start.rpy", line 120, in script
    return
Exception: Could not find return label (u'C:\\Users\\monkey\\Desktop\\DATEKNIGHTGAME\\DATE KNIGHT/game/script.rpy', 1516462077, 9).

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "renpy/common/00start.rpy", line 120, in script
    return
  File "C:\Users\monkey\Downloads\renpy-6.99.13-sdk\renpy\ast.py", line 1400, in execute
    next_node(renpy.game.context().lookup_return(pop=True))
  File "C:\Users\monkey\Downloads\renpy-6.99.13-sdk\renpy\execution.py", line 586, in lookup_return
    raise Exception("Could not find return label {!r}.".format(self.return_stack[-1]))
Exception: Could not find return label (u'C:\\Users\\monkey\\Desktop\\DATEKNIGHTGAME\\DATE KNIGHT/game/script.rpy', 1516462077, 9).

Windows-8-6.2.9200
Ren'Py 6.99.13.2919
DATE KNIGHT 0.1

Even though I have the return label..


Just to show, here's the code I have that -- Was working fine until I tested the they pronouns, basically.

Code: Select all

label give_gender:
    
   menu:
       
        "What are your pronouns?"
        "He":            
            $ gender = "he"
        "She":
            $ gender = "she"
        "They":
            $ gender = "they"

if gender == "he":
        $ they = "he"
        $ them = "him"
        $ their = "his"
        $ theirs = "his"        
        $ They = "He"
        $ Them = "Him"
        $ Theirs = "His"
        $ were = "was"
        $ s = "s"
        $ es = "es"
        $ selves = "self"
        $ aree = "is"
        $ ss = "s"
        $ ess = "s"
        
elif gender == "she":
        $ they = "she"
        $ them = "her"
        $ their = "her"
        $ theirs = "hers"
        $ They = "She"
        $ Them = "Her"
        $ Theirs = "Hers"
        $ were = "was"
        $ s = "s"
        $ es = "s"
        $ selves = "self"
        $ aree = "is"
        $ ss = "s"
        $ ess = "s"
        
elif gender == "they":
        $ they = "they"
        $ them = "them"
        $ their = "their"
        $ theirs = "theirs"
        $ They = "They"
        $ Them = "Them"
        $ Theirs = "Theirs"
        $ were = "were"
        $ s = ""
        $ es = ""
        $ selves = "selves"
        $ aree = "are"
        $ ss = "re"
        $ ess = "ve"

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: defining mass character pronouns

#13 Post by xavimat »

Could not find return label
Is an unrelated issue. In the code you posted there is no "return" at the end.
And, if you are using savegames, when the code changes, it's possible that renpy does not know where to return (it considers number lines too).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
monkeykg
Regular
Posts: 48
Joined: Mon Jan 01, 2018 6:36 pm
Projects: DATE KNIGHT
Tumblr: monkeywiki
Contact:

Re: defining mass character pronouns

#14 Post by monkeykg »

xavimat wrote: Sat Jan 20, 2018 12:26 pm
Could not find return label
Is an unrelated issue. In the code you posted there is no "return" at the end.
And, if you are using savegames, when the code changes, it's possible that renpy does not know where to return (it considers number lines too).
Ah-- I thought you only needed one return since it ends the game, right? I have it in the very end of my script.

Edit: To clarify, I already have the return label in my actual script. It's never given me this error before.

User avatar
monkeykg
Regular
Posts: 48
Joined: Mon Jan 01, 2018 6:36 pm
Projects: DATE KNIGHT
Tumblr: monkeywiki
Contact:

Re: defining mass character pronouns

#15 Post by monkeykg »

monkeykg wrote: Sat Jan 20, 2018 2:13 pm
xavimat wrote: Sat Jan 20, 2018 12:26 pm
Could not find return label
Is an unrelated issue. In the code you posted there is no "return" at the end.
And, if you are using savegames, when the code changes, it's possible that renpy does not know where to return (it considers number lines too).
Ah-- I thought you only needed one return since it ends the game, right? I have it in the very end of my script.

Edit: To clarify, I already have the return label in my actual script. It's never given me this error before.

I found the solution! It was just a bug.

Post Reply

Who is online

Users browsing this forum: No registered users