특수 스크린 이름

Ren'Py에는 두 종류의 특수 스크린 이름이 있습니다. 첫 번째는 Ren'Py 스크립트 명령이나 그에 대응하는 프로그래밍 함수를 실행하면 자동으로 표시되는 스크린입니다. 두 번째는 메뉴 스크린입니다. 통상적인 기능에 통상적인 이름을 사용하지만, 필요에 따라 스크린을 생략하거나 변경할 수 있습니다.

이 페이지에서는 스크린 예제를 소개합니다. 일부 스크린에는 최소한의 기능이 반드시 필요하지만, 스크린 시스템으로 추가 기능을 넣을 수 있다는 점을 알아 두세요. 예를 들어 표준 say 스크린은 텍스트만 표시하지만, 건너뛰기, 자동 진행 모드, 음소거 등을 쉽게 추가할 수 있습니다.

일부 특수 스크린은 매개변수를 받습니다. 스크린의 스코프에서 변수로 접근할 수 있습니다.

일부 스크린에는 특수 ID도 연결됩니다. 특수 ID는 지정된 종류의 디스플레이어블에 부여해야 합니다. 그러면 해당 디스플레이어블에 속성이 적용되거나, 스크린을 표시하는 Ren'Py 내부 기능에서 디스플레이어블에 접근할 수 있습니다.

참고

이 페이지의 스크린 예제는 새 게임에 포함된 스크린과 다를 수 있습니다.

게임 내 스크린

이 스크린들은 특정 Ren'Py 문을 실행하면 자동으로 표시됩니다.

Say

say 스크린은 ADV 모드 대사를 표시할 때 say 문이 호출합니다. 다음 매개변수를 받습니다.

who

말하는 캐릭터의 이름 텍스트입니다.

what

캐릭터가 말하는 대사입니다.

다음 ID의 디스플레이어블을 선언해야 합니다.

"who"

말하는 캐릭터의 이름을 표시하는 텍스트 디스플레이어블입니다. 캐릭터 객체에 인수를 지정해 이 디스플레이어블의 스타일을 설정할 수 있습니다.

"what"

캐릭터의 대사를 표시하는 텍스트 디스플레이어블입니다. 캐릭터 객체에 인수를 지정해 스타일을 설정할 수 있습니다. Ren'Py가 자동 진행 시간, 클릭하여 진행 등을 계산하는 데 사용하므로 이 ID의 디스플레이어블을 반드시 정의해야 합니다.

"window"

창 또는 프레임입니다. 일반적으로 who와 what 텍스트를 담습니다. 캐릭터 객체에 인수를 지정해 이 디스플레이어블의 스타일을 설정할 수 있습니다.

screen say(who, what):

    window id "window":
        has vbox

        if who:
            text who id "who"

        text what id "what"

Choice

choice 스크린은 menu 문으로 만든 게임 내 선택지를 표시합니다. 다음 매개변수를 받습니다.

items

메뉴의 각 선택지를 나타내는 메뉴 항목 객체 리스트입니다. 각 객체에는 다음 필드가 있습니다.

caption

메뉴 선택지의 문구 문자열입니다.

action

해당 선택지를 골랐을 때 실행할 액션입니다. 메뉴 제목이고 config.narrator_menu가 False이면 None일 수 있습니다.

chosen

게임의 어느 플레이에서든 이 선택지를 한 번 이상 골랐다면 True입니다.

args

메뉴 선택지에 전달된 위치 인수를 담은 튜플입니다.

kwargs

메뉴 선택지에 전달된 키워드 인수를 담은 딕셔너리입니다.

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

input 스크린은 renpy.input()을 표시합니다. 매개변수 하나를 받습니다.

prompt

renpy.input에 전달한 안내 텍스트입니다.

다음 ID의 디스플레이어블을 선언해야 합니다.

"input"

반드시 존재해야 하는 입력 디스플레이어블입니다. renpy.input에 지정한 모든 매개변수가 이 디스플레이어블에 전달되므로 반드시 필요합니다.

screen input(prompt):

    window:
        has vbox

        text prompt
        input id "input"

NVL

nvl 스크린은 NVL 모드 대사를 표시합니다. 다음 매개변수를 받습니다.

dialogue

표시할 각 대사 줄에 대응하는 NVL Entry 객체의 리스트입니다. 각 항목에는 다음 필드가 있습니다.

current

현재 대사 줄이면 True입니다. 현재 대사의 what 텍스트는 반드시 "what" ID로 표시해야 합니다.

who

말하는 캐릭터의 이름이며, 이름이 없으면 None입니다.

what

말하는 텍스트입니다.

who_id, what_id, window_id

항목에 연결된 화자, 대사, 창에 권장하는 ID입니다.

who_args, what_args, window_args

화자, 대사, 창에 연결된 속성입니다. 위와 같이 ID를 설정하면 자동 적용되지만, 별도로도 제공됩니다.

multiple

여러 캐릭터의 대사이면 두 요소 튜플입니다. 첫 번째는 1부터 시작하는 대사 블록 번호이며, 두 번째는 multiple 문의 전체 대사 블록 수입니다.

items

choice 스크린에 전달하는 것과 같은 항목 리스트입니다. 비어 있으면 메뉴를 표시하지 않아야 합니다.

items가 없으면 NVL 스크린은 항상 텍스트 위젯 하나에 "what" ID를 부여해야 합니다. Ren'Py는 이를 자동 진행 시간, 클릭하여 진행 등을 계산하는 데 사용합니다. 기본 what_id를 사용하면 이 조건을 자동으로 충족합니다.

