Skip Language selection in Splashscreen

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
pridedrawing
Newbie
Posts: 5
Joined: Sun Feb 28, 2021 8:16 am
Projects: Bound to College
itch: pridedrawing
Contact:

Skip Language selection in Splashscreen

#1 Post by pridedrawing »

I made a splashscreen with imagebuttons to select the language.
Now I would like to have this screen only to appear once, when no language has been selected yet, instead of every start of the game.
How can I do this?

Code: Select all

label splashscreen:
    scene language_main with dissolve

    show screen lang_usa
    show screen lang_es
    show screen lang_ger
    show screen lang_rus

    pause
The image buttons:

Code: Select all

screen lang_usa:
    imagebutton:
        xalign 0.65
        idle "language_USA.png"
        hover "language_USA_hover.png"
        action [
        SetField(persistent, "_language", None),
        Language(None), Jump("lang_set")]

screen lang_es:
    imagebutton:
        xalign 0.3
        idle "language_ES.png"
        hover "language_ES_hover.png"
        action [
        SetField(persistent, "_language", "spain"),
        Language("spain"), Jump("lang_set")]

screen lang_ger:
    imagebutton:
        xalign 0.95
        idle "language_GER.png"
        hover "language_GER_hover.png"
        action [
        SetField(persistent, "_language", "deutsch"),
        Language("deutsch"), Jump("lang_set")]

screen lang_rus:
    imagebutton:
        xalign 0.01
        idle "language_RUS.png"
        hover "language_RUS_hover.png"
        action [
        SetField(persistent, "_language", "russian"),
        Language("russian"), Jump("lang_set")]
Transistion to main menu:

Code: Select all

label lang_set:

        hide screen lang_usa
        hide screen lang_es
        hide screen lang_ger
        hide screen lang_rus

        return

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Skip Language selection in Splashscreen

#2 Post by hell_oh_world »

what is this action for though `SetField(persistent, "_language", "russian")`?
also, why do you have them on separate screens? you can just make one screen and put all of them in there.
Use hbox, vbox to align them horizontally or vertically.
Sample implementation:

Code: Select all

default persistent.language_selector_shown = False

screen language_selector():
  vbox:
    textbutton "English":
      action [Language(None), Return()]
    textbutton "Russian":
      action [Language("russian"), Return()]

label splashscreen:
  if not persistent.language_selector_shown:
    call screen language_selector
    $ persistent.language_selector_shown = True

  return
Side Note: There's no concept of "No language has been selected" like what you're thinking. By default, there's always one, which is the default language that you used in developing the game which is `None` so that's why by default the game's language is always set to `None`.

User avatar
pridedrawing
Newbie
Posts: 5
Joined: Sun Feb 28, 2021 8:16 am
Projects: Bound to College
itch: pridedrawing
Contact:

Re: Skip Language selection in Splashscreen

#3 Post by pridedrawing »

Thank you for your reply.
I do not want to use a textbutton though. I have a background-image and imagebuttons in front of it:
Image
Oh, and in case you think, I am a total noob: You are right. I am still at the very beginning to understand this and have no experiences at all with programming. So I cannot even answer you initial question other than: I found it in the language tutorial and it works...

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: Skip Language selection in Splashscreen

#4 Post by hell_oh_world »

It's a sample implementation, after all, it doesn't suppose to reflect a direct answer to the question using your example. But its very much the same.
You'll just have to replace these textbuttons with your imagebuttons, and use the actions I used in this example in your imagebuttons' actions.

User avatar
Andredron
Miko-Class Veteran
Posts: 731
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Skip Language selection in Splashscreen

#5 Post by Andredron »

Code: Select all


label splashscreen:
    $ if not persistent.one: ### Condition for 1 question to appear
        scene black
            menu:
                "One-off question?"
                    " yes":
                        $ persistent.one = True #####Constant variable for 1 time, so as not to get out with questions
                        show screen main_menu
                    "No":
                        $ renpy.quit()
    return

label start:
    hide screen main_menu
I edit the example in my own way and you're done. And so people write to you that it is not humanly the choice of languages is a bunch of screens, see the training in the renpy launcher, the settings code, how the choice of language is made there, upgrade it and after% write down the choice of the machine for the language of the picture

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot]