[Solved]Custom Screens

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
red-NINE
Newbie
Posts: 13
Joined: Thu Jun 24, 2021 12:54 am
Contact:

[Solved]Custom Screens

#1 Post 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
Last edited by red-NINE on Wed Sep 29, 2021 7:45 pm, edited 1 time in total.

drKlauz
Veteran
Posts: 239
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Custom Screens

#2 Post 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.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

red-NINE
Newbie
Posts: 13
Joined: Thu Jun 24, 2021 12:54 am
Contact:

Re: Custom Screens

#3 Post 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

Post Reply

Who is online

Users browsing this forum: Bing [Bot]