Ren'Py는 nvl_choice 스크린도 지원합니다. nvl과 같은 매개변수를 받으며, 게임 내 선택지를 표시할 때 존재한다면 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

notify 스크린은 renpy.notify()가 사용자에게 알림을 표시할 때 사용합니다. 일반적으로 트랜스폼과 함께 사용해 알림 작업 전체를 처리합니다. 매개변수 하나를 받습니다.

message

표시할 메시지입니다.

notify 스크린의 예는 다음과 같습니다.

screen notify(message):
    zorder 100

    text "[message!tq]" 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 스크린이 있으면 건너뛰기 중에 표시하고 끝나면 숨깁니다. 매개변수는 받지 않습니다.

아주 간단한 건너뛰기 표시 스크린은 다음과 같습니다.

screen skip_indicator():

    zorder 100

    text _("건너뛰는 중")

CTC(클릭하여 진행)

ctc 스크린이 있으면 대사 표시가 끝났을 때 표시하여, 클릭하면 다음 텍스트가 나온다는 것을 플레이어에게 알립니다. 매개변수 하나와 여러 키워드 인수를 받을 수 있습니다.

arg

Character()가 선택한 CTC 디스플레이어블입니다. 상황에 따라 Character의 ctc, ctc_pause, ctc_timedpause 중 하나입니다. Character에 CTC를 지정하지 않았다면 이 인수는 아예 전달되지 않습니다.

이 밖에도 스크린이 요구할 때만 전달되는 매개변수가 몇 가지 있습니다.

ctc_kind

표시할 CTC의 종류입니다. 줄의 마지막 CTC를 뜻하는 "last", "pause", "timedpause" 중 하나입니다.

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 _("클릭하면 계속 진행합니다"):
            size 12

게임 밖 메뉴 스크린

다음은 메뉴 스크린입니다. main_menu와 yesno_prompt는 암시적으로 호출됩니다. 사용자가 게임 메뉴를 열면 _game_menu_screen에 지정한 스크린을 표시합니다. 기본값은 save입니다.

메뉴 스크린은 상당히 자유롭게 조합하고 수정할 수 있습니다.

저장

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 _("이전") action FilePagePrevious()
            textbutton _("자동 진행") action FilePage("auto")

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

            textbutton _("다음") 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=_("빈 슬롯."))
                           + "\n"
                           + FileSaveName(i)) style "large_button_text"

불러오기

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 _("이전") action FilePagePrevious()
            textbutton _("자동 진행") action FilePage("auto")

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

            textbutton _("다음") 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=_("빈 슬롯."))
                           + "\n"
                           + FileSaveName(i)) style "large_button_text"

환경설정

preferences 스크린은 게임 표시를 제어하는 옵션을 선택하는 데 사용합니다.

일반적으로 환경설정은 Preference()가 반환하는 액션 또는 바 값입니다.

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 _("화면")
                textbutton _("창 모드") action Preference("display", "window")
                textbutton _("전체 화면") action Preference("display", "fullscreen")

            frame:
                style_prefix "pref"
                has vbox

                label _("화면 전환")
                textbutton _("모두") action Preference("transitions", "all")
                textbutton _("없음") action Preference("transitions", "none")

            frame:
                style_prefix "pref"
                has vbox

                label _("대사 표시 속도")
                bar value Preference("text speed")

            frame:
                style_prefix "pref"
                has vbox

                textbutton _("조이스틱...") action ShowMenu("joystick_preferences")

        vbox:

            frame:
                style_prefix "pref"
                has vbox

                label _("건너뛰기")
                textbutton _("읽은 대사") action Preference("skip", "seen")
                textbutton _("모든 대사") action Preference("skip", "all")

            frame:
                style_prefix "pref"
                has vbox

                textbutton _("건너뛰기 시작") action Skip()

            frame:
                style_prefix "pref"
                has vbox

                label _("선택지 이후")
                textbutton _("건너뛰기 중지") action Preference("after choices", "stop")
                textbutton _("계속 건너뛰기") action Preference("after choices", "skip")

            frame:
                style_prefix "pref"
                has vbox

                label _("자동 진행 대기 시간")
                bar value Preference("auto-forward time")

        vbox:

            frame:
                style_prefix "pref"
                has vbox

                label _("음악 음량")
                bar value Preference("music volume")

            frame:
                style_prefix "pref"
                has vbox

                label _("효과음 음량")
                bar value Preference("sound volume")
                textbutton "테스트" action Play("sound", "sound_test.ogg") style "soundtest_button"

            frame:
                style_prefix "pref"
                has vbox

                label _("음성 음량")
                bar value Preference("voice volume")
                textbutton "테스트" 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 스크린은 사용자에게 예/아니요 선택을 요청합니다. 다음 매개변수를 받습니다.

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 unseen dialogue to the next choice?"

  • UNKNOWN_TOKEN - 이 저장 파일은 다른 기기에서 만들어졌습니다. 악의적으로 조작된 저장 파일은 컴퓨터에 피해를 줄 수 있습니다. 이 저장 파일의 제작자와 파일을 변경했을 수 있는 모든 사람을 신뢰하나요?

  • TRUST_TOKEN - 저장 파일이 만들어진 기기를 신뢰하나요? 그 기기를 혼자 사용하는 경우에만 예를 선택해야 합니다.

변수의 값은 문자열이므로 텍스트 디스플레이어블로 표시할 수 있습니다.

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 _("예") action yes_action
                textbutton _("아니요") action no_action