Is it possible to show nvl and adv at the same time?

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
Lonewhale
Newbie
Posts: 15
Joined: Fri May 17, 2019 11:55 pm
Contact:

Is it possible to show nvl and adv at the same time?

#1 Post by Lonewhale »

Hey. :)
Can someone tell me how you can display both Adv and Nvl at the same time?
With the help of other people's recipes, I can intercept the text from the screen say, and display it on my own. But at the same time, the ability to use part of the tags, such as {w}, {cps} and others, is lost. In short, the text is displayed immediately, and there is no way to display character by character.
I attached a layout of what I want to receive. Namely, the display of thoughts, speech and actions of the characters separately.
And if thoughts and actions, as a whole, have their own frames for each frame, as in the adv mode, only without hiding, then “speech” is different. I wanted to portray speech as an analogue of SMS, bubbles creeping up. And that the text would appear gradually.
Any tips on where to go? :)
Attachments
Dialog2.jpg
From Belarus with love

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Is it possible to show nvl and adv at the same time?

#2 Post by Alex »

You could try to show 'speach' of nvl characters and customize nvl screen to show up menus at the bottom (you can draw the background for menu as part of nvl screen, so it won't hide when choice is made). And thoughts might be shown as a separate screen, that shows some text based on variables. Or try to mace a condition in a nvl screen to check if 'who' (speaker) is 'thoughts' to show its words at different place from normal 'speach'.

viewtopic.php?f=8&t=23434#p293323

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3792
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Is it possible to show nvl and adv at the same time?

#3 Post by Imperf3kt »

I'd just use one or the other and fake the other by making an image out of text (renpy can do this)

Even easier is to simply display text in a screen custom screen that changes based on a variable, as Alex suggests below.
Last edited by Imperf3kt on Sun Mar 15, 2020 4:47 pm, edited 2 times in total.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Lonewhale
Newbie
Posts: 15
Joined: Fri May 17, 2019 11:55 pm
Contact:

Re: Is it possible to show nvl and adv at the same time?

#4 Post by Lonewhale »

To hell, I decided to fake it. But ran into a stupid problem. I copied the words of the narrator, and showed them on the screen when the character spoke. But somehow, it was not the words that the narrator spoke, but those that he said at the very end. I seem to have already heard about this problem, as if the engine is looking at all the code, and only the last value is placed in the variable. The amazing thing is that if I remove the condition and put all the intercepted words on my screen, then everything works fine.
I believe - the My_froud function is called more than 10 times per frame. It is depressing ... :(

Code: Select all

init python:
    class My_gui():
        def __init__(self):            
            self.previous_who = None
            self.action_say = ""
            self.action_show = False
            
    my_gui = My_gui()

    
    def My_fraud(who_origin, what_origin):
        global my_gui

        if (who_origin is None) and (my_gui.previous_who is not None):
            my_gui.action_show = False
            my_gui.action_say = what_origin
        else:
            my_gui.action_show = True

        my_gui.previous_who = who_origin
        return (who_origin, what_origin)


screen say(who, what):
    style_prefix "say"

    window:
        id "window"
        $ who, what = My_fraud(who, what)

        if who is not None:

            window:
                id "namebox"
                style "namebox"
                text who id "who"

        text what id "what"

screen fake_action:
    window:
        background "#0F07"
        pos (20, 20)
        xysize (300, 100)
        text my_gui.action_say at topleft

label start:
    "These words should be on screen fake_action in the next frame."
    e "The window should appear the words of the narrator from the last frame"
    "But these appear"
From Belarus with love

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Is it possible to show nvl and adv at the same time?

#5 Post by Alex »

Lonewhale wrote: Sun Mar 15, 2020 9:52 am ... I believe - the My_froud function is called more than 10 times per frame. ...

Code: Select all

$ who, what = My_fraud(who, what)
Yes, this line is executed on each screen refresh (that is happening from time to time for internal purposes).

You could try to change it to

Code: Select all

screen say(who, what):
    default who, what = My_fraud(who, what)
to set values once when screen appears.

It's not clear why 'fake_action' screen should appear at all - did you set the narrator character use it?

Anyway, try to make it simple, like

Code: Select all

default my_text = ""

screen fake_action:
    zorder 1000
    window:
        background "#0F07"
        pos (20, 20)
        xysize (300, 100)
        text "[my_text]" at topleft

label start:
    show screen fake_action
    "..."
    $ my_text = "These words should be on screen fake_action."
    e "The window should appear the words of the narrator from the last frame"
    $ my_text = "But these appear"
    e "?!"
    my_text = ""
    "... ..."
https://www.renpy.org/doc/html/screens.html#text
https://www.renpy.org/doc/html/style_pr ... y-slow_cps

Lonewhale
Newbie
Posts: 15
Joined: Fri May 17, 2019 11:55 pm
Contact:

Re: Is it possible to show nvl and adv at the same time?

#6 Post by Lonewhale »

Thanks for the helpful answers, Alex, and sorry for missing.
1) I still don’t understand why your code is normally displayed only in renpy 6.15
Alex wrote: Wed Mar 11, 2020 5:35 pm viewtopic.php?f=8&t=23434#p293323
2)
Alex wrote: Sun Mar 15, 2020 2:52 pm It's not clear why 'fake_action' screen should appear at all - did you set the narrator character use it?
Yes. I intended to use this screen to display information about surrounding events. And, leaving the text displayed if the action occurs in the background is a long one. For example, washing dishes while talking.
I thought to display the choice of actions instead of conversation. In this case, it would be possible to write an explanation for the choice just in the screen where the actions are written. I apologize if I explained poorly.
3) Alas, Default did not help. The text on the screen still runs to the very end.
The same crap with style settings: slow_abortable and slow_cps.
4) Suddenly, working with the nvl mode gave a positive result. I already tried to intercept his messages, but failed. Now it has turned out, although it is rather strange. I scanned messages, checked which of them from the narrator, and sent them to my screen. Renpai placed the previous text on the screen, and not the one that is displayed now
Example:
Say | fake_screen
Line 1 | Line 1
Line 2 |
Line 3 | Line 2
From Belarus with love

Lonewhale
Newbie
Posts: 15
Joined: Fri May 17, 2019 11:55 pm
Contact:

Re: Is it possible to show nvl and adv at the same time?

#7 Post by Lonewhale »

I think the problem arises precisely because I am trying to introduce a separation - the words of the narrator in one place, the words of the characters in another. But I can’t imagine how you can write program code without using conditions.
From Belarus with love

Lonewhale
Newbie
Posts: 15
Joined: Fri May 17, 2019 11:55 pm
Contact:

Re: Is it possible to show nvl and adv at the same time?

#8 Post by Lonewhale »

Looks like I found a solution to persistent calls - action, which work when they appear and redraw. In short.

Code: Select all

screen say(who, what):
    on "show" action C_Fraud(who, what)
    on "replace" action C_Fraud(who, what)
    ...
    
init python:
    C_Fraud = renpy.curry(My_fraud)
    
    def My_fraud(who, what):
        global my_text
        if (who is None):
            my_text = what

screen scr_action:
   global my_text
   ...
   text my_text

init start:
    "bla-bla-bla"
But the feeling that I use crutches, and that somewhere there is a better, more convenient, more correct way, does not leave me. :|
From Belarus with love

Post Reply

Who is online

Users browsing this forum: No registered users