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

[转载发布] ccoa's UMS FIT_WINDOW_TO_TEXT Patch

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

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-22 16:26:03 | 显示全部楼层 |阅读模式
    ccoa's UMS FIT_WINDOW_TO_TEXT Patch


    Introduction
    ccoa's Universal Message System (UMS) FIT_WINDOW_TO_TEXT mode adds extra space from escape codes and make the window unnecessary longer.
    I had Chaucer fix it and I'd like to share the fix with anyone want to remove the gap as well.

    Since ccoa does not allow to redistribute the script, so I can only show the parts need changing only.

    Script
    - Replace line 1195
    1. width = [width, self.contents.text_size(line).width].max
    复制代码
    with
    1. width = [width, text_width(line)].max
    复制代码

    - Add these at line 1290 (above reset_window)
    Spoiler: text_width method
                    Ruby:       
    1. def text_width ( text )
    2.     width = 0;
    3.     text = text.gsub( "\030" ) do "" end
    4.     text = text.gsub( "\031" ) do "" end
    5.     text = text.gsub( "\000" ) { "" }
    6.     text = text.gsub( /\001[.*?]/ ) { "" }
    7.     text = text.gsub( "\002" ) { "" }
    8.     text = text.gsub( /\026[.*?]/ ) { "" }
    9.     text = text.gsub( "\003" ) { "" }
    10.     text = text.gsub( "\023" ) { "" }
    11.     text = text.gsub( /\024[.*?]/ ) { "" }
    12.     text = text.gsub( /\025[.*?]/ ) { "" }
    13.     text = text.gsub( "\004" ) { "" }
    14.     text = text.gsub( "\005" ) { "" }
    15.     text = text.gsub( "\006" ) { "" }
    16.     text = text.gsub( /\007\[(.*?)\]/ ) { "" }
    17.     text = text.gsub( /\010\[.*?\]/ ) { "" }
    18.     text = text.gsub( /\011\[.*?\]/ ) { "" }
    19.     text = text.gsub( /\013\[[0-9]+\]/ ) { "" }
    20.     text = text.gsub( /\014\[[0-9]+\]\s\s/ ) {
    21.       width += 24;
    22.       ""
    23.     }
    24.     text = text.gsub( /\015\[[0-9]+\]\s\s/ ) {
    25.       width += 24;
    26.       ""
    27.     }
    28.     text = text.gsub( /\016\[[0-9]+\]\s\s/ ) {
    29.       width += 24;
    30.       ""
    31.     }
    32.     text = text.gsub( /\017\[[0-9]+\]\s\s/ ) {
    33.       width += 24;
    34.       ""
    35.     }
    36.     text = text.gsub( /\027\[.*?\]/ ) {
    37.       width += 24;
    38.       ""
    39.     }
    40.     text = text.gsub( "\020" ) { "" }
    41.     text = text.gsub( "\021" ) { "" }
    42.     text = text.gsub( "\022" ) { "" }
    43.     width += self.contents.text_size( text ).width;
    44.     return width;
    45.   end
    复制代码


    Credit and Thanks
    - Chaucer
    - Credit is optional


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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-4 12:48 , Processed in 0.076084 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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