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

[转载发布] SpellCheck Assisstant

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-8-1 20:21:19 | 显示全部楼层 |阅读模式
    Hi all,


        I put together this spellcheck assistant script to catch typos in my game since I couldn't find anything like it already existing. I hope others find it helpful!


        SpellcheckAssistant v1.0


        Description: Script creates a formatted HTML file with all/most of your games custom text. You can paste this into a standard text editor to spellcheck it.


        Use: Just called SpellcheckAssistant.run from your main file before your game launches. It might take awhile, so remove the call when you're done.

                    Code:       
    1. #==============================================================================
    2. #                          SpellcheckAssistant v1.0
    3. #------------------------------------------------------------------------------
    4. #  Author:
    5. #     Kyle Hughart
    6. #
    7. #  For use with:
    8. #     RPG Maker VXAce
    9. #
    10. #  Description:
    11. #     This script creates an html file containing your game's text so you can
    12. #     spellcheck it!
    13. #
    14. #  Use:
    15. #     Run this assistant by TEMPORARILY adding the following line:
    16. #
    17. #       SpellcheckAssistant.run
    18. #
    19. #     just before this line:
    20. #
    21. #       rgss_main { SceneManager.run }
    22. #
    23. #     in your 'Main' script. Then launch your game from RPG Maker. This may
    24. #     take a little while to run and slow down your game's launch time so make
    25. #     sure you remove the line from your Main file when you are done! You will
    26. #     find a file called "spellcheck.html" in your game's project folder. It
    27. #     will contain all/most custom text in your game in a readable format.
    28. #     From here you can copy and paste the text into your preferred
    29. #     spellcheck-enabled text editor!
    30. #
    31. #  License:
    32. #     I ain't even care how you use this script, dawg. Go buck wild.
    33. #==============================================================================
    34. module SpellcheckAssistant
    35.   @@spellcheck_output = ""
    36.   TEXT_FIELDS = {
    37.     'RPG::Actor' => ['name', 'description'],
    38.     'RPG::Armor' => ['name', 'description'],
    39.     'RPG::Weapon' => ['name', 'description'],
    40.     'RPG::Enemy' => ['name'],
    41.     'RPG::Item' => ['name', 'description'],
    42.     'RPG::Class' => ['name', 'description'],
    43.     'RPG::Skill' => ['name', 'description', 'message1', 'message2'],
    44.     'RPG::State' => ['name', 'message1', 'message2', 'message3', 'message4'],
    45.     'RPG::System' => ['elements', 'skill_types', 'weapon_types', 'armor_types'],
    46.     'RPG::System::Terms' => ['params', 'etypes', 'commands']
    47.   }
    48.   MESSAGE = 401
    49.   SCROLLING = 405
    50.   PROMPT = 102
    51.   SCRIPT = 355
    52.   SCRIPT_CONTINUE = 655
    53.   #Add SCRIPT and SCRIPT_CONTINUE to this list if you want to see scripts
    54.   #displayed in the output
    55.   TEXT_EVENTS = [MESSAGE, SCROLLING, PROMPT]
    56.   def self.handle(key, val)
    57.     if val.is_a? Hash
    58.       val.each {|k,v| handle(k, v)}
    59.     elsif (val.is_a? Array)
    60.       for i in 0 .. (val.size - 1)
    61.         handle('[' + i.to_s + ']', val[i])
    62.       end
    63.     else
    64.       if (val.is_a? RPG::EventCommand) && (TEXT_EVENTS.include? val.code.to_i)
    65.         params = val.parameters.flatten
    66.         params.each do |p|
    67.           if p.is_a? String
    68.             println_to_output(p)
    69.           end
    70.         end
    71.       end
    72.       if TEXT_FIELDS.keys.include? val.class.to_s
    73.         blank_entry = true
    74.         single_entry = val.class.to_s.sub("RPG::","") + '<blockquote>'
    75.         TEXT_FIELDS[val.class.to_s].each do |field|
    76.           if (val.instance_variables.include? "@#{field}".to_sym)
    77.             field_value = val.send(field)
    78.             blank_entry = false unless field_value.empty?
    79.             single_entry += "#{field}: #{field_value.inspect}<br>"
    80.           else
    81.             single_entry += "Error! Expected #{val.class.to_s} to
    82.             have a field called #{field}, but it only has:
    83.             #{val.instance_variables.inspect}<br>"
    84.             blank_entry = false
    85.           end
    86.         end
    87.         single_entry += '</blockquote>'
    88.         print_to_output(single_entry) unless blank_entry
    89.       end
    90.       ivars = {}
    91.       val.instance_variables.each {|x| ivars[x] = val.instance_variable_get(x)}
    92.       handle("Instance variables" , ivars)
    93.     end
    94.   end
    95.   def self.print_to_output(s)
    96.     formatted_string = s.sub('\r\n', '<br>')
    97.     @@spellcheck_output += formatted_string
    98.   end
    99.   def self.println_to_output(s)
    100.     print_to_output(s + "<br>")
    101.   end
    102.   def self.run
    103.     Dir.foreach("Data/") do |x|
    104.       if (x.to_s.include? '.rvdata2')
    105.         #puts "Now Analyzing #{x.to_s}"
    106.         data = load_data("Data/#{x.to_s}")
    107.         print_to_output("<h2>Text for #{x.to_s}</h2><blockquote>")
    108.         handle("Output", data)
    109.         print_to_output("</blockquote>")
    110.       end
    111.     end
    112.     File.open("./spellcheck.html", 'w') { |file| file.write(@@spellcheck_output) }
    113.   end
    114. end
    复制代码







    [/url]

    [url=https://forums.rpgmakerweb.com/attachments/screen2-png.37893/]


    -updated for formatting



    本贴来自国际rpgmaker官方论坛作者:serp处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/spellcheck-assisstant.61729/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 14:36 , Processed in 0.142643 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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