[Solved] Dialogue called from a menu is not added to History.

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
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

[Solved] Dialogue called from a menu is not added to History.

#1 Post by Tayruu »

I have an item screen in my game with a button to analyse something in your inventory. I have discovered though this dialogue doesn't show up in Ren'py History screen.

I created a basic demo and I was able to replicate this behaviour. The dialogue is called via a Jump,

Code: Select all

        textbutton _("Test Description") action Jump("bluh")
... and the dialogue label can be as simple as...

Code: Select all

label bluh:
    e "look"
    e "just"
    e "idk"
    return
... and this lot of text is not added to History.

This was observed in the latest release 6.99.14.1.3218 and the prerelease, 6.99.14.2.3275.
Last edited by Tayruu on Fri Jun 01, 2018 3:34 am, edited 1 time in total.

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

Re: Dialogue called from a menu is not added to History.

#2 Post by philat »

I would guess that you're using ShowMenu to show the screen with the button? Menu context is just different. Saving doesn't work in menu context either.

User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Re: Dialogue called from a menu is not added to History.

#3 Post by Tayruu »

Yes, although with this demo I just appended it to the main pause menu, which isn't called by a button but by right mouse/keyboard. And the same thing was observed.

So yeah I guess some way to get recording to history to work in menu context is what I'm after.

User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Re: Dialogue called from a menu is not added to History.

#4 Post by Tayruu »

I've observed this menu-activated dialogue still isn't added to history in 7.0.0.190.
Though I wonder if I'm not necessarily going about this the right way.

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

Re: Dialogue called from a menu is not added to History.

#5 Post by philat »

Right mouse/ESC uses ShowMenu. Wouldn't it make more sense just to not do whatever it is you're doing in menu context?

User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Re: Dialogue called from a menu is not added to History.

#6 Post by Tayruu »

I'm not sure I can avoid that?

My project has an item screen, which is opened via a button. It lists your inventory and has an "examine" button (which calls the dialogue). If I change ShowMenu to just Show, yes, the dialogue now loads into history.
However since the item screen is no longer new context (just extra UI over the main game), it means interactable elements underneath the item screen can be activated, as well as causing the game to end if I try to open the pause menu or close this screen.
(Though this is probably because the context in which the button is used is a loop of dialogue-less screen awaiting the player to click on scenery objects or other UI elements.)

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Dialogue called from a menu is not added to History.

#7 Post by kivik »

You can call the screen instead of showing it.

You can also use modal True to prevent interaction with stuff underneath. But from what you said, it sounds like you just need to call the screen - make sure you have a close button though.

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

Re: Dialogue called from a menu is not added to History.

#8 Post by philat »

Call the base investigation screen (where you're waiting for the player to click the scenery or whatever) and have that screen with a button that can Show() the inventory. As long as the original screen is waiting for input, the inventory only needs to be shown/hidden.

User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Re: Dialogue called from a menu is not added to History.

#9 Post by Tayruu »

With some experimenting it seems that using modal True was not going to work. The problem with this is that it also prevented me from advancing dialogue that was called from the examine button. I was also getting a few errors for trying to use "call screen" to do with forgetting a ui.close or some such.

Regardless I did eventually come to a solution. Since I wasn't sure how to use "call screen" as a screen function, I tried using a label to use renpy language. Which in that case I remembered I called another screen that way, and checked my code there.

I turned my screen call from ShowMenu("item_screen") to renpy.curried_call_in_new_context("call_itemscreen"), and created the following label:

Code: Select all

# Entry points from the game into menu-space.
label call_itemscreen():
    $ renpy.call("enter_game_menu")
    # Transition
    $ renpy.play(config.enter_sound)
    $ _enter_menu()
    $ renpy.store.suppress_overlay = False
    $ renpy.store._history = True
    $ renpy.transition(config.intra_transition)
    # Show and interact
    $ renpy.show_screen("item_screen")
    $ ui.interact()
    # On close
    $ renpy.transition(config.intra_transition)
The important part is the two lines after $ _enter_menu() - _history = True allowed the dialogue to once again be stored, while suppress_overlay = False allows the text history to be called via the scrollwheel.
(I suppose if I wanted, I could make it that the the text history is only allowed during dialogue, since it can be opened in the item screen proper like this, but it works for now.)

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: [Solved] Dialogue called from a menu is not added to History.

#10 Post by kivik »

Out of curiosity, why are you using pure python statements when they're not necessary?

Also have you tried just using call screen item_screen? It should have the same effect as showing a screen then forcing an interact?

My comment about modal True was separate to using call screen if for whatever reason you wanted to show it instead of calling it - but it really sounds like you're just after a call screen here?

Sorry if I'm missing something - I had the same struggle with understanding screen before until I realised calling a screen did everything I needed!

User avatar
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

Re: [Solved] Dialogue called from a menu is not added to History.

#11 Post by Tayruu »

I'm... not sure why I'm using python statements there. It might be older code I've copied from other things over and over and not updated.

I think "calling" a screen follows a pattern of "show the screen and close it once interaction has occurred", whereas "show screen" doesn't automatically close it, which is what I want. Or in the very least, when using the examine button (Jump(), but also happened with Call()), it causes the screen to close before the dialogue starts.

Code: Select all

# Entry points from the game into menu-space.
label call_itemscreen():
    call enter_game_menu
    # Transition
    play sound config.enter_sound
    $ _enter_menu()
    $ renpy.store.suppress_overlay = False
    $ renpy.store._history = True
    $ renpy.transition(config.intra_transition)
    # Show and interact
    show screen item_screen
    $ ui.interact()
    # On close
    $ renpy.transition(config.intra_transition)
I went through and replaced what I could. If I remove ui.interact() the screen instantly closes. If I use with rather than renpy.transition, the transitions don't animate correctly - causing fades before the screen shows or not playing at all.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]