设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 92|回复: 0

[制作教程] [Ace] Common error debugging tips

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    3 天前
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4552

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    23111
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28557

    灌水之王

    发表于 3 天前 | 显示全部楼层 |阅读模式
    There were numerous cases when people keep asking for support for a common error that occurred in their project. However, they are not completely wrong. While the error notices are the same, the reason is usually different. Thus they still deserve their own question answered by their own case. At the same time, usually, how to diagnose the error is still the same. So here is the thread for it.

    ----------------------------------------------
    Damage formula deals zero damage
    Causes:

    By default, all the code error within the custom database formula is rescued by returning zero damage.

    Why this happens:
    I believe that the engine is being sold as "easy enough to use", thus preventing the error popup (which can lead to an assumption if the engine is buggy). This is, in my opinion, bad design for the developer. The developer needs to know what was the error instead of being confused by zero damage.

    How to mitigate:
    To make the error visible, you need to hijack the eval function from the default code library by inserting this snippet.
                    Code:        
    1. class RPG::UsableItem::Damage
    2.   def eval(a, b, v)
    3.     begin
    4.       result = [Kernel.eval(@formula), 0].max * sign
    5.     rescue StandardError => err
    6.       raise "Formula: #{@formula}\n\n#{err.to_s}"
    7.     end
    8.     return result
    9.   end
    10. end
    复制代码


    ----------------------------------------------
    Script 'Cache' line 106: RGSSError occurred. failed to create bitmap
    Causes:

    This error indicates that the game is failed to load an image (obviously, duh).

    Why this happens:
    There're many reasons for it. It could be because the image exceeded a certain threshold (i.e, too big), or the image is just corrupted. However, the engine did not mention which file that has the problem.

    How to mitigate:
    To investigate which file that has the problem, you could insert the snippet below. This, however, will NOT solve your problem. The failed image to load will simply be replaced by an empty bitmap, but while you're at it, it also pops up a message saying which file that has the problem
                    Code:        
    1. class << Cache
    2.   def self.normal_bitmap(path)
    3.     begin
    4.       @cache[path] = Bitmap.new(path) unless include?(path)
    5.     rescue
    6.       msgbox "Failed to create bitmap: #{path}"
    7.       @cache[path] = Bitmap.new(1,1)
    8.     end
    9.     @cache[path]
    10.   end
    11. end
    复制代码


    The game refuses to save (additionally, it also deleted the save file)
    Causes:
    At some point, the save contains information that could not be saved. It is not corrupted, it just can not be saved.

    Why this happens:
    This mainly because of a poorly written external script. The script culprit put a specific element (usually a bitmap object, or sprite) to the save content object (in Game_Actor, or Game_System, etc), make it unable to dump into a save file. Again, the default engine didn't put a good indication of what was causing the issue. The engine just put a buzzer sound (and delete the save file) instead of error notice because somehow they don't like an error notice shows up in-game. So that people usually had no idea what was going on.

    The reason why the save file is deleted is mainly that during the process of saving, it is corrupting the save file. Instead of the file being there and unable to load, it might as well as delete the file. Again, essentially hiding the error.

    How to mitigate:
    To check which game object that has the issue, you can try to put this snippet. Then try to save the game.
                    Code:        
    1. class Object
    2.   alias :classname :class
    3. end
    4. class << DataManager
    5.   def save_game(index)
    6.     begin
    7.       save_game_without_rescue(index)
    8.     rescue
    9.       delete_save_file(index)
    10.       retry_saving
    11.       false
    12.     end
    13.   end
    14.   def retry_saving
    15.     make_save_contents.each_value do |content|
    16.       begin
    17.         Marshal.dump(content)
    18.       rescue
    19.         msgbox "Failed to dump #{content.classname}"
    20.       end
    21.     end
    22.   end
    23. end
    复制代码

    Unfortunately, this snippet alone will not save your project. It only pointed out on which game object that causes the issue. Once the object is identified, it's easier to break down which script is the culprit.

    The next step is, if you know what you're doing, you can probably walk on your own. But if you don't know anything about scripting, you should ask people who have the knowledge on scripting.

    Game_Interpreter Line 1411 Error
    Refers to this thread: https://forums.rpgmakerweb.com/inde...interpreter-line-1411-error-backtracer.112849


    本贴来自国际rpgmaker官方论坛作者:TheoAllen处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/ace-common-error-debugging-tips.105690/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-15 19:06 , Processed in 0.139775 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表