Page 1 of 1

[Solved]Custom Screens

Posted: Wed Sep 29, 2021 11:19 am
by red-NINE
Hi
The following code works.

Code: Select all

screen customscreen:
    modal True
    zorder 200
    style_prefix "confirm"
    add "gui/overlay/confirm.png"
    frame:
        vbox:
            xalign .5
            yalign .5
            spacing 45
            label _("Not Yet Implemented"):
                style "confirm_prompt"
                xalign 0.5
            textbutton _("OK") xalign 0.5 action Hide("customscreen")
    key "game_menu" action Hide("customscreen")
    
    
textbutton _("Google") xpos 960 ypos 540 action Show("customscreen")
But when write the following code I get an error. Can you tell me what i am missing or doing wrong?

Code: Select all

screen customscreen(custommessage):
    modal True
    zorder 200
    style_prefix "confirm"
    add "gui/overlay/confirm.png"
    frame:
        vbox:
            xalign .5
            yalign .5
            spacing 45
            label _(custommessage):
                style "confirm_prompt"
                xalign 0.5
            textbutton _("OK") xalign 0.5 action Hide("customscreen")
    key "game_menu" action Hide("customscreen")
    
    
textbutton _("Google") xpos 960 ypos 540 action Show("customscreen(_("Not Yet Implemented"))")
I get error in the last line - syntax error

Re: Custom Screens

Posted: Wed Sep 29, 2021 11:47 am
by drKlauz
Wrong quotes.

Code: Select all

Show("customscreen(_("Not Yet Implemented"))")
"customscreen(_(" is considered single string.
Should be something like i guess:

Code: Select all

Show("customscreen",None,_("Not Yet Implemented"))
or

Code: Select all

Show("customscreen",custommessage=_("Not Yet Implemented"))
https://www.renpy.org/doc/html/screen_actions.html#Show

Also if you translating message in screen, you probably shouldn't add _() to show, just provide string. Or other way around.

Re: Custom Screens

Posted: Wed Sep 29, 2021 7:46 pm
by red-NINE
drKlauz wrote: Wed Sep 29, 2021 11:47 am
Should be something like i guess:

Code: Select all

Show("customscreen",None,_("Not Yet Implemented"))
Also if you translating message in screen, you probably shouldn't add _() to show, just provide string. Or other way around.
This did the trick