如何在Renpy的Show()函数中使用函数?

huangapple go评论60阅读模式
英文:

How to use function in Show() in Renpy?

问题

How can I display my dictionary on another screen?

define python:
    heroes = { Someone : 1, Someone: 2}

screen showBio(id, dict):
    frame:
        xsize 300
        ysize 300
        vbox:
            text "[dict[id]]"

screen characters():
    tag menu
    use game_menu(_("Heroes"), scroll="viewport"):
        for i in heroes:
            textbutton "[i]" action Show("showBio([i], [heroes])")
英文:

How can I display my dictionary on another screen?

define python:
    heroes = { Someone : 1, Someone: 2}

screen showBio(id, dict):
    frame:
        xsize 300
        ysize 300
        vbox:
            text "[dict[id]]"

screen characters():
    tag menu
    use game_menu(_("Heroes"), scroll="viewport"):
        for i in heroes:
            textbutton "[i]" action Show("showBio([i], [heroes])")

答案1

得分: 0

Here is the translated code:

定义 python:
    英雄 = {"某人": 1, "某人2": 2}

屏幕 显示生物(id, 英雄字典):
    框架:
        x尺寸 300
        y尺寸 300
        竖盒:
            文本 str(英雄字典[id])

屏幕 角色():
    标签 菜单
    使用 游戏菜单(_("英雄"), 滚动="视口"):
        对于 i 在 英雄:
            文本按钮 i 操作 显示("显示生物", i, 英雄字典=英雄)

Please note that I've translated the code portion, as requested. If you have any specific questions or need further assistance, feel free to ask.

英文:
define python:
    heroes = {"Someone": 1, "Someone2": 2}
    
screen showBio(id, hero_dict):
    frame:
        xsize 300
        ysize 300
        vbox:
            text str(hero_dict[id])
    
screen characters():
    tag menu
    use game_menu(_("Heroes"), scroll="viewport"):
        for i in heroes:
            textbutton i action Show("showBio", i, hero_dict=heroes)

huangapple
  • 本文由 发表于 2023年4月20日 03:58:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/76058369.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定