特別な名前のスクリーン link

Ren'Py には2種類の特別な名前のスクリーンがあります。1つ目は Ren'Py のスクリプト言語のコマンド ( またはプログラム的に相当するもの ) が実行されると自動的に表示されるスクリーンです。もう一つは menu スクリーンで、これらは一般的な機能に対応する一般的な名前を持ちますが、必要に応じて、スクリーンを省略したり変更したり出来ます。

このページではスクリーンの例を示します。いくつかのスクリーンには必要最低限の機能を持たせなければならない一方で、スクリーンシステムは追加の機能をスクリーンに加えられると理解することが重要です。例えば、基本的な say スクリーンはテキストを表示するだけですが、スクリーンシステムは簡単にスキップや自動進行、ミュートのような機能を追加出来るようにします。

いくつかの特別なスクリーンはパラメーターを受け取ります。これらのパラメーターはそのスクリーンのスコープで変数としてアクセス可能です。

スクリーンのいくつかはそれらに関連づけられた特別な ID も持っています。特別な ID は特定の種類の displayable に代入されるはずです。それによりプロパティーがその displayable に代入されたり、その displayable をそのスクリーンを表示する Ren'Py の部分にアクセスできるようにしたりします。

ゲーム内のスクリーン link

これらのスクリーンは特定の Ren'Py ステートメントを実行すると自動的に表示されます。

Say link

ADV モードの台詞を表示するときに say スクリーンは say ステートメントによって以下のパラメーターを伴って呼び出されます。 :

who

話しているキャラクターの名前

what

話し手による台詞

以下の ID を伴う displayable の宣言が期待されます。 :

"who"

テキスト displayable で、話し手の名前を表示します。 character オブジェクトにはこの displayable の体裁を整える引数を与えられます。

"what"

テキスト displayable で、話し手に話されている台詞を表示します。 character オブジェクトにはこの displayable の体裁を整える引数を与えられます。Ren'Py が自動進行の時間やクリック待ちマーク等を計算するために使用するので、 この ID を持つ displayable は定義される必要があります

"window"

ウィンドウまたはフレームです。これは慣例として、 who と what のテキストを含みます。 character オブジェクトにはこの displayable の体裁を整える引数を与えられます。

screen say(who, what):

    window id "window":
        has vbox

        if who:
            text who id "who"

        text what id "what"

Choice link

choice スクリーンは menu ステートメントによって作成されるゲーム内選択肢を表示するために使用され、以下のパラメーターを受け取ります。 :

items

これはメニューに入力するオブジェクトのリストで、選択画面の各選択肢を表します。各オブジェクトは以下のフィールドをもちます。 :

caption link

選択肢の見出しとなる文字列です。

action link

その選択肢が選択されると実行されるアクションです。これが menu のキャプションで config.narrator_menu が Falseなら None です。

chosen link

そのゲームのプレイ中に少なくとも一度選択された選択肢ならば True です。

args link

これは menu choice へ渡される引数を含むタプルです。

kwargs link

menu choice へ渡されるキーワード引数を含む辞書です。

これらの要素と内部のアクションは menu ステートメント終了で無効になります。

加えて menu ステートメントへ渡される引数はスクリーンへの呼び出し中に渡されます。

screen choice(items):

    window:
        style "menu_window"

        vbox:
            style "menu"

            for i in items:

                if i.action:

                    button:
                        action i.action
                        style "menu_choice_button"

                        text i.caption style "menu_choice"

                else:
                    text i.caption style "menu_caption"

Input link

input スクリーンは renpy.input() を表示するために使用され、パラメーターを一つ受け取ります。 :

prompt

renpy.input に提供されるプロンプトテキストです。

以下の ID を伴う displayable の宣言が期待されます。 :

"input"

input displayable で、存在する必要があります。これには renpy.input に提供されるすべてのパラメーターが与えられるので存在する必要があります。

screen input(prompt):

    window:
        has vbox

        text prompt
        input id "input"

