Calling in "Say" screen from other screens

Elementario

Member
Game Developer
Nov 11, 2017
252
312
So, i am making a game and i am stuck at this part of coding
I use imagebuttons for all the mapping and when you click a character UI shows up with options like "Greet", "Apologize", etc (Also imagebuttons)
The character in the image below is an imagebutton too
I want to make it so that when the player selects an option like "Greet", there is a dialogue between the characters
Now, here in the imagebutton I use action[Call "label"]
The problem is when i call a label to trigger the dialogue, all the present screens are cleared and only black screen is shown
screenshot0031.png
screenshot0032.png
screenshot0033.png
So as you can see, this happens
Is there a way to Show a label or maybe Show a "say" screen so that the dialogue is shown as in the 3rd image but everything else also stays on the screen

Code:
#Location and character
if lc_clg_wtr:
           add "/images/m_clg_wtr.jpg"
               imagebutton:
                   auto "/images/m_wtr_eva_%s.png"
                   focus_mask True
                   mouse "imagemap"
                   action [ToggleVariable("sl_eva", True), Show("UI_basic")]

#UI button
screen UI_basic():
    #Greet
    imagebutton:
 
        auto "/images/UI/Greet_%s.png"
        tooltip "Greet."
        focus_mask True
        mouse "imagemap"

        if sl_eva:
            action[Hide("UI_basic"), Call("aur_eva")]

#Label for Dialogue      
label eva_grt:
    eva "Hi there."
    $ sl_eva = False
    call screen UI_h
"lc_clg_wtr" is a screen, it has the imagebutton for character, clicking on her bring the UI i.e "screen UI_basic"
"screen UI_basic" has an imagebutton "Greet", clicking on it call a label i.e "label eva_grt"

Anyway to make keep the screens and show the dialogue?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,278
15,108
You take the problem from the wrong angle, and it's located before the part you shown ; or you cleaned too much the code you used as example. The question you should ask to yourself is : what am I doing wrong when I display the image ?
Around half of Ren'py games use this kind of game mechanism for interaction with players. And they neither need to force a say statement, nor have problems of blank screens ; well, to be fair, few have this last problem time to time.
But how can we help you ? We can only guest the answer since we don't know what you did.

Whatever you use :
Code:
  show this image please
  show screen thisScreen
  scene what a beautiful scenery
The image will stay on screen until you :
  • Display a new scene ; reset everything on display
  • Hide the image ; works both for image and screens
  • Show a new screen with the same tag ; only available for showed screens
And apparently it's not what happen for you. So, it's not the way you show the image in your game, and the problem is here. Correct this, and you'll also don't need anymore to force a say statement.

This said, your code have another problem that will only appear way later in the development process, and at the end of the game/current release. You use to reach the label, but then you call the UI screen again. I assume that the said UI will also Call another label and so on. When do you intend to return from all these called labels ? Because, you need to...
So, either you change your game structure to have a correct flow and return from all called label, or you to them.
 
  • Like
Reactions: wurg

Elementario

Member
Game Developer
Nov 11, 2017
252
312
Thanks for the reply and i am sorry if i misunderstood you but even if i use the jump to a label, it still just shows a black screen
And i can't jump to another screen, i have to call it
So...i am sorry but i don't understand what to do still
 

Elementario

Member
Game Developer
Nov 11, 2017
252
312
Also, just so understand completely and to make sure i haven't screwed up let me explain that i am already on a screen, then use the image button(i.e the character) to call/jump to a label(since i can't just use Show label in the imagebutton action) and when in that label the dialogue is done i call back to the first screen, the one with the background and characters
 

Elementario

Member
Game Developer
Nov 11, 2017
252
312
This was the part of coding i skipped because i didn't think it would help but if you want check it out too
Code:
if lc_clg_wtr:
            add "/images/m_clg_wtr.jpg"
                imagebutton:
                    auto "/images/m_wtr_eva_%s.png"
                    focus_mask True
                    mouse "imagemap"
                    action [ToggleVariable("sl_eva", True), Show("UI_basic")]
This is the imagebutton for character, clicking on her bring the UI i.e "screen UI_basic"
"screen UI_basic" has an imagebutton "Greet", clicking on it call a label i.e "label eva_grt"
I also edited the OP to make the Code clear to understand
 

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,058
What @anne O'nymous , is saying at least about proper gameflow is continuously calling sections of the game from other sections of the game lead to problems in the long run.
As I understand it, every time you 'call' something you add it to an internal queue called a 'stack'. So if every time you move around in the game you continuously call from section to section to section you just keep adding things to the stack without ever clearing it.
Ren'py has a command to just go back to the part of the game a call came from 'return'.
So your label code would be:
Code:
label eva_grt:
    eva "Hi there."
    $ sl_eva = False
    return
Not sure about your original issue unfortunately.
 
  • Like
Reactions: anne O'nymous

Elementario

Member
Game Developer
Nov 11, 2017
252
312
Code:
label eva_grt:
    eva "Hi there."
    $ sl_eva = False
    return
Okay thanks, at least now i understand what @anne O'nymous was saying, but the thing is i have tried that and when you use return in a label it does not return the control to the screen
That's why i use call to return back to the screen
I don't know maybe there's a way to return label to the screen without call it
But i have no idea on how to do it
 

Elementario

