Page 1 of 1

Unable to add name function to renpy.random.choice

Posted: Wed May 01, 2024 9:16 pm
by DewyNebula
Hello, I'm unsure if I worded the title correctly to what my issue is, but I tried my best. I'm using a "renpy.random.choice" in a menu to have two random dialogues happen. I wanted to add a function that made attributes from my character creator into words (I chose blond hair and could reference blond in dialogue). I could make a function to do that in regular dialogue, but I cannot in the random one - it will break the quotes. Here is what it currently looks like.

Code: Select all

define nice_dialogue = ["Oh, it is so nice to see you today! your [irises_checker()] eyes look beauitiful!", "Did you do something different with your hair? It is more [hair_color_checker()] than usual."]
    $ random_dialogue = renpy.random.choice(nice_dialogue)

Re: Unable to add name function to renpy.random.choice

Posted: Thu May 02, 2024 8:38 pm
by philat
While it is unclear what your actual problem is, I assume it's double interpolation. The simplest way to make this work is probably to use renpy.say ( $ renpy.say(e, random_dialogue) ) instead of a standard say statement (e "[random_dialogue]").