메인 메뉴 수정하는데 오류가 발생하네요...

도와주세요.. 2015.12.11 22:58 조회 수 : 118544

http://askance.tistory.com/156

이 강좌를 참고해서 메인 메뉴를 수정하는 연습을 하는데 오류가 발생하네요....

오류의 내용은 아래와 같습니다.

 

[code]
I'm sorry, but an uncaught exception occurred.
 
While running game code:
  File "game/screens.rpy", line 181, in execute
    screen main_menu:
  File "game/screens.rpy", line 181, in execute
    screen main_menu:
  File "game/screens.rpy", line 183, in execute
    add 'bg mainmenu' at alpha
  File "game/screens.rpy", line 183, in keywords
    add 'bg mainmenu' at alpha
NameError: name 'alpha' is not defined
 
-- Full Traceback ------------------------------------------------------------
 
Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 29, in script
    $ ui.interact()
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\ast.py", line 805, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\python.py", line 1460, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 29, in <module>
    $ ui.interact()
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\ui.py", line 277, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\display\core.py", line 2354, in interact
    repeat, rv = self.interact_core(preloads=preloads, **kwargs)
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\display\core.py", line 2610, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\display\core.py", line 397, in visit_all
    d.visit_all(callback)
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\display\core.py", line 397, in visit_all
    d.visit_all(callback)
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\display\core.py", line 397, in visit_all
    d.visit_all(callback)
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\display\screen.py", line 386, in visit_all
    callback(self)
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\display\core.py", line 2610, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\display\screen.py", line 396, in per_interact
    self.update()
  File "C:\Users\glados\Downloads\renpy-6.99.3-sdk\renpy\display\screen.py", line 565, in update
    self.screen.function(**self.scope)
  File "game/screens.rpy", line 181, in execute
    screen main_menu:
  File "game/screens.rpy", line 181, in execute
    screen main_menu:
  File "game/screens.rpy", line 183, in execute
    add 'bg mainmenu' at alpha
  File "game/screens.rpy", line 183, in keywords
    add 'bg mainmenu' at alpha
  File "<screen language>", line 183, in <module>
NameError: name 'alpha' is not defined
 
Windows-8-6.2.9200
Ren'Py 6.99.7.858
tech upgrade 0.0
[/code]
들여쓰기는 해결했습니다만 이번에는 알파를 정의할수 없다고 하네요. 뭘 빼먹은걸까요??
 
# 이 파일에는 저작권이 없습니다.
# 원하는 스크린을 만들 수 있도록 마음껏 수정하세요.

##############################################################################
# 대사 화면
#
# ADV모드 대사를 표시할 때 사용하는 스크린.
# http://www.renpy.org/doc/html/screen_special.html#say
screen say:

    # side_image 와 two_window 의 기본값
    default side_image = None
    default two_window = False

    # 창을 1개 사용할지, 2개 사용할지 결정합니다.
    if not two_window:

        # 창을 1개 쓰는 대사창
        window:
            id "window"

            has vbox:
                style "say_vbox"

            if who:
                text who id "who"

            text what id "what"

    else:

        # 이름과 대사, 창을 2개 쓰는 대사창
        vbox:
            style "say_two_window_vbox"

            if who:
                window:
                    style "say_who_window"

                    text who:
                        id "who"

            window:
                id "window"

                has vbox:
                    style "say_vbox"

                text what id "what"

    # 사이드 이미지가 있다면 텍스트 위에 표시한다.
    if side_image:
        add side_image
    else:
        add SideImage() xalign 0.0 yalign 1.0

    # Use the quick menu.
    use quick_menu


##############################################################################
# 선택지 화면
#
# 게임 내 선택지를 표시할 때 사용하는 스크린.
# http://www.renpy.org/doc/html/screen_special.html#choice

screen choice:

    window:
        style "menu_window"
        xalign 0.5
        yalign 0.5

        vbox:
            style "menu"
            spacing 2

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"

init -2:
    $ config.narrator_menu = True

    style menu_window is default

    style menu_choice is button_text:
        clear

    style menu_choice_button is button:
        xminimum int(config.screen_width * 0.75)
        xmaximum int(config.screen_width * 0.75)