Member
Game Developer
Nov 11, 2017
252
312
The called routine doesn't have a "screen whatever" before the dialogue so...
Yes, you will have a black screen.
Code:
label eva_grt:
##
    screen whatever    ## whatever screen you want to show here
##
    eva "Hi there." 
    $ sl_eva = False
    hide whatever
    call screen UI_h
    return
Thanks for the reply, i actually tried this a while ago but i decided to wait to see if i am missing something and if there's a better alternative to it because its kind of a navigation system, so it has the coding for all the locations, different images for different time of the day, different character showing up at different places and times and image button for a lot of objects
So because of that, if i show that screen, all the buttons still work too and if the player clicks somewhere else that thing happens at the same time
screenshot0035.png
screenshot0034.png All the other buttons are still clickable
 

Elementario

Member
Game Developer
Nov 11, 2017
252
312
I had actually decided to replicate that screen with a different name but make it unclickable, well it works but that means i have to recode that huge screen again to make all the actions None and also if i make any updates or add anything in the original screen i have to make the same changes in the duplicate too
That's why i thought it would be better to call a "say" screen but i don't know how to do that
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,278
15,108
Thanks for the reply, i actually tried this a while ago but i decided to wait to see if i am missing something [...]
Yes, you missed something. More precisely, the two first sentences of the documentation page regarding :
The things that a user sees when looking at a Ren'Py game can be divided into images and user interface. Images are displayed to the user using the scene, show, and hide statements, and are generally part of the story being told. Everything else the user sees is part of the user interface, which is customized using screens.
So, like I implied in my first answer, your problem is that there isn't image shown to the player, only an interface that will disappear once you quit the screen (whatever with a , or screen statement). That's the normal behavior of Ren'py.



because its kind of a navigation system, so it has the coding for all the locations, different images for different time of the day, different character showing up at different places and times and image button for a lot of objects
Like many other games, which don't have your problem because they don't mix the screen they use to build the image, with the screen they use as user interface.
There's many way to deal with this. All except one imply that you don't do everything in a single place.

You can use an already built , an image (which can be or ), or you can that will dynamically build the actual scene. And in addition to this, you call the screen representing the user interface anytime you need it ; which mean once you've finished with the dialogs.

Or you can have a single screen, that you show or call depending of the fact that you need it to be interactive or not. Just use a parameter to decide how it should works:
Code:
screen myAllInOneScreen( dynamic=False ):
    add theRightBackground
    for c in characterPresent:
       if dynamic is False:
            add c pos( posChar( c ) )
       else:
            imagebutton:
                auto "image/char/"+str( c )+"%s"
                action NullAction()

label someLabel:
    show screen myAllInOneScreen
    "blablabla"
    prettyGirl "Don't 'blablabla' me !"
    "blablabla again !"
    call screen myAllInOneScreen( dynamic=True )
But this last option is really not recommended if you don't already have a good knowledge of Ren'py. As easy to use it can seem at first, it's in fact something really difficult to do, because a single screen will be in charge of all the visual of your game. This mean that it will have to handle every single possible case. Therefore, either it will rely on a tons of behind the scene Python code, or it will rely on a tons of if screen statements that will make the screen really difficult to design, understand and maintain.
One solution can be to limit this by making an overuse of the screen statement. But still it will just split the problem, not really simplify it.
 

Elementario

Member
Game Developer
Nov 11, 2017
252
312
Yes, you missed something. More precisely, the two first sentences of the documentation page regarding :


So, like I implied in my first answer, your problem is that there isn't image shown to the player, only an interface that will disappear once you quit the screen (whatever with a , or screen statement). That's the normal behavior of Ren'py.





Like many other games, which don't have your problem because they don't mix the screen they use to build the image, with the screen they use as user interface.
There's many way to deal with this. All except one imply that you don't do everything in a single place.

You can use an already built , an image (which can be or ), or you can that will dynamically build the actual scene. And in addition to this, you call the screen representing the user interface anytime you need it ; which mean once you've finished with the dialogs.

Or you can have a single screen, that you show or call depending of the fact that you need it to be interactive or not. Just use a parameter to decide how it should works:
Code:
screen myAllInOneScreen( dynamic=False ):
    add theRightBackground
    for c in characterPresent:
       if dynamic is False:
            add c pos( posChar( c ) )
       else:
            imagebutton:
                auto "image/char/"+str( c )+"%s"
                action NullAction()

label someLabel:
    show screen myAllInOneScreen
    "blablabla"
    prettyGirl "Don't 'blablabla' me !"
    "blablabla again !"
    call screen myAllInOneScreen( dynamic=True )
But this last option is really not recommended if you don't already have a good knowledge of Ren'py. As easy to use it can seem at first, it's in fact something really difficult to do, because a single screen will be in charge of all the visual of your game. This mean that it will have to handle every single possible case. Therefore, either it will rely on a tons of behind the scene Python code, or it will rely on a tons of if screen statements that will make the screen really difficult to design, understand and maintain.
One solution can be to limit this by making an overuse of the screen statement. But still it will just split the problem, not really simplify it.
Okay, thanks for the detailed post and for pointing out my mistakes
I will work on it and see how i can implement it
 

Elementario

Member
Game Developer
Nov 11, 2017
252
312
So... don't call the image map, but the base image for it instead. (or the background/sprite combo)

i.e.: if your imagemap is built with "eva_water_home" and "eva_water_hover", use the "eva_water_home" image.
Thank you very much, i may do this instead sounds better