NVL link

nvl スクリーンは NVL モード で使用され、以下のパラメーターを受け取ります。 :

dialogue

NVL スクリーンで入力するオブジェクトのリストで、表示される台詞の一行一行にそれぞれ対応します。各要素は以下のフィールドを持ちます :

current link

これが台詞の現在の行なら True です。台詞の現在の行には "what" の id を持つ表示されるテキストがなければなりません。

who link

話しているキャラクターの名前かそのような名前がなければ None です。

what link

話されるテキストです.

who_id, what_id, window_id

入力に対する話者、台詞、ウィンドウに対する優先される id です。

who_args, what_args, window_args

話者、台詞、ウィンドウに関するプロパティーです。その id が上述のように設定されていれば、これらに自動的に適用されますが、独立的にも利用可能です。

multiple link

複数キャラクターダイアログ なら、これは2つの要素のタプルとなります。1つ目は台詞ブロック番号に基づくもので、2つ目は複数ステートメント合計の台詞ブロック数です。

items

これは choice screen に渡されるものと同じ item のリストです。これが空なら、選択肢は表示されません。

items が存在しないと、 NVL スクリーンは "what" id のテキストウィジェットを常に渡すでしょう。Ren'Py はそれを使用してオートモードの時間や click-to-continue, その他を計算します(デフォルトの what_id が使用されていれば、これは十分自動的です)。

Ren'Py は nvl と同じパラメーターを受け取る nvl_choice スクリーンもサポートしており、もし存在するとゲーム内選択肢がユーザーに表示されるときは nvl に優先して使用されます。

screen nvl(dialogue, items=None):

    window:
        style "nvl_window"

        has vbox:
            style "nvl_vbox"

        # Display dialogue.
        for d in dialogue:
            window:
                id d.window_id

                has hbox:
                    spacing 10

                if d.who is not None:
                    text d.who id d.who_id

                text d.what id d.what_id

        # Display a menu, if given.
        if items:

            vbox:
                id "menu"

                for i in items:

                    if action:

                        button:
                            style "nvl_menu_choice_button"
                            action i.action

                            text i.caption style "nvl_menu_choice"

                    else:

                        text i.caption style "nvl_dialogue"

Notify link

notify スクリーンは renpy.notify() によってユーザーに通知する displayable を表示するために使用されます。通常は通知のタスクのすべてを処理するために transform と連携して使用されます。パラメーターを一つ与えられます。

message

表示されるメッセージ

デフォルトの notify スクリーンとその関連づけられた transform :

screen notify(message):
    zorder 100

    text message at _notify_transform

    # This controls how long it takes between when the screen is
    # first shown, and when it begins hiding.
    timer 3.25 action Hide('notify')

transform _notify_transform:
    # These control the position.
    xalign .02 yalign .015

    # These control the actions on show and hide.
    on show:
        alpha 0
        linear .25 alpha 1.0
    on hide:
        linear .5 alpha 0.0

Skip Indicator link

存在すれば、スキップ処理中に skip_indicator スクリーンが表示され、スキップ停止で非表示されます。引数は受け取りません。

とても単純なスキップインディケーターです。

screen skip_indicator():

    zorder 100

    text _("Skipping")

CTC (Click-To-Continue) link

存在すれば、台詞の表示が完了すると ctc スクリーンが表示され、プレイヤーにクリックして次のテキストを表示するよう促します。一つのパラメーターまたは複数のキーワード引数が指定されるでしょう。

arg

ctc displayable は Character() により選択されます。これは Character への ctc, ctc_pause, ctc_timepause 引数のいずれかから適切なものが選ばれます。 CTC が Character に指定されなければこの引数は全く渡されません。

加えて screen が要求したときのみ渡されるパラメーターがあります。

ctc_kind

表示する CTC の種類です。 "last" ( 行端の CTC ) または "pause", "timedpause" の1つです。

ctc_last