##############################################################################
# 텍스트 입력 화면
#
# renpy.input을 나타낼 때 사용하는 스크린.
# http://www.renpy.org/doc/html/screen_special.html#input

screen input:

    window style "input_window":
        has vbox

        text prompt style "input_prompt"
        input id "input" style "input_text"

    use quick_menu

##############################################################################
# 비주얼노벨 대사 화면
#
# NVL모드의 대사와 선택지를 나타낼 때 사용하는 스크린.
# http://www.renpy.org/doc/html/screen_special.html#nvl

screen nvl:

    window:
        style "nvl_window"

        has vbox:
            style "nvl_vbox"

        # 대사를 표시한다.
        for who, what, who_id, what_id, window_id in dialogue:
            window:
                id window_id

                has hbox:
                    spacing 10

                if who is not None:
                    text who id who_id

                text what id what_id

        # 선택지가 있다면 선택지를 나타낸다.
        if items:

            vbox:
                id "menu"

                for caption, action, chosen in items:

                    if action:

                        button:
                            style "nvl_menu_choice_button"
                            action action

                            text caption style "nvl_menu_choice"

                    else:

                        text caption style "nvl_dialogue"

    add SideImage() xalign 0.0 yalign 1.0

    use quick_menu
##############################################################################
#main
init:
    image bg mainmenu:
        "bg_mainmenu.jpg"
    transform fadein:
        on show :
                alpha 0
                linear 1 alpha 1
        on replaced:
            alpha 1
screen main_menu:
    tag menu
    add 'bg mainmenu' at alpha
    frame:
        style_group 'mm'
        background '#fff0'
        add 'title'
        
        textbutton "처음부터" action start() xpos 80 ypos 415
        textbutton "이어서 하기" action ShowMenu("load") xpos 380 ypos 415
        textbutton "test" action OpenURL("http://blog.naver.com/asd54123/") xpos 680 ypos 415
        
        text "체험판" xalign 0.5 ypos 530 color '#686868' size 40 bold True
         
        # 설정 버튼.
        imagebutton idle 'btn_setting_idle.png' hover 'btn_setting_hover.png' action ShowMenu("preferences") xpos 870 ypos 565
        # 종료 버튼
        imagebutton idle 'btn_quit_idle.png' hover 'btn_quit_hover.png' action Quit(confirm=False) xpos 945 ypos 565
 
init -2 python:
    # Make all the main menu buttons be the same size.
    # 메인 메뉴 버튼들의 크기를 모두 같게 합니다.
    style.mm_button.size_group = "mm"
    # 마우스가 올려있을 때 쓸 버튼 배경
    style.mm_button.hover_background = 'button_hover.png'
    # 마우스 안 올려진 버튼에 쓸 배경
    style.mm_button.idle_background = 'button_idle.png'
    # 버튼 안에 적힌 텍스트의 크기 지정
    style.mm_button_text.size = 40
    # 버튼 안의 텍스트 색상 지정
    style.mm_button_text.color = '#686868'
    # 버튼의 최소 크기 지정
    # 밑에 적은 사이즈는 버튼 배경 이미지의 크기와 동일
    style.mm_button.minimum = (291,90)
##############################################################################
# 네비게이션 화면
#
# 게임 메뉴 네비게이션 버튼과 배경 화면을 표시하는 스크린이 포함된 스크린.
# http://www.renpy.org/doc/html/screen_special.html#navigation
screen navigation:

    # 게임 메뉴 배경 화면.
    window:
        style "gm_root"

    # 여러 가지 버튼.
    frame:
        style_group "gm_nav"
        xalign .98
        yalign .98

        has vbox

        textbutton _("Return") action Return()
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Save Game") action ShowMenu("save")
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Main Menu") action MainMenu()
        textbutton _("Help") action Help()
        textbutton _("Quit") action Quit()

init -2:

    # 모든 네비게이션 버튼이 같은 크기가 되도록 한다.
    style gm_nav_button:
        size_group "gm_nav"


##############################################################################
# 저장하기, 불러오기 화면
#
# 게임을 저장하거나 불러올 수 있는 화면.
# http://www.renpy.org/doc/html/screen_special.html#save
# http://www.renpy.org/doc/html/screen_special.html#load

