2013.04.18 19:36
2013.04.18 19:38
코드 자체를 올려서 정확히 질문하는게 원하는 답을 확실히 얻을 것 같아 올립니다. 일단, 제가 말한 '이미 만들어 놓은 비슷한 것'은 아래 내용이고요,
init python: def saveid(x): global id id = x def savepw(x): global pw pw = x id = pw = ' ' #screen label login: python: ui.image ("smallworld.jpg") ui.text ("ID:" , xalign=0) ui.text ("Password:", yalign=.05) a = ui.button (xalign=.05, clicked = ui.returns(None)) id = ui.input (length=15, button = a, changed = saveid) b = ui.button (xalign=.15, yalign=.05, clicked = ui.returns(None)) pw = ui.input (length=15, button = b, changed = savepw) ui.textbutton ("Log in", ui.returns(True), xalign=.05, yalign=.1) ui.textbutton ("Help", clicked= ui.jumps ("help"), xalign=.05, yalign=.16) ui.textbutton ("Join", clicked=ui. jumps ("join"), xalign=.05, yalign=.22) ui.text ("{size=50}Smallworld.com{/size}", xalign=.5, yalign=.48) ui.textbutton ("About", clicked=ui.jumps ("about"), xalign=.48, yalign=.7) ui.interact() if id ==ID and pw ==password: jump smallworld else: "ID and password didn't match." jump login
일단 이건 만들어놓은 것들 중 일부를 가져온 것이라 여기에 나와 있진 않지만, 이 라벨로 오기전에 다른 진행 내용들이 있고, 그 진행 중에 ID와 password를 입력받은 상태입니다.(아이디와 패스워드를 정함.)
그리고 제가 해본 결과 저기에 쓰여진 대로 되었습니다.
제가 '만들려고 했던 것'은, 이 것도 일단 일부만 가져오면(이게 어떤 스크린 안에서의 내용인데 끝부분을
가져온거라 screen:표시가 나와있지 않은겁니다.)
text "{size=20}Search for the others{/size}" xalign.48 yalign.7 text "{size=20}(ID+Introduction){/size}" xalign.48 yalign.75 $ a =ui.button(clicked = ui.returns(None), xalign=.48 , yalign= .83) $ word=ui.input (length=15, button = a) textbutton "{size=23}Search{/size}" action Return(True) xalign.48 yalign.9 if word == search: $ ui.jumps ("resultt")
2013.04.18 19:38
백안시 2012/06/16
위에건 레이블 블록에 써있어서 if문이 다이렉트로 작동하는 거고 밑에 건 스크린 블록에 써있어서 명령문으로 스크린을 호출 했을 때의 상태에 따라 if문이 작동하는 방식이라서 그렇습니다. 밑에것도 레이블문으로 고치시면 원하시는대로 작동할 거 같네요.
그리고 call screen 명령어로 스크린 블록을 띄웠을 때 스크린에서 반환한 값은 _return 변수에 저장됩니다 써먹으시려면 그 변수를 통해서 써먹으시는 쪽이 ...
아 , 아니면 search 버튼을 눌렀을 떄 실행할 액션이 리턴이 아니라 Show() 액션이라면 원하시는대로 될 수도 있겠네요 그러면 밑에 if 문은 필요 없을테고요.
2013.04.18 19:39
..라벨로 바꿔봤는데도 안되더군요. 뭔가 달라진 점이 있다면 search버튼을 처음 누를 땐 아무 일도 안일어나다가 두 번째 누를 때 또 의도치 않은 스크린으로 넘어간다는 것. 뭔가 전체적으로 꼬인 것 같은데..일단 이걸로도 길지만 원래의 스크립트에서 대사라던가 그냥 텍스트라던가 하여튼 위의 상황을 일으킬만한 것과 관계 없어 보이는 건 지웠습니다. 한 번 봐주시겠습니까?
#variable init: $ lv =1 $ search = 1 #python init python: def saveid(x): global id id = x def savepw(x): global pw pw = x id = pw = ' ' #screen label login: python: ui.image ("smallworld.jpg") ui.text ("ID:" , xalign=0) ui.text ("Password:", yalign=.05) a = ui.button (xalign=.05, clicked = ui.returns(None)) id = ui.input (length=15, button = a, changed = saveid) b = ui.button (xalign=.15, yalign=.05, clicked = ui.returns(None)) pw = ui.input (length=15, button = b, changed = savepw) ui.textbutton ("Log in", ui.returns(True), xalign=.05, yalign=.1) ui.textbutton ("Help", clicked= ui.jumps ("help"), xalign=.05, yalign=.16) ui.textbutton ("Join", clicked=ui. jumps ("join"), xalign=.05, yalign=.22) ui.text ("{size=50}Smallworld.com{/size}", xalign=.5, yalign=.48) ui.textbutton ("About", clicked=ui.jumps ("about"), xalign=.48, yalign=.7) ui.interact() if id ==ID and pw ==password: jump smallworld else: "ID and password didn't match." jump login screen help: image "smallworld.jpg" textbutton "Yes" xalign.35 yalign.5 clicked ui.jumps ("email") textbutton "Return" xalign.6 yalign.5 clicked ui.jumps ("login") screen about: image "smallworld.jpg" textbutton "Return" action Jump ("login") xalign.45 yalign.8 screen smallworldf: textbutton "{size=50}Smallworld{/size}" action Return(None) xalign.45 text ("%s" %ID) text ("%s" %lv) xalign.09 yalign.05 imagebutton idle "home.png" hover "home.png" yalign.1 xalign.1 textbutton "Posting board" xalign.15 yalign.25 action Return(None) textbutton "Official place" xalign.49 yalign.25 action Return(None) textbutton "Top 10 links" xalign.8 yalign.25 action Return(None) $ a =ui. button(clicked = ui.returns(None), xalign=.48 , yalign= .83) $ ui.input (length=15, button = a) textbutton "{size=23}Search{/size}" action Return(None) xalign.48 yalign.9 screen home: tag site textbutton "{size=50}Smallworld{/size}" action Jump("smallworld2") xalign.45 text ("%s" %ID) text ("%s" %lv) xalign.09 yalign.05 imagebutton idle "home.png" hover "home.png" yalign.1 xalign.1 action Jump ("home") textbutton "Posting board" xalign.15 yalign.25 action Jump ("postingboard") textbutton "Official place" xalign.49 yalign.25 action Jump ("officialplace") textbutton "Top 10 links" xalign.8 yalign.25 action Jump ("top10links") textbutton "{color=#000000}Introduction{/color}" xalign.03 yalign.35 action Jump ("home") textbutton "Personal post" xalign.45 yalign.35 action Jump ("home2") text "Link" xalign.8 yalign.35 text ("ID:%s" %ID) xalign.03 yalign.5 text ("Lv. %s" %lv) xalign.03 yalign.55 textbutton "Message" xalign.03 yalign.75 action Jump ("home3") screen personal: tag site textbutton "{size=50}Smallworld{/size}" action Jump("smallworld2") xalign.45 text ("%s" %ID) text ("%s" %lv) xalign.09 yalign.05 imagebutton idle "home.png" hover "home.png" yalign.1 xalign.1 action Jump ("home") textbutton "Posting board" xalign.15 yalign.25 action Jump ("postingboard") textbutton "Official place" xalign.49 yalign.25 action Jump ("officialplace") textbutton "Top 10 links" xalign.8 yalign.25 action Jump ("top10links") textbutton "Introduction" xalign.03 yalign.35 action Jump ("home") textbutton "{color=#000000}Personal post{/color}" xalign.45 yalign.35 action Jump ("home2") text ("ID:%s" %ID) xalign.03 yalign.5 text ("Lv. %s" %lv) xalign.03 yalign.55 textbutton "Message" xalign.03 yalign.75 action Jump ("home3") screen postingboard: tag site textbutton "{size=50}Smallworld{/size}" action Jump("smallworld2") xalign.45 text ("%s" %ID) text ("%s" %lv) xalign.09 yalign.05 imagebutton idle "home.png" hover "home.png" yalign.1 xalign.1 action Jump ("home") textbutton "Posting board" xalign.15 yalign.25 action Jump ("postingboard") textbutton "Official place" xalign.49 yalign.25 action Jump ("officialplace") textbutton "Top 10 links" xalign.8 yalign.25 action Jump ("top10links") screen officialplace: tag site textbutton "{size=50}Smallworld{/size}" action Jump("smallworld2") xalign.45 text ("%s" %ID) text ("%s" %lv) xalign.09 yalign.05 imagebutton idle "home.png" hover "home.png" yalign.1 xalign.1 action Jump ("home") textbutton "Posting board" xalign.15 yalign.25 action Jump ("postingboard") textbutton "Official place" xalign.49 yalign.25 action Jump ("officialplace") textbutton "Top 10 links" xalign.8 yalign.25 action Jump ("top10links") screen top10links: tag site textbutton "{size=50}Smallworld{/size}" action Jump("smallworld2") xalign.45 text ("%s" %ID) text ("%s" %lv) xalign.09 yalign.05 imagebutton idle "home.png" hover "home.png" yalign.1 xalign.1 action Jump ("home") textbutton "Posting board" xalign.15 yalign.25 action Jump ("postingboard") textbutton "Official place" xalign.49 yalign.25 action Jump ("officialplace") textbutton "Top 10 links" xalign.8 yalign .25 action Jump ("top10links") screen message: tag site textbutton "{size=50}Smallworld{/size}" action Jump("smallworld2") xalign.45 text ("%s" %ID) text ("%s" %lv) xalign.09 yalign.05 imagebutton idle "home.png" hover "home.png" yalign.1 xalign.1 action Jump ("home") textbutton "Posting board" xalign.15 yalign.25 action Jump ("postingboard") textbutton "Official place" xalign.49 yalign.25 action Jump ("officialplace") textbutton "Top 10 links" xalign.8 yalign .25 action Jump ("top10links") # The game starts here. label start: "Haa...first, I think I should make an ID." scene bg desk $ ui.imagebutton ("note book.png", "note book.png", clicked = ui.jumps ("start2")) $ renpy.pause(hard=True) label start2: hide bg desk $ ID = renpy.input ("Decide your ID", length=15,) $ password = renpy.input ("Decide your password", length=15) p "Yeah, let's start." jump login $ renpy.pause(hard=True) label help: call screen help $ renpy.pause (hard= True) label email: "my ID is %(ID)s. and my password is %(password)s." jump login label join: "I entered the 'Join' page, but i've already make my account. So I came out from the page." jump login label about: call screen about $ renpy.pause (hard=True) label smallworld: show screen smallworldf p "Ah, here's the site." jump smallworldt $ renpy.pause (hard= True) label smallworldt: python: ui.image ("smallworld.jpg") ui.textbutton( "{size=50}Smallworld{/size}", clicked=ui.jumps("smallworldt"), xalign= .45) ui.text ("%s" %ID) ui.text ("Level:", yalign=.05) ui.text (("%s" %lv), xalign=.09, yalign=.05) ui.imagebutton ("home.png","home.png", yalign=.1, xalign=.1, clicked=ui.jumps ("home")) ui.textbutton ("Posting board", xalign=.15, yalign=.25, clicked=ui. jumps ("postingboard")) ui.textbutton ("Official place", xalign=.49, yalign=.25, clicked=ui.jumps ("officialplace")) ui.textbutton ("Top 10 links", xalign=.8, yalign=.25, clicked=ui.jumps ("top10links")) ui.text ("{size=40}Welcome to Smallworld,{/size}", xalign=.5, yalign=.5) ui.text (("{size=40}%s.{/size}" %ID), xalign=.5, yalign=.6) ui.text ("{size=20}Search for the others{/size}" ,xalign=.48, yalign=.7) ui.text ("{size=20}(ID+Introduction){/size}", xalign=.48, yalign=.75) a =ui. button(clicked = ui.returns(None), xalign=.48 , yalign= .83) word=ui.input (length=15, button = a) ui.textbutton ("{size=23}Search{/size}", clicked=ui.returns(True), xalign=.48, yalign=.9) ui.interact() if word == search: ui.jumps ("resultt") renpy.pause(hard=True) label home: show screen home $ renpy.pause (hard=True) label home2: show screen personal $ renpy.pause(hard=True) label home3: show screen message $ renpy.pause(hard=True) label postingboard: show screen postingboard $ renpy.pause(hard=True) label officialplace: show screen officialplace $ renpy.pause(hard=True) label top10links: show screen top10links $ renpy.pause(hard=True) label resultt: $renpy.pause(hard=True)
2013.04.18 19:40
백안시 2012/06/19
그냥 레이블로 바꾸지 마시고 검색 스크린에 있는 search 버튼에 Show 나 Jump 액션을 붙이시면 될 거같은데요. input 과 버튼에 붙은 a= 와 word = 같은 건 지우시고요.
..
그게 안 되면 search 스크린을 call screen 으로 호출해서 input 으로 입력받은 변수 _return에 저장되니까....이거 한 번 설명 드린 거 같은데 아닌가요.
label 검색 레이블: screen 어쩌구: $ a = ui.button (ui.returns(None)) input length 15 button a textbutton 'search' action Return() call screen 어쩌구 $ screen_name = _return $ renpy.show_screen(screen_name)
2013.04.18 19:40
2013.04.18 19:41
백안시 2012/06/22
input으로 입력 받은게 곧 _return에 저장되고
>> 네. 정확히는 스크린 블록에 만들어 call screen으로 띄운 input이 받은 값이 리턴에 저장됩니다.
그게 $ screen_name과 같고..
>> 아뇨 = 기호를 수학에서 보던 등호로 생각하시면 안 됩니다. 프로그래밍 언어에서 = 기호는 배정한다는 의미입니다. 이때 해석은 기호 오른쪽의 내용을 왼쪽에 배정한다는 의미입니다.
그 변수 자체를 show_screen으로 불러올 스크린 이름에 입력하라는 말씀이신가요.
>>네
그리고 그 input에 입력받은 단어와 같은 이름의 스크린을 불러오고.
>>네
http://askance.tistory.com/86
이 글 참고하시고 해당 사이트에서 파이썬 및 기본 프로그래밍 관련 정보를 참고하시기 바랍니다.
위 글에도 썼지만 저는 '비주얼노벨.텍스트어드벤처' 카테고리 이외의 모든 글은 읽는 대상이 '어느정도 프로그래밍에 대한 기본 지식을 습득한 사람'이라 전제하고 썼습니다. 말씀하신대로 렌파이는 파이썬이라는 프로그래밍 언어와 직접 연결된 스크립트를 짜야해서 되도록이면 풀어 쓰려 노력했습니다만 역시 기본 지식은 알고 있어야 이해하기 쉽습니다. 형태는 달라도 뼈대가 되는 내용은 알고 있어야 살을 붙일 수 있으니까요.
2013.04.18 19:41
lhy 2012/06/22
저런 페이지가 있었군요.
+그리고 저 '같고'는 그 변수를 배정해서 '같아졌다.' 뭐 이런 의미로 썼던 것입니다..
백안시 2012/06/22
죄송하지만 보는 사람 입장에서는 아무리봐도 그런 의미로 생각 할 수는 없는 표현이네요. 아무튼 다음부터는 더 정확하게 말씀하셔야 제가 답변드리는 데 더 도움이 되니 앞으론 앞에 상황설명이 길더라도 정확한 표현으로 부탁드립니다.
대충 이런 식으로 레이블에서 렌파이 스크립트 명령어랑 조합하신다음에 만들어보시면 될 거 같네요.