代码逻辑太糟糕,call和show不太一样的,label也不太好用来当逻辑判断,不太想看哪里出问题了,直接从DDLC里面抄了一段下来供参考:
[RenPy] 纯文本查看 复制代码 screen name_input(message, ok_action):
modal True
zorder 200
style_prefix "confirm"
key "K_RETURN" action ok_action
frame:
has vbox:
xalign .5
yalign .5
spacing 30
label _(message):
style "confirm_prompt"
xalign 0.5
input default "" value VariableInputValue("player") length 12 allow "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
hbox:
xalign 0.5
spacing 100
textbutton _("OK") action ok_action
default persistent.playername = ''
default player = persistent.playername
define your_char = Character('player', dynamic=True)
init python:
def FinishEnterName():
if not player: return
persistent.playername = player
renpy.hide_screen("name_input")
renpy.jump("label1")
label label1:
your_char 'Hello!'
return
label start:
#$ persistent.playername = ''
python:
if persistent.playername:
renpy.jump('label1')
else:
renpy.call_screen("name_input", message="Please enter your name", ok_action=Function(FinishEnterName)) |