Unable to add name function to renpy.random.choice

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
DewyNebula
Newbie
Posts: 13
Joined: Sun Apr 21, 2024 10:57 am
Contact:

Unable to add name function to renpy.random.choice

#1 Post 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)

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

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

#2 Post 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]").

Post Reply

Who is online

Users browsing this forum: No registered users