[SOLVED] Keeping textbox and/or nvl with text shown during anything

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
kei10
Newbie
Posts: 8
Joined: Fri Dec 02, 2016 6:46 am
Contact:

[SOLVED] Keeping textbox and/or nvl with text shown during anything

#1 Post by kei10 »

I'm working on my project smoothly until I nearly went berserk trying to solve the problem with keeping textbox shown at all times, nvl, and/or both with text forever regardless of transitions, scene change, notify, or whatever that is messing with it until the game either crashes, goes back to menu, or quits.

And yes I looked around, google gave me results but it's frustrating to work with. Meanwhile most solutions doesn't work. Even the documentation doesn't seems to work and I'm having a slight headache with it.

I am using Renpy 7. I just want more control with the textbox, nvl, and the text. I've already given up on trying to add default transitions to both textbox and nvl without too much hassle.

My current concern is trying to keep textbox/nvl with text open while displaying notify.

Edit 1: Corrected my question; I want it to have text as well.
Edit 2: My bad, the textbox actually stays open during show notify. Also the textbox already has transition by default, so yay.
Edit 3: Solved, thank you!

Please help!
Thanks in advance.
Last edited by kei10 on Thu Jul 12, 2018 6:37 pm, edited 4 times in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Keeping textbox and/or nvl shown during anything

#2 Post by Per K Grok »

kei10 wrote: Thu Jul 12, 2018 8:25 am I'm working on my project smoothly until I nearly went berserk trying to solve the problem with keeping textbox shown at all times, nvl, and/or both forever regardless of transitions, scene change, notify, or whatever that is messing with it until the game either crashes, goes back to menu, or quits.

And yes I looked around, google gave me results but it's frustrating to work with. Meanwhile most solutions doesn't work. Even the documentation doesn't seems to work and I'm having a slight headache with it.

I am using Renpy 7. I just want more control with the textbox and nvl. I've already given up on trying to add default transitions to both textbox and nvl without too much hassle.

My current concern is trying to keep textbox/nvl open while displaying notify.

Please help!
Thanks in advance.

Setting config.window in options.rpy to "show" should keep the dialogue window open as default.

If that doesn't work, you could try this.

In screens.rpy comment out this line in the section about the say window

#background Image("gui/textbox.png", xalign=0.5, yalign=1.0)

then create a new screen

Code: Select all

screen textbox2:
    add "gui/textbox.png" xalign 0.5 yalign 1.0
    
then in the script show the new screen

show screen textbox2

That way the dialogue box will (appear to) be shown whatever else happens, unless you use

hide screen textbox2

User avatar
kei10
Newbie
Posts: 8
Joined: Fri Dec 02, 2016 6:46 am
Contact:

Re: Keeping textbox and/or nvl shown during anything

#3 Post by kei10 »

Per K Grok wrote: Thu Jul 12, 2018 9:57 am In screens.rpy comment out this line in the section about the say window
#background Image("gui/textbox.png", xalign=0.5, yalign=1.0)
then create a new screen

Code: Select all

screen textbox2:
    add "gui/textbox.png" xalign 0.5 yalign 1.0
    
then in the script show the new screen
show screen textbox2
That way the dialogue box will (appear to) be shown whatever else happens, unless you use
hide screen textbox2
This is so simple, it works! Probably I could use it for nvl, too. Thank you!
However, now I would like to keep the text, too. How would I achieve it?

Thanks, awaiting reply.
Last edited by kei10 on Thu Jul 12, 2018 6:32 pm, edited 1 time in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Keeping textbox and/or nvl shown during anything

#4 Post by Per K Grok »

kei10 wrote: Thu Jul 12, 2018 10:11 am
This is so simple, it works! Probably I could use it for nvl, too. Thank you!
However, now I would like to keep the text, too. How would I achieve it?

Thanks, awaiting reply.
Well I guess you could go full monty and add text to the new screen as well.

You would need a variable to hold a string.

default talkText= " "

You need to add a line to the screen that will write the string that the variable holds.

Code: Select all

screen textbox2:
    add "gui/textbox.png" xalign 0.5 yalign 1.0
    text talkText xalign 0.5 ypos 590  xmaximum 450
xmaximum is good to have for "new line" breaks if the dialogue line is long.


When a new line is to be spoken you just change the talkText variable and refresh the screen

$ talkText="blabla bla bla bla"
show screen textbox2

If you want to show the name of the character speaking and or an image of the character you can add those things using the same principles.

If you have more than one line of dialogue following each other with nothing that stops the flow you would need to put in a pause between the lines.

User avatar
kei10
Newbie
Posts: 8
Joined: Fri Dec 02, 2016 6:46 am
Contact:

Re: Keeping textbox and/or nvl shown during anything

#5 Post by kei10 »

Per K Grok wrote: Thu Jul 12, 2018 2:20 pm Well I guess you could go full monty and add text to the new screen as well.
You would need a variable to hold a string.
default talkText= " "
You need to add a line to the screen that will write the string that the variable holds.

Code: Select all

screen textbox2:
    add "gui/textbox.png" xalign 0.5 yalign 1.0
    text talkText xalign 0.5 ypos 590  xmaximum 450
xmaximum is good to have for "new line" breaks if the dialogue line is long.
When a new line is to be spoken you just change the talkText variable and refresh the screen
$ talkText="blabla bla bla bla"
show screen textbox2
If you want to show the name of the character speaking and or an image of the character you can add those things using the same principles.
If you have more than one line of dialogue following each other with nothing that stops the flow you would need to put in a pause between the lines.
Thank you! It's still a hassle to do that and kind of ugly. But at least it works and works pretty well.

Code: Select all