# 저장하기와 불러오기는 기능이 비슷하기 때문에, file_picker라는 스크린 하나에 통합했습니다.
# 그리고 file_picker 스크린을 load 및 save 스크린에 간단히 추가했습니다.

screen file_picker:

    frame:
        style "file_picker_frame"

        has vbox

        # 페이지를 선택할 수 있는 버튼.
        hbox:
            style_group "file_picker_nav"

            textbutton _("Previous"):
                action FilePagePrevious()

            textbutton _("Auto"):
                action FilePage("auto")

            textbutton _("Quick"):
                action FilePage("quick")

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

            textbutton _("Next"):
                action FilePageNext()

        $ columns = 2
        $ rows = 3

        # 파일 슬롯 행렬을 표시한다.
        grid columns rows:
            transpose True
            xfill True
            style_group "file_picker"

            # 1번부터 10번까지의 파일 슬롯 열 개를 표시한다.
            for i in range(1, columns * rows + 1):

                # 각 파일 슬롯은 버튼이다.
                button:
                    action FileAction(i)
                    xfill True

                    has hbox

                    # 스크린샷을 추가한다.
                    add FileScreenshot(i)

                    $ file_name = FileSlotName(i, columns * rows)
                    $ file_time = FileTime(i, empty=_("Empty Slot."))
                    $ save_name = FileSaveName(i)

                    text "[file_name]. [file_time!t]\n[save_name!t]"

                    key "save_delete" action FileDelete(i)


screen save:

    # 다른 메뉴 스크린으로 교체할 수 있도록 태그를 추가한다.
    tag menu

    use navigation
    use file_picker

screen load:

    # 다른 메뉴 스크린으로 교체할 수 있도록 태그를 추가한다.
    tag menu

    use navigation
    use file_picker

init -2:
    style file_picker_frame is menu_frame
    style file_picker_nav_button is small_button
    style file_picker_nav_button_text is small_button_text
    style file_picker_button is large_button
    style file_picker_text is large_button_text


##############################################################################
# 환경설정 화면
#
# 환경설정을 변경할 수 있는 스크린.
# http://www.renpy.org/doc/html/screen_special.html#prefereces

screen preferences:

    tag menu

    # 네비게이션 스크린을 포함한다.
    use navigation

    # 환경설정 메뉴들을 3x1 행렬로 배치한다.
    grid 3 1:
        style_group "prefs"
        xfill True

        # 첫 번째 열.
        vbox:
            frame:
                style_group "pref"
                has vbox

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

            frame:
                style_group "pref"
                has vbox

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

            frame:
                style_group "pref"
                has vbox

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

            frame:
                style_group "pref"
                has vbox

                textbutton _("Joystick...") action Preference("joystick")

        # 두 번째 열
        vbox:
            frame:
                style_group "pref"
                has vbox

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

            frame:
                style_group "pref"
                has vbox

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

            frame:
                style_group "pref"
                has vbox

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

            frame:
                style_group "pref"
                has vbox

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

                if config.has_voice:
                    textbutton _("Wait for Voice") action Preference("wait for voice", "toggle")

        # 세 번째 열
        vbox:
            frame:
                style_group "pref"
                has vbox

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

            frame:
                style_group "pref"
                has vbox

                label _("Sound Volume")
                bar value Preference("sound volume")

                if config.sample_sound:
                    textbutton _("Test"):
                        action Play("sound", config.sample_sound)
                        style "soundtest_button"

            if config.has_voice:
                frame:
                    style_group "pref"
                    has vbox

                    label _("Voice Volume")
                    bar value Preference("voice volume")

                    textbutton _("Voice Sustain") action Preference("voice sustain", "toggle")
                    if config.sample_voice:
                        textbutton _("Test"):
                            action Play("voice", config.sample_voice)
                            style "soundtest_button"

init -2:
    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


##############################################################################
# 예/아니오 확인 화면
#
# 예 또는 아니오를 묻는 스크린.
# http://www.renpy.org/doc/html/screen_special.html#yesno-prompt

