Thought Bubbles or something similar for Interior Monologue

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.
Message
Author
User avatar
Dark12ose
Regular
Posts: 62
Joined: Mon Oct 04, 2021 11:29 pm
Deviantart: Rosentear
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#16 Post by Dark12ose » Wed Jun 08, 2022 4:50 pm

zmook wrote:
Wed Jun 08, 2022 4:33 pm
Dark12ose wrote:
Wed Jun 08, 2022 3:35 pm
When the mct is the first speaker in a scene change is there a ghosting of the default textbox before the custom textbox appear?
Oh, that sounds sort of familiar. I had a similar problem when I was re-writing the 'choice' screen, and fixed the ghost say box with

Code: Select all

  window hide
If that seems to work for your problem, see this part of the docs for details:

https://www.renpy.org/doc/html/config.h ... fig.window
I did find this solution and it definitely hides the ghosting textbox but at the cost of no textbox transition happening unfortunately.
The only way I found to get BOTH working was to do manual change. (I'm VERY picky with what I want lol)

Hopefully, that code can help the both of us!
Note: My mind can be all over the place while I'm writing as I think. If what you read is unclear do tell it to my face :lol:

User avatar
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#17 Post by zmook » Wed Jun 08, 2022 11:14 pm

Okay, you can use ConditionSwitches if you want, but I've usually found simple 'if' statements easier to work with:

Code: Select all

screen say(who, what, thoughtbubble=False):
    # Character keyword arguments beginning with "show_" have the prefix stripped off, 
    # and are passed to the screen as arguments.
    style_prefix "say"

    window:
        id "window"
        if thoughtbubble:
            background Frame("gui/thoughtbubble.png, xalign=0.5, yalign=1.0)
        else:
            background Frame("gui/textbox.png, xalign=0.5, yalign=1.0)

        if who is not None:
            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

lsf22
Regular
Posts: 98
Joined: Wed Feb 23, 2022 9:43 pm
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#18 Post by lsf22 » Thu Jun 09, 2022 12:48 pm

What exactly am I doing wrong with this code? @Zmook

Code: Select all

screen say(who, what, thoughtbubble=False):
    # Character keyword arguments beginning with "show_" have the prefix stripped off,
    # and are passed to the screen as arguments.
    style_prefix "say"

    window:
        id "window"
        if thoughtbubble:
            background Frame("gui/textbox2.png", xalign=0.5, yalign=1.0)
        else:
            background Frame("gui/textbox.png", xalign=0.5, yalign=1.0)

        if who is not None:
            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"

define e = Character("Eileen")
define et = Character("Eileen thoughts", thoughtbubble=True)

User avatar
Dark12ose
Regular
Posts: 62
Joined: Mon Oct 04, 2021 11:29 pm
Deviantart: Rosentear
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#19 Post by Dark12ose » Thu Jun 09, 2022 1:06 pm

lsf22 wrote:
Thu Jun 09, 2022 12:48 pm
What exactly am I doing wrong with this code? @Zmook

Code: Select all

screen say(who, what, thoughtbubble=False):
    # Character keyword arguments beginning with "show_" have the prefix stripped off,
    # and are passed to the screen as arguments.
    style_prefix "say"

    window:
        id "window"
        if thoughtbubble:
            background Frame("gui/textbox2.png", xalign=0.5, yalign=1.0)
        else:
            background Frame("gui/textbox.png", xalign=0.5, yalign=1.0)

        if who is not None:
            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"

define e = Character("Eileen")
define et = Character("Eileen thoughts", thoughtbubble=True)
In your character define it should say show_thoughtbubble=True with the show_

And damn the ghosting textbox does happen :(
Note: My mind can be all over the place while I'm writing as I think. If what you read is unclear do tell it to my face :lol:

User avatar
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#20 Post by zmook » Thu Jun 09, 2022 2:39 pm

Dark12ose wrote:
Wed Jun 08, 2022 4:50 pm
I did find this solution and it definitely hides the ghosting textbox but at the cost of no textbox transition happening unfortunately.
The only way I found to get BOTH working was to do manual change. (I'm VERY picky with what I want lol)
What textbox transition are you trying to use?
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

User avatar
Dark12ose
Regular
Posts: 62
Joined: Mon Oct 04, 2021 11:29 pm
Deviantart: Rosentear
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#21 Post by Dark12ose » Thu Jun 09, 2022 6:19 pm

zmook wrote:
Thu Jun 09, 2022 2:39 pm
What textbox transition are you trying to use?
Just the default dissolve on config.window_show/hide_transition but, if I remember right, it does it with any type of transition. Was testing it out with different types of transition before when I first found the ghosting.

What it does with the custom textbox is the default textbox appears first with the dissolve/transition than the custom textbox appears abruptly replacing it hence when used "window hide" the custom textbox just appears without the transition.
Note: My mind can be all over the place while I'm writing as I think. If what you read is unclear do tell it to my face :lol:

User avatar
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#22 Post by zmook » Thu Jun 09, 2022 6:27 pm

Dark12ose wrote:
Thu Jun 09, 2022 6:19 pm
What it does with the custom textbox is the default textbox appears first with the dissolve/transition than the custom textbox appears abruptly replacing it hence when used "window hide" the custom textbox just appears without the transition.
Oh, huh. I don't have a good answer for that one.

Does anyone know, is Ren'py doing some kind of awkward optimization here?
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

User avatar
Dark12ose
Regular
Posts: 62
Joined: Mon Oct 04, 2021 11:29 pm
Deviantart: Rosentear
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#23 Post by Dark12ose » Thu Jun 09, 2022 6:46 pm

zmook wrote:
Thu Jun 09, 2022 6:27 pm
Does anyone know, is Ren'py doing some kind of awkward optimization here?
Should have wrote this in the previous post but this is actually what Renpy does in general even with it's own default textbox. You just don't see it since it replaces it with the same exact one in a split second. For some reason manually changing with ConditionSwitch is the only way I found so far that makes it NOT do it.
Note: My mind can be all over the place while I'm writing as I think. If what you read is unclear do tell it to my face :lol:

lsf22
Regular
Posts: 98
Joined: Wed Feb 23, 2022 9:43 pm
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#24 Post by lsf22 » Sat Jun 11, 2022 4:45 pm

I have wondered how version 8 is going to affect the code, which says it adds support for Python 3. I'm still using 7.4.11 for my game.
As for the current condition switch code by @DarkRose, it works fine. One thing to consider if anyone is using this method is that you'll able to see that when if you escape the dialogue by going to another menu(eg. tutorial menu) during the thought bubble dialogue is that it will still be active.

User avatar
Dark12ose
Regular
Posts: 62
Joined: Mon Oct 04, 2021 11:29 pm
Deviantart: Rosentear
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#25 Post by Dark12ose » Sat Jun 11, 2022 8:32 pm

lsf22 wrote:
Sat Jun 11, 2022 4:45 pm
I have wondered how version 8 is going to affect the code, which says it adds support for Python 3. I'm still using 7.4.11 for my game.
As for the current condition switch code by @DarkRose, it works fine. One thing to consider if anyone is using this method is that you'll able to see that when if you escape the dialogue by going to another menu(eg. tutorial menu) during the thought bubble dialogue is that it will still be active.
I'm currently using the version 8 and it still works perfectly fine so no worries there.

What do you mean by menu? Choice menu or a custom screen or something else? I never ran into a problem where a textbox stayed unless I forgot to place a $ tb = "normal". Are you using the way Zmook suggested or my first post? If you can, can you post the code and I'll try to figure out why it's doing that.
Note: My mind can be all over the place while I'm writing as I think. If what you read is unclear do tell it to my face :lol:

lsf22
Regular
Posts: 98
Joined: Wed Feb 23, 2022 9:43 pm
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#26 Post by lsf22 » Mon Jul 11, 2022 12:35 pm

With the way my game was set up It ended up going back to normal once I add a $ tb = "normal" back to the method you showed @Dark12rose.

As for version 8 of Renpy I still have not used it yet, it does sound like a major change for Renpy.

lsf22
Regular
Posts: 98
Joined: Wed Feb 23, 2022 9:43 pm
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#27 Post by lsf22 » Fri Jul 22, 2022 8:38 pm

Dark12ose wrote:
Wed Jun 08, 2022 3:35 pm
zmook wrote:
Wed Jun 08, 2022 11:41 am
FWIW, it's common practice to define a separate "character" to speak the interior thoughts, when you want them to have a different look.

Code: Select all

define mc = Character("Our hero")   # for normal dialog
define mct = Character("", show_thoughtbubble=True)   # main character thoughts

screen say(who, what, thoughtbubble=False):
    # Character keyword arguments beginning with "show_" have the prefix stripped off, 
    # and are passed to the screen as arguments.
    style_prefix "say"
    
    window:
        style window:
        	background ConditionSwitch(
		        "thoughtbubble", Frame("gui/thoughtbubble.png, xalign=0.5, yalign=1.0)
	        	"True", Frame("gui/textbox.png, xalign=0.5, yalign=1.0),
	                )


label start:
	mc "The dialogue box is a regular box."
	mct "Now the dialogue box is my inner thought bubble."

Hmm the textbox doesn't seem to appear. Just uses the default textbox.

This would be nice if it works as it will save a whole lot of typing and confusion but one question. When the mct is the first speaker in a scene change is there a ghosting of the default textbox before the custom textbox appear?

I was having that problem when I was using the "window_background" in the Character() and using this method for automatic textbox change hence I just suggested manual change with ConditionSwitch.
So I started another test and for some reason the frame is using a width much bigger than what I created the textbox resolution size to. It happens when the condition switch code in effect

Textbox actual resolution size is at 1140x260

Is there some argument I can place within it to display a different size?

Code: Select all

[code]style window:
    background ConditionSwitch(
    "tb == 'normal'", Frame("gui/textbox.png", xalign=0.5, yalign=1.0),
    "tb == 'thoughtbubble'", Frame("gui/textbox_thought.png", xalign=0.5, yalign=1.0)
    )
[/code]

I have attached some example images of it.
Attachments
textbox right size.png
When code is not used/ Commented out
textbox wrong size.png
When the code is in use. The textbox is not at it's right size

User avatar
Dark12ose
Regular
Posts: 62
Joined: Mon Oct 04, 2021 11:29 pm
Deviantart: Rosentear
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#28 Post by Dark12ose » Fri Jul 22, 2022 8:51 pm

Instead of Frame() use Image(). Frame() will adjust the size of the textbox while Image() keeps it the same size no mater what.
Note: My mind can be all over the place while I'm writing as I think. If what you read is unclear do tell it to my face :lol:

lsf22
Regular
Posts: 98
Joined: Wed Feb 23, 2022 9:43 pm
Contact:

Re: Thought Bubbles or something similar for Interior Monologue

#29 Post by lsf22 » Sun Jul 24, 2022 4:57 am

Thanks, I got my dialogue box to where I wanted it to be

Post Reply

Who is online

Users browsing this forum: Ocelot