Character() への ctc 引数です。

ctc_pause

Character() への ctc_pause 引数です。

ctc_timedpause

Character() ctc_timedpause 引数です。

とても単純な ctc スクリーンです。

screen ctc(arg=None):

    zorder 100

    hbox:
        xalign 0.98
        yalign 0.98

        add arg

        text _("Click to Continue"):
            size 12

ゲーム外のMenu Screen link

これらは menu スクリーンです。 main_menuyesno_prompt は無条件に使用されます。ユーザーが game menu を使用すると、 _game_menu_screen で名付けられたスクリーンが表示されます ( デフォルトでは save です )。

menu スクリーンは、かなり自由に統合・修正できることを覚えておいてください。

Save link

save スクリーンはゲームをセーブするファイルを選択するために使用されます。

screen save():

    # This ensures that any other menu screen is replaced.
    tag menu

    use navigation

    frame:
        has vbox

        # The buttons at the top allow the user to pick a
        # page of files.
        hbox:
            textbutton _("Previous") action FilePagePrevious()
            textbutton _("Auto") action FilePage("auto")

            for i in range(1, 9):
                textbutton str(i) action FilePage(i)

            textbutton _("Next") action FilePageNext()

        # Display a grid of file slots.
        grid 2 5:
            transpose True
            xfill True

            # Display ten file slots, numbered 1 - 10.
            for i in range(1, 11):

                # Each file slot is a button.
                button:
                    action FileAction(i)
                    xfill True
                    style "large_button"

                    has hbox

                    # Add the screenshot and the description to the
                    # button.
                    add FileScreenshot(i)
                    text ( " %2d. " % i
                           + FileTime(i, empty=_("Empty Slot."))
                           + "\n"
                           + FileSaveName(i)) style "large_button_text"

Load link

load スクリーンはゲームをロードするファイルを選択するために使用されます。

screen load():

    # This ensures that any other menu screen is replaced.
    tag menu

    use navigation

    frame:
        has vbox

        # The buttons at the top allow the user to pick a
        # page of files.
        hbox:
            textbutton _("Previous") action FilePagePrevious()
            textbutton _("Auto") action FilePage("auto")

            for i in range(1, 9):
                textbutton str(i) action FilePage(i)

            textbutton _("Next") action FilePageNext()

        # Display a grid of file slots.
        grid 2 5:
            transpose True
            xfill True

            # Display ten file slots, numbered 1 - 10.
            for i in range(1, 11):

                # Each file slot is a button.
                button:
                    action FileAction(i)
                    xfill True
                    style "large_button"

                    has hbox

                    # Add the screenshot and the description to the
                    # button.
                    add FileScreenshot(i)
                    text ( " %2d. " % i
                           + FileTime(i, empty=_("Empty Slot."))
                           + "\n"
                           + FileSaveName(i)) style "large_button_text"

Preferences link

preferences スクリーンはゲームの表示を制御するオプションを選択するために使用されます。

一般的に、設定は Preference() から返されるアクションか bar value です。

