HELP error in coding a journal 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
yasminuscula
Newbie
Posts: 7
Joined: Tue May 24, 2022 9:15 pm
Contact:

HELP error in coding a journal screen

#1 Post by yasminuscula » Wed Oct 19, 2022 9:36 pm

so, I want the player to be able to acess a simple journal with important information to the game progression, right?
I managed to successfully add a button on the navigation menu:

Image
I just added a button that calls a screen to the nav buttons:

Code: Select all

if quick_menu:

        hbox:
            style_prefix "quick"

            xalign 0.5
            yalign 1.0

            textbutton _("Back") action Rollback()
            textbutton _("History") action ShowMenu('history')
            textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
            textbutton _("Auto") action Preference("auto-forward", "toggle")
            textbutton _("Save") action ShowMenu('save')
            textbutton _("Q.Save") action QuickSave()
            textbutton _("Q.Load") action QuickLoad()
            textbutton _("Prefs") action ShowMenu('preferences')
            textbutton _("journal") action Show('nav_screen') ##right here
            
            
and the code for the screen looks like this:

Code: Select all

screen nav_screen():
    add "journal.png"
    modal True
    textbutton _("voltar"):
        style "return_button"

        action Return()
when I click, it works, and I added a "return" button on the bottom left (that's written as 'voltar' because is in my native language) as seen here:
Image

but then it when I click on return the image of the journal doesn't disappear, the game text keeps going but the image is still there:
Image
i tried to hide it but is never valid, how do I do this?

User avatar
_ticlock_
Veteran
Posts: 391
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: HELP error in coding a journal screen

#2 Post by _ticlock_ » Wed Oct 19, 2022 10:13 pm

Use modal True and Hide instead of Return(). A modal screen prevents the user from interacting with displayables below it. Return is used to return from call screen, you need to use Hide when you use show screen or Show action.

Code: Select all

screen nav_screen():
    modal True
    add "journal.png"
    modal True
    textbutton _("voltar"):
        style "return_button"

        action Hide("nav_screen")

yasminuscula
Newbie
Posts: 7
Joined: Tue May 24, 2022 9:15 pm
Contact:

Re: HELP error in coding a journal screen

#3 Post by yasminuscula » Thu Oct 20, 2022 9:56 am

_ticlock_ wrote:
Wed Oct 19, 2022 10:13 pm
Use modal True and Hide instead of Return(). A modal screen prevents the user from interacting with displayables below it. Return is used to return from call screen, you need to use Hide when you use show screen or Show action.

Code: Select all

screen nav_screen():
    modal True
    add "journal.png"
    modal True
    textbutton _("voltar"):
        style "return_button"

        action Hide("nav_screen")
thank youu, it worked (something so simple haha)

Post Reply

Who is online

Users browsing this forum: No registered users