screen say2(what, who=None, textbox=False):
    style_prefix "say"
    window:
        id "window"
        if (textbox):
            style "window2"
        if who is not None:
            window:
                id "namebox"
                style "namebox"
                text who id "who" style "say_label"
        text what id "what" style "say_dialogue"
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0
        
style window2:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height
I cloned the say() from screens,rpy with some modifications to make it actually work. Meanwhile it was my mistake that the textbox do actually stay while notify is displayed and such. Just that the text is erased, making me think that it wasn't. Still, I need the text. Meanwhile I added an additional parameter whether to show the textbox image, useful for cases when the original textbox stays open.

Code: Select all

label start:
    window show
    char_narrator "Right.{w=0.5} To begin, I need a body.{w=0.5} But before that, I need a certain ability so I can give myself one."
    show screen say2(textbox=True, what="Right.{w=0.5} To begin, I need a body.{w=0.5} But before that, I need a certain ability so I can give myself one.")
    
    $ renpy.notify("Obtained Ability:\n" + chronicle.root["Player"]["Abilities"].entry_add(1, 1).data.name)
    $ renpy.pause(2.0)
    hide screen say2
    char_narrator "With it, now I can biomorph into anything I want.{w=0.5} As long as I don't screw up.{w=0.5} It has weakness and limits, of course."
    show screen say2(textbox=True, what="With it, now I can biomorph into anything I want.{w=0.5} As long as I don't screw up.{w=0.5} It has weakness and limits, of course.")
    
    $ renpy.notify("Obtained Body:\n" + chronicle.root["Player"]["Body"].entry_add(1, 1).data.name)
    $ renpy.pause(2.0)
    hide screen say2
    char_narrator "A whole body set should be simple enough."
And it works wonderfully without any flicker or such. Though I haven't fully tested if it will bug out for longer text, I can easily copy the same dialogue over to the new textbox without editing the text,

Getting the NVL to work seems a bit harder, I guess I will ignore that for now.

Thanks!

User avatar
MRF
Newbie
Posts: 9
Joined: Thu Nov 08, 2018 7:49 am
Projects: Blurry
Contact:

Re: Keeping textbox and/or nvl shown during anything

#6 Post by MRF »

kei10 wrote: Thu Jul 12, 2018 6:25 pm
Per K Grok wrote: Thu Jul 12, 2018 2:20 pm Well I guess you could go full monty and add text to the new screen as well.
You would need a variable to hold a string.
default talkText= " "
You need to add a line to the screen that will write the string that the variable holds.

Code: Select all

screen textbox2:
    add "gui/textbox.png" xalign 0.5 yalign 1.0
    text talkText xalign 0.5 ypos 590  xmaximum 450
xmaximum is good to have for "new line" breaks if the dialogue line is long.
When a new line is to be spoken you just change the talkText variable and refresh the screen
$ talkText="blabla bla bla bla"
show screen textbox2
If you want to show the name of the character speaking and or an image of the character you can add those things using the same principles.
If you have more than one line of dialogue following each other with nothing that stops the flow you would need to put in a pause between the lines.
Thank you! It's still a hassle to do that and kind of ugly. But at least it works and works pretty well.

Code: Select all

screen say2(what, who=None, textbox=False):
    style_prefix "say"
    window:
        id "window"
        if (textbox):
            style "window2"
        if who is not None:
            window:
                id "namebox"
                style "namebox"
                text who id "who" style "say_label"
        text what id "what" style "say_dialogue"
    if not renpy.variant("small"):
        add SideImage() xalign 0.0 yalign 1.0
        
style window2:
    xalign 0.5
    xfill True
    yalign gui.textbox_yalign
    ysize gui.textbox_height
I cloned the say() from screens,rpy with some modifications to make it actually work. Meanwhile it was my mistake that the textbox do actually stay while notify is displayed and such. Just that the text is erased, making me think that it wasn't. Still, I need the text. Meanwhile I added an additional parameter whether to show the textbox image, useful for cases when the original textbox stays open.

Code: Select all

label start:
    window show
    char_narrator "Right.{w=0.5} To begin, I need a body.{w=0.5} But before that, I need a certain ability so I can give myself one."
    show screen say2(textbox=True, what="Right.{w=0.5} To begin, I need a body.{w=0.5} But before that, I need a certain ability so I can give myself one.")
    
    $ renpy.notify("Obtained Ability:\n" + chronicle.root["Player"]["Abilities"].entry_add(1, 1).data.name)
    $ renpy.pause(2.0)
    hide screen say2
    char_narrator "With it, now I can biomorph into anything I want.{w=0.5} As long as I don't screw up.{w=0.5} It has weakness and limits, of course."
    show screen say2(textbox=True, what="With it, now I can biomorph into anything I want.{w=0.5} As long as I don't screw up.{w=0.5} It has weakness and limits, of course.")
    
    $ renpy.notify("Obtained Body:\n" + chronicle.root["Player"]["Body"].entry_add(1, 1).data.name)
    $ renpy.pause(2.0)
    hide screen say2
    char_narrator "A whole body set should be simple enough."
And it works wonderfully without any flicker or such. Though I haven't fully tested if it will bug out for longer text, I can easily copy the same dialogue over to the new textbox without editing the text,

Getting the NVL to work seems a bit harder, I guess I will ignore that for now.

Thanks!
Hey the code work but i wonder how can i change the say and who color with the characters that i already define.
Like so the who is the player name with all the stuff on the define is in. Player name is dynamic and i define it with "mc" and when i want to make the "mc" say something i define ot with "player" am i doing something wrong?

Post Reply

Who is online

Users browsing this forum: Google [Bot], piinkpuddiin