python - Ren'py 在游戏开始前未捕获异常,原因不明
问题描述
我在 Ren'py 6.99.14.3 中愉快地编程,然后我启动了游戏,但出现了错误。我尝试回到游戏在我的脚本中运行的最后一次,但我仍然遇到错误。我尝试调查了一段时间,但我没有丝毫想法(可能是初学者)。
这是“traceback.txt”的第一部分(不是完整的追溯部分)
I'm sorry, but an uncaught exception occurred.
After initialization, but before game start.
File "game/screens.rpy", line 714, in prepare_screen
screen preferences():
File "game/screens.rpy", line 714, in prepare
screen preferences():
File "game/screens.rpy", line 718, in prepare
use game_menu(_("Preferences"), scroll="viewport"):
File "game/screens.rpy", line 718, in prepare
use game_menu(_("Preferences"), scroll="viewport"):
File "game/screens.rpy", line 720, in prepare
vbox:
File "game/screens.rpy", line 720, in prepare
vbox:
File "game/screens.rpy", line 722, in prepare
hbox:
File "game/screens.rpy", line 722, in prepare
hbox:
File "game/screens.rpy", line 725, in prepare
if renpy.variant("pc"):
File "game/screens.rpy", line 725, in prepare
if renpy.variant("pc"):
File "game/screens.rpy", line 727, in prepare
vbox:
File "game/screens.rpy", line 727, in prepare
vbox:
File "game/screens.rpy", line 730, in prepare
textbutton _("Window") action Preference("display", "window")
File "game/screens.rpy", line 730, in prepare
textbutton _("Window") action Preference("display", "window")
File "renpy/common/00preferences.rpy", line 454, in Preference
rv = get()
File "renpy/common/00preferences.rpy", line 211, in get
return __DisplayAction(1.0)
File "renpy/common/00preferences.rpy", line 27, in __init__
self.width = int(factor * config.screen_width)
Exception: Character expects its what argument to be a string, got 1280.0.
如果您愿意,我会提供更多信息,如果可以的话
谢谢你的帮助!
解决方案
"Exception: Character expects its what argument to be a string, got 1280.0."
您是否像这样将您的角色之一定义为“int”?
define int = Character ('Name', color="ffffff", show_two_window=True,)
Int 代表整数,它是一种处理数字的编程变量(因此为什么你可能在其中有数字 1280.0,它试图找到一个可以使用的数字)。这是一个保留名称列表,可帮助您再次避免这些错误,或者查看您是否将其命名为您不应该使用的其他名称。
推荐阅读
- powershell - 使用 Powershell 在 IIS 中注册处理程序模块
- wpf - 在 wpf 数据网格中没有行的区域上隐藏 wpf 上下文菜单
- javascript - 如何从 JointJS 元素中的 prop 读取值?
- .htaccess - .htaccess 特定 url 重定向到另一个域 url
- ios - Swift 4 带有 AVPlayer 的 UISlider 不滑动
- php - 如何重写标签
- sqlite - 如何在设计时 Firedac 中设置表字段主要?
- python - 来自熊猫数据框的信息矩阵
- c++ - 在 const 函数中的非常量成员上调用非常量函数
- apache-kafka - 如何在Kafka中按键标记消息以删除?