[SOLVED] Placing Dialog in a different screen?

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
dannymozzer
Newbie
Posts: 4
Joined: Mon Dec 16, 2019 6:57 pm
Contact:

[SOLVED] Placing Dialog in a different screen?

#1 Post by dannymozzer »

Hi,

I've started messing around with different stuff in Ren'Py, and I've created a screen which I would like to use for cutscenes, I was wondering, how can I make the dialog appear in the new screen, rather than the standard dialog boxes. As shown on the image posted, you'll see what I'm trying to ask, basically the screen just creates two black bars, top and bottom, and I want the dialog to go in the bottom black bar, instead of the dialog screen, like shown in the image.
Example_Screen.png
Sorry, if my question isn't easy to understand, but I didn't know how else to ask.

The code I have so far is a very basic way of creating the screen:

Code: Select all

screen cutscene_diag:

    modal False

    add "bargui_raise"
    add "bargui_lower"
Thanks,
Dan
Last edited by dannymozzer on Wed Dec 18, 2019 3:22 pm, edited 1 time in total.

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Placing Dialog in a different screen?

#2 Post by isobellesophia »

Code: Select all

screen cutscene_diag: 
    modal False 
    add "bargui_raise" 
    add "bargui_lower"
    text "Example" xalign 0.5 ypos (put a number that can fit below the dialogue)
I am a friendly user, please respect and have a good day.


Image

Image


dannymozzer
Newbie
Posts: 4
Joined: Mon Dec 16, 2019 6:57 pm
Contact:

Re: Placing Dialog in a different screen?

#3 Post by dannymozzer »

isobellesophia wrote: Wed Dec 18, 2019 12:10 pm

Code: Select all

screen cutscene_diag: 
    modal False 
    add "bargui_raise" 
    add "bargui_lower"
    text "Example" xalign 0.5 ypos (put a number that can fit below the dialogue)
Thank you, but I think I wasn't clear enough, because, I want to constantly change that text, so much like when you click it changes the dialog, I want that dialog to also change, but in the same place, can I somehow define a variable for the text and then make it change every time I click?

dannymozzer
Newbie
Posts: 4
Joined: Mon Dec 16, 2019 6:57 pm
Contact:

Re: Placing Dialog in a different screen?

#4 Post by dannymozzer »

OK,

So this is kind of what I'm after, and this is how I did it:

Image

Define the text

Code: Select all

screen text_cut:
    zorder 3
    text "Hello" xalign 0.5 yalign 0.95

screen text_cut2:
    zorder 3
    text "Hello!!" xalign 0.5 yalign 0.95
How I display the text:

Code: Select all

window hide

show screen cutscene_diag

    pause(1.0)

    show screen text_cut

    pause(2.0)

    hide screen text_cut

    show screen text_cut2

    pause(5.0)
So far, this is the only way I could figure out how to do it, if there is a more efficient way, then please let me know.

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Placing Dialog in a different screen?

#5 Post by RicharDann »

You can pass arguments to a screen so it can be reused many times.
Can't test it out now but try modifying your screen like this (the code is untested!):

Code: Select all

screen text_cut(txt):

    zorder3
    text txt xalign .5 ypos .95
Then you can use the function equivalent of show screen, which is renpy.show_screen() to pass the text:

Code: Select all

$ renpy.show_screen('text_cut', txt="Hello")

pause

hide text_cut

$ renpy.show_screen('text_cut', txt="Hello!!!")
The most important step is always the next one.

dannymozzer
Newbie
Posts: 4
Joined: Mon Dec 16, 2019 6:57 pm
Contact:

Re: Placing Dialog in a different screen?

#6 Post by dannymozzer »

RicharDann wrote: Wed Dec 18, 2019 1:16 pm You can pass arguments to a screen so it can be reused many times.
Can't test it out now but try modifying your screen like this (the code is untested!):

Code: Select all

screen text_cut(txt):

    zorder3
    text txt xalign .5 ypos .95
Then you can use the function equivalent of show screen, which is renpy.show_screen() to pass the text:

Code: Select all

$ renpy.show_screen('text_cut', txt="Hello")

pause

hide text_cut

$ renpy.show_screen('text_cut', txt="Hello!!!")
That was it, thank you! I actually found that keeping the screen for the text separate made it a little bit easier to manage, but it still works great, so thanks again!

I only had to modify it slightly to work for how I needed it to be displayed, so here it is below, of course, thank you to RicharDann! :)

The code placed in the script is as follows:

Code: Select all

screen text_cut(txt):

    zorder 3
    text txt xalign 0.5 ypos 0.915
Then the code that displays the messages, and then eventually makes the cutscene screens fade away.

Code: Select all

    #We don't want the actual dialog box to appear on this screen
    window hide

    #Play the animation to display the black cutscene bars
    show screen cutscene_diag

    #This hard pause stops the user from clicking
    $ renpy.pause(1, hard=True)

    # How we place the text on the screen
    $ renpy.show_screen('text_cut', txt="Hello")

    # Wait before hiding and displaying the next piece of text
    pause (2.0)

    hide text_cut

    pause (1.0)

    $ renpy.show_screen('text_cut', txt="Hello!!!")

    $ renpy.pause(2, hard=True)

    #Fade the screens away
    hide screen text_cut
    with dissolve

    hide screen cutscene_diag
    with dissolve

    $ renpy.pause(1, hard=True)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], voluorem