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

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

How to use function in Show() in Renpy?

问题

How can I display my dictionary on another screen?

  1. define python:
  2. heroes = { Someone : 1, Someone: 2}
  3. screen showBio(id, dict):
  4. frame:
  5. xsize 300
  6. ysize 300
  7. vbox:
  8. text "[dict[id]]"
  9. screen characters():
  10. tag menu
  11. use game_menu(_("Heroes"), scroll="viewport"):
  12. for i in heroes:
  13. textbutton "[i]" action Show("showBio([i], [heroes])")
英文:

How can I display my dictionary on another screen?

  1. define python:
  2. heroes = { Someone : 1, Someone: 2}
  3. screen showBio(id, dict):
  4. frame:
  5. xsize 300
  6. ysize 300
  7. vbox:
  8. text "[dict[id]]"
  9. screen characters():
  10. tag menu
  11. use game_menu(_("Heroes"), scroll="viewport"):
  12. for i in heroes:
  13. textbutton "[i]" action Show("showBio([i], [heroes])")

答案1

得分: 0

Here is the translated code:

  1. 定义 python:
  2. 英雄 = {"某人": 1, "某人2": 2}
  3. 屏幕 显示生物(id, 英雄字典):
  4. 框架:
  5. x尺寸 300
  6. y尺寸 300
  7. 竖盒:
  8. 文本 str(英雄字典[id])
  9. 屏幕 角色():
  10. 标签 菜单
  11. 使用 游戏菜单(_("英雄"), 滚动="视口"):
  12. 对于 i 英雄:
  13. 文本按钮 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.

英文:
  1. define python:
  2. heroes = {"Someone": 1, "Someone2": 2}
  3. screen showBio(id, hero_dict):
  4. frame:
  5. xsize 300
  6. ysize 300
  7. vbox:
  8. text str(hero_dict[id])
  9. screen characters():
  10. tag menu
  11. use game_menu(_("Heroes"), scroll="viewport"):
  12. for i in heroes:
  13. 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:

确定