screen yesno_prompt:

    modal True

    window:
        style "gm_root"

    frame:
        style_group "yesno"

        xfill True
        xmargin .05
        ypos .1
        yanchor 0
        ypadding .05

        has vbox:
            xalign .5
            yalign .5
            spacing 30

        label _(message):
            xalign 0.5

        hbox:
            xalign 0.5
            spacing 100

            textbutton _("Yes") action yes_action
            textbutton _("No") action no_action

    # 마우스 우클릭과 esc 키는 No 버튼과 같다.
    key "game_menu" action no_action

init -2:
    style yesno_button:
        size_group "yesno"

    style yesno_label_text:
        text_align 0.5
        layout "subtitle"


##############################################################################
# 단축 메누 화면
#
# say 스크린에 기본적으로 포함되어 일부 유용한 기능을
# 빠르게 사용할 수 있는 버튼이 포함된 스크린.
screen quick_menu:

    # 게임 내 단축 메뉴를 추가한다.
    hbox:
        style_group "quick"

        xalign 1.0
        yalign 1.0

        textbutton _("Back") action Rollback()
        textbutton _("Save") action ShowMenu('save')
        textbutton _("Q.Save") action QuickSave()
        textbutton _("Q.Load") action QuickLoad()
        textbutton _("Skip") action Skip()
        textbutton _("F.Skip") action Skip(fast=True, confirm=True)
        textbutton _("Auto") action Preference("auto-forward", "toggle")
        textbutton _("Prefs") action ShowMenu('preferences')

init -2:
    style quick_button:
        is default
        background None
        xpadding 5

    style quick_button_text:
        is default
        size 12
        idle_color "#8888"
        hover_color "#ccc"
        selected_idle_color "#cc08"
        selected_hover_color "#cc0"
        insensitive_color "#4448"

 

댓글 10

파일 첨부

여기에 파일을 끌어 놓거나 파일 첨부 버튼을 클릭하세요.

파일 크기 제한 : 0MB (허용 확장자 : *.*)

0개 첨부 됨 ( / )
 
번호 제목 글쓴이 날짜 조회 수
공지 더이상 질문 게시판에서 질문을 받지 않습니다 백안시 2016.10.01 8564
공지 백안시의 공방 질문 게시판입니다 백안시 2016.09.05 922
공지 스크립트를 알아보기 쉽게 글에 입력하는 방법 백안시 2016.08.26 2060
공지 제목에 질문 내용을 명확하게 적어주세요 백안시 2016.08.26 66646
» 메인 메뉴 수정하는데 오류가 발생하네요... [10] 도와주세요.. 2015.12.11 118544
4561 forget Nyborg bet go after the actual market gdfg 2019.12.07 89675
4560 It was a great game for us dhsh 2019.12.07 88542
4559 A White Tulip 테마를 쓰면 한글이 깨집니다 [1] 백안시 2013.04.18 26001
4558 전역변수를 함수내에서 사용하는 법에대해 질문입니다. [1] 히히후헤 2013.05.29 22448
4557 텍스트 박스 유지와 readback 모듈 [4] SHunter 2013.06.23 22430
4556 중소, 중견, 대기업 가르는 기준 [2] 최봉린 2021.07.21 18015
4555 아... 안되겠습니다. [525] 익명 2015.09.29 13783
4554 축구 베팅 방법이 실제로 돈을 버는 데 도움이 될 수 있습니까?  차무식 2023.04.17 9611
4553 신선한 셔츠 내 육상 베팅에 의한 특정 수익 증가 노루 2023.04.20 4525
4552 루비 텍스트 및 대사창 여백 등 질문합니다 [2] zez 2013.07.28 4513
4551 박태준 작가 웹툰 제목을 '인생존망' 으로 지은 이유.jpg 배주환 2021.09.07 3567
4550 New Jerseys Wholesale - Start Your Successful Business baidai66 baidai66 2017.12.08 3397
4549 배포판을 만들고 실행하면 archive.rpa 파일을 읽질 못합니다 [4] wtfman 2013.08.21 3005
4548 산업용 지붕 유지 지동원 2023.04.18 2888
4547 스포츠 도박 삼성 챔피언 검토 노루 2023.04.20 2545
4546 렌파이 업데이트 도중 오류가 발생합니다. [3] waynes 2013.04.30 2453
4545 한국어화 하니까 에러가 발생합니다. [1] 백안시 2013.04.18 2279