screen preferences():

    tag menu

    # Include the navigation.
    use navigation

    # Put the navigation columns in a three-wide grid.
    grid 3 1:
        style_prefix "prefs"
        xfill True

        # The left column.
        vbox:
            frame:
                style_prefix "pref"
                has vbox

                label _("Display")
                textbutton _("Window") action Preference("display", "window")
                textbutton _("Fullscreen") action Preference("display", "fullscreen")

            frame:
                style_prefix "pref"
                has vbox

                label _("Transitions")
                textbutton _("All") action Preference("transitions", "all")
                textbutton _("None") action Preference("transitions", "none")

            frame:
                style_prefix "pref"
                has vbox

                label _("Text Speed")
                bar value Preference("text speed")

            frame:
                style_prefix "pref"
                has vbox

                textbutton _("Joystick...") action ShowMenu("joystick_preferences")

        vbox:

            frame:
                style_prefix "pref"
                has vbox

                label _("Skip")
                textbutton _("Seen Messages") action Preference("skip", "seen")
                textbutton _("All Messages") action Preference("skip", "all")

            frame:
                style_prefix "pref"
                has vbox

                textbutton _("Begin Skipping") action Skip()

            frame:
                style_prefix "pref"
                has vbox

                label _("After Choices")
                textbutton _("Stop Skipping") action Preference("after choices", "stop")
                textbutton _("Keep Skipping") action Preference("after choices", "skip")

            frame:
                style_prefix "pref"
                has vbox

                label _("Auto-Forward Time")
                bar value Preference("auto-forward time")

        vbox:

            frame:
                style_prefix "pref"
                has vbox

                label _("Music Volume")
                bar value Preference("music volume")

            frame:
                style_prefix "pref"
                has vbox

                label _("Sound Volume")
                bar value Preference("sound volume")
                textbutton "Test" action Play("sound", "sound_test.ogg") style "soundtest_button"

            frame:
                style_prefix "pref"
                has vbox

                label _("Voice Volume")
                bar value Preference("voice volume")
                textbutton "Test" action Play("voice", "voice_test.ogg") style "soundtest_button"

style pref_frame:
    xfill True
    xmargin 5
    top_margin 5

style pref_vbox:
    xfill True

style pref_button:
    size_group "pref"
    xalign 1.0

style pref_slider:
    xmaximum 192
    xalign 1.0

style soundtest_button:
    xalign 1.0

Confirm link

confirm は yes/no の選択肢をユーザーに尋ねるため使用され、以下のパラメーターを受け取ります。 :

message

ユーザーに表示するメッセージです。少なくとも次のメッセージが Ren'Py で使用されます :

  • gui.ARE_YOU_SURE - "Are you sure?" これはメッセージが未知のときのデフォルトです。

  • gui.DELETE_SAVE - "Are you sure you want to delete this save?"

  • gui.OVERWRITE_SAVE - "Are you sure you want to overwrite your save?"

  • gui.LOADING - "Loading will lose unsaved progress.nAre you sure you want to do this?"

  • gui.QUIT - "Are you sure you want to quit?"

  • gui.MAIN_MENU - "Are you sure you want to return to the mainnmenu? This will lose unsaved progress."

  • gui.CONTINUE - "Are you sure you want to continue where you left off?"

  • gui.END_REPLAY - "Are you sure you want to end the replay?"

  • gui.SLOW_SKIP = "Are you sure you want to begin skipping?"

  • gui.FAST_SKIP_SEEN = "Are you sure you want to skip to the next choice?"

  • gui.FAST_SKIP_UNSEEN = "Are you sure you want to skip to unseen dialogue to the next choice?"

  • UNKNOWN_TOKEN - This save was created on a different device. Maliciously constructed save files can harm your computer. Do you trust this save's creator and everyone who could have changed the file?

  • TRUST_TOKEN - Do you trust the device the save was created on? You should only choose yes if you are the device's sole user.

変数の値は文字列で、テキスト displayable を使用して表示出来ます。

yes_action

ユーザーが「 Yes 」を選択すると実行されるアクション

no_action

ユーザーが「 No 」を選択すると実行されるアクション

Ren'Py 6.99.10 までこのスクリーンは yesno_prompt スクリーンと呼ばれていました。 confirm スクリーンがなければ、 yesno_prompt が代わりに使用されます。

このスクリーンは renpy.confirm()Confirm() アクションからも呼び出されます。

screen confirm(message, yes_action, no_action):

    modal True

    window:
        style "gm_root"

    frame:
        style_prefix "confirm"

        xfill True
        xmargin 50
        ypadding 25
        yalign .25

        vbox:
            xfill True
            spacing 25

            text _(message):
                textalign 0.5
                xalign 0.5

            hbox:
                spacing 100
                xalign .5
                textbutton _("Yes") action yes_action
                textbutton _("No") action no_action