Changing dialogue statement [SOLVED]

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
Potato0095
Regular
Posts: 84
Joined: Sun May 08, 2016 8:40 pm
Projects: LoveCraft
itch: potato95
Location: Brazil
Contact:

Changing dialogue statement [SOLVED]

#1 Post by Potato0095 »

Hi!

I wanted to know how to write this code:

Code: Select all

"\"Hey, what are you doing?\""
Like this:

Code: Select all

"Hey, what are you doing?"
And still have the " " in the text. I've been searching through some VN's codes, and Doki Doki does have this feature, so there's a way to do it likewise, right? (the problem is: I don't know how to do it).
Last edited by Potato0095 on Sun Feb 25, 2018 3:41 am, edited 1 time in total.
"There are two types of lies: Lies that hurt, and lies that don't."

User avatar
Draziya
Regular
Posts: 70
Joined: Sun Nov 26, 2017 8:50 am
Completed: this was for you. [NaNoRenO 19], Acetylene [AceJam19], Ah!! My Roommate is a Succubus Hellbent on World [MonJam 18], I Don't Have A Clue [QRMJam 18], Cautionary Tale [NaNoRenO 18], OP Dodge Cross [GGJ 18], Acetone [AceJam 18]
Projects: I'm a love interest in my childhood friend's reverse harem!!
Organization: Watercress
itch: Drazillion
Contact:

Re: Changing dialogue statement

#2 Post by Draziya »

If you want to do "\"Hey, what are you doing?\"" without doing the backslash every time you would do it like this:

Code: Select all

define e = Character("Eileen", what_prefix='"', what_suffix='"')
If you want to do something like "\"Hey, what are you doing?\" said Eileen." without doing the backslash every time you would use " " for one of them, and ' ' for the other.
Image

User avatar
Potato0095
Regular
Posts: 84
Joined: Sun May 08, 2016 8:40 pm
Projects: LoveCraft
itch: potato95
Location: Brazil
Contact:

Re: Changing dialogue statement

#3 Post by Potato0095 »

Welp, it works like you said, thanks.
"There are two types of lies: Lies that hurt, and lies that don't."

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: Changing dialogue statement [SOLVED]

#4 Post by Remix »

If you are using it sporadically (just sometimes for some characters) you could also use a Creator Defined Statement
The example does exactly what you wanted, just remember it must be defined in a python early in a separate file (preferably with name starting 01)
The Documentation wrote:Creator-defined statements allow you to add your own statements to Ren'Py. This makes it possible to add things that are not supported by the current syntax of Ren'Py.

Creator-defined statements must be defined in a python early block. What's more, the filename containing the user-defined statement must be be loaded earlier than any file that uses it. Since Ren'Py loads files in unicode sort order, it generally makes sense to prefix the name of any file containing a user-defined statement with 01, or some other small number.

A user-defined statement cannot be used in the file in which it is defined.

Creator-defined statement are registered using the renpy.register_statement function.
The Example

Code: Select all

python early:

    def parse_smartline(lex):
        who = lex.simple_expression()
        what = lex.rest()
        return (who, what)

    def execute_smartline(o):
        who, what = o
        renpy.say(eval(who), what)

    def lint_smartline(o):
        who, what = o
        try:
            eval(who)
        except:
            renpy.error("Character not defined: %s" % who)

        tte = renpy.check_text_tags(what)
        if tte:
            renpy.error(tte)

    renpy.register_statement("line", parse=parse_smartline, execute=execute_smartline, lint=lint_smartline)
This can be used by writing:

Code: Select all

line e "These quotes will show up," Eileen said, "and don't need to be backslashed."
Which outputs:
"These quotes will show up," Eileen said, "and don't need to be backslashed."
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: alyoshaslab, Bing [Bot]