Say screen hidden when call 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
Zecyd
Newbie
Posts: 5
Joined: Tue Dec 05, 2017 10:20 pm
Contact:

Say screen hidden when call screen

#1 Post by Zecyd »

Hello !
When i do a call screen in script.rpy (to ask for a choice) the buttons appear correctly but the say screen hides itself until the choice is made.
I'd like the player to be able to see the last sentence on the say screen to provide context, or remind him of what was just said.

Here is how I do it (simplified)

script.rpy

Code: Select all

label start:

	"Alice" "Hello you !"
	"Alice" "Would you like to change my name ?"
	call screen choice()
		 if _return == 0:
		 	"Alice" "That's good ! I love my name !"
		 else:
		 	"Alice" "Too bad, I don't know you well enough ..."
return
screen.rpy

Code: Select all

screen choice():
   	hbox:
        	xalign 0.5
        	yalign 0.8
        	spacing 120
        	vbox:
            		imagebutton auto "no_%s.png" action Return(0)
        	vbox:
            		imagebutton auto "yes_%s.png" action Return(1)
So in this example when the yes / no buttons appear, the window with the conversation disappears, until the player click on one answer. I'd like to have both on the screen at the same time.

Thanks in advance !

Errilhl
Regular
Posts: 164
Joined: Wed Nov 08, 2017 4:32 pm
Projects: HSS
Deviantart: studioerrilhl
Github: studioerrilhl
Contact:

Re: Say screen hidden when call screen

#2 Post by Errilhl »

Why aren't you just using a menu...?

Code: Select all

menu:
    "Would you like to change my name?"
    "Yes":
         #do something
    "No":
         #do nothing
No need to call screens or anything like that
Currently working on: Image

Zecyd
Newbie
Posts: 5
Joined: Tue Dec 05, 2017 10:20 pm
Contact:

Re: Say screen hidden when call screen

#3 Post by Zecyd »

Thanks for the reply, I could do that, but if there's a quick way to achieve the same result while still using call screen, it could save me a lot of time for now.

The code sample I provided earlier was very simplified, just to be sure people could understand my problem, I'm not a english native speaker.
I ask the player for a lot of choices, with a lot of images, each one with a hover, and being able to write something like this :

Code: Select all


call screen choice("truth_%s.png", "lie_%s.png")

Is saving me a lot of time.

I'll have a look at 'menu:' and see if it can do everything I need and keep my code structure as I like it. In the meantime, it could be nice to know if it's possible using my way.

But thanks again for the tip !

[Edit] my bad.

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Say screen hidden when call screen

#4 Post by philat »

Setting interact to False (afaik, that is what's done behind the scenes when you use the caption for default menus).

Code: Select all

$ renpy.say("Alice", "Would you like to change my name?", interact=False)
call screen choice()

Zecyd
Newbie
Posts: 5
Joined: Tue Dec 05, 2017 10:20 pm
Contact:

Re: Say screen hidden when call screen

#5 Post by Zecyd »

Hi, from what I gathered from the documentation and my quick test, say() interact=false only bypass the user input needed to print the next sentence.
When I pasted your example to check it out, the say() was almost impossible to read (displayed so fast) but the call() did hide the main window again.

The only way I found so far, very ugly thing to do but well... (if someone having the same issue finds this thread one day) is to copy paste your last sentence as an argument to the call() and display it using a text() above the buttons. It's horrible, I know.

Simplified code :

Code: Select all

"Alice" "Did you stole my wallet ?"
call screen choice("truth_%s.png", "lie_%s.png", "Did you stole my wallet ?")

screen choice(button1,button2,lastText):
    
    text (lastText)  xalign 0.5 yalign 0.6
    
    hbox:
        xalign 0.5
        yalign 0.8
        spacing 300
        
        vbox:
		imagebutton auto button1 action Return(0)
	vbox:
                imagebutton auto button2 action Return(1)
I hope someone can provide a better way :)

I was thinking about catching the last push in history_list and printing it in the call(), but I can't seem to find how for now, and there is the possiblity that the last sentence printed on the screen will not be in the list yet anyway. Still searching ... ^^

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: Say screen hidden when call screen

#6 Post by Remix »

There are 3 *little-known* functions in exports that might help...

Code: Select all

def do_reshow_say(who, what, interact=False):

    if who is not None:
        who = renpy.python.py_eval(who)

    say(who, what, interact=interact)
curried_do_reshow_say = curry(do_reshow_say)

def get_reshow_say(**kwargs):
    return curried_do_reshow_say(
        renpy.store._last_say_who,
        renpy.store._last_say_what,
        **kwargs)

def reshow_say(**kwargs):
    get_reshow_say()(**kwargs)
Oddly though, the only way I've had them work (yeah I need to learn more about Ren'py use of curry) is by just 'use' ing the say screen inside another and even then the alignment goes weird...

Code: Select all

screen a():
    text "A"
    use say(renpy.store._last_say_who, renpy.store._last_say_what)
Anyway, it might give you (or anyone else) some options to streamline the code...
Frameworks & Scriptlets:

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: Say screen hidden when call screen

#7 Post by Remix »

On an aside...

I would advise copying the screen choice and renaming it as something else for the icon based ones... That way, normal menu: blocks would still work fine using choice

Code: Select all

screen icon_choice( buttons, reshow_say=True ):
    # do a reshow if needed (if you get it working ok)
    vbox:
        for idx,button in enumerate(buttons): # basically counts idx (from 0) while iterating
            imagebutton auto button action Return(idx)
Frameworks & Scriptlets:

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: Say screen hidden when call screen

#8 Post by Remix »

philat's snippet works fine here... does your screen still try to jiggle the say screen?

If you really wanted to repeat the say, maybe a function call and pass the say info...

Code: Select all

init python:
    def icon_screen( who, what, buttons ):
        renpy.say( who, what, interact=False )
        renpy.call_screen( "icon_choice", buttons )

label start:
    "a"
    $ icon_screen( None, "words", ['a','b'] )
It just does what philat's does though... just in one call
Frameworks & Scriptlets:

philat
Eileen-Class Veteran
Posts: 1912
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Say screen hidden when call screen

#9 Post by philat »

Zecyd wrote: Wed Dec 06, 2017 7:06 am Hi, from what I gathered from the documentation and my quick test, say() interact=false only bypass the user input needed to print the next sentence.
When I pasted your example to check it out, the say() was almost impossible to read (displayed so fast) but the call() did hide the main window again.
Nope. Works; I've used it before. I don't know what else you may have changed to get the result you're getting.

Zecyd
Newbie
Posts: 5
Joined: Tue Dec 05, 2017 10:20 pm
Contact:

Re: Say screen hidden when call screen

#10 Post by Zecyd »

A big thanks to both of you, it's working indeed.
I don't know why 'interact' didn't work previously for me, did something wrong, that's for sure.
I'm sorry if I came accross as ungrateful or dismissive.
I guess I needed someone to put it together for me !

Thanks again !

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]