Project1

标题: 【老鹰的RGSS3脚本小巢】对话框扩展(9.6英语版) [打印本页]

作者: 百里_飞柳    时间: 2019-3-30 15:04
标题: 【老鹰的RGSS3脚本小巢】对话框扩展(9.6英语版)
本帖最后由 百里_飞柳 于 2023-9-6 21:42 编辑



LOGO绘制by @congwsbn

○ 前言

之前曾经发过一个记录自己写的数据库扩展的脚本帖子,不过果然是坑了hhh
所以更改了下方案,之后还是上传到自己的github仓库,方便我自己维护,也方便其他人查看。
我也学乖了,不再在同一个帖子里反复编辑更新,而是在有较大的系统完成后发布新帖子,这样也方便大家能直接看到我的最新操作。
这个帖子便是宣传与发布我的对话框扩展系统。


○ 概述

默认对话框的功能实在是过于局限,所以最初我写了一个 对话框转义符扩展 插件来增加新的转义符,
但是有的转义符势必会修改对话框自己的一些属性,比如宽度高度、显示位置、背景等,
所以我在那个插件的基础上继续扩展,完成了 对话框扩展 插件,里面包含了更多的转义符,用于实现在显示文字的同时应用各种设置变更。

当然,我还为 对话框扩展 写了一系列的AddOn插件,譬如 选择框扩展、物品选择扩展、滚动文本框扩展、并行对话、关键词信息查看 等。
以后可能会有更多其他对话框相关效果诞生,我也非常期待大家的回复与创意~


○ GitHub仓库

我的RGSS3仓库地址为:https://github.com/OneEyedEagle/EAGLE-RGSS3
其中的 Message System 文件夹下放置了 对话框扩展 及其 AddOn 插件。
而其中的 Demos 文件夹下的 DEMO_EagleMessageEX 文件夹放置了我特地为这一套插件制作的简单范例工程。
出于私心,这个DEMO还携带了一个非常小的剧本,虽然没有绘制Fidelis系列的LOGO,不过它的确是我的某一个坑的剧情预热。

【2020.10.2 更新】由于真的有人完全搞不懂GitHub,所以我额外新增了一个 蓝奏云载点 密码是 fcu5,尽量保证和GitHub上的DEMO更新时间一致吧……


○ 英语版

超级感谢 Roninator2 和 BCj 努力把我的三个DEMO翻译成了英语版!具体请见这里
BIIIIIG THANKS to Roninator2 and BCj! They made awesome works to translate my three DEMOs into English version. More information is HERE.



○ 示例图

1
对话框扩展 + AddOn滚动文本框扩展
动图较大,酌情点开

【新增功能】其中全部文字特效均可在 对话框 中使用,但由于对话框的一些特性,并行绘制与指定文字位置的效果可能造成其他麻烦的问题,所以我没有给对话框转义符这些特性hhhh

2
对话框扩展 + AddOn选择框扩展 + 简单粒子系统发散式 + 粒子模板 + AddOn文字四散移出
事件脚本:$game_message.para = true
对话文本:\pop[1]\pout[1]\win[cwi3]据我推测,整件事情只有一个人有可能做到,\nl虽然说出来你会不信,不过全部证据都指向着他。
选项1:说重点。ex{ri-1rt1}
  事件脚本:t = "\\pop[1]啧,还是这么急。\n"
  事件脚本:$game_message.add_escape(t)
选项2:你确定?
对话文本:\pop[1]不管你信不信,这就是我全部的推理。
动图较大,酌情点开

【新增功能】当启用para开关时,选择框将会与对话框同步打开
【新增功能】选择框的文字移出效果,与对话框的文字移出效果相同

3
对话框扩展
脸图设置:名称:ph_t_1x1.png,索引:0
对话文本:\win[lh16]\pop[0w250h2]\cout[1]这当然是测试用的文本啦,写的非常长的一句话。
                测试换行效果。
                第三行呢?
                第四行会怎么样呢?\nl第五行了鸭!\facep[z-1dx-85dy50m1]
动图较大,酌情点开

【新增功能】脸图规格扩展,当脸图文件名含有 _mxn 格式的文本时(其中m和n为数字,x为小写字母X),在对话框中会认定该张图片为m行n列规格,若没有该文本,则为2行4列(同默认)
【新增功能】脸图z值偏移量的设置,当z值偏移量为-1时,将显示在对话框下方,且不占用对话框宽度;z值偏移值默认为1,脸图显示在对话框左侧,且占用宽度
【新增功能】内容滚动,当对话框的宽度高度固定时,在等待按键时,将开启内容滚动功能,此时按住方向键可以进行查看,按确定键或取消键继续下一指令

4
对话框扩展
对话文本:\cswing[o8]测试用一行文本。
动图较大,酌情点开

【新增功能】文字摇摆特效,全部文字特效已经整合到 Add-On选择框扩展 与 Add-On滚动文本框扩展 中。

5
对话框扩展
对话文本:\pop[0]\ctog[i0t10r1]警告\ctog[0]!——
\ctog[i0t12r1]警告!\ctog[0]
检测到\ctog[i0t30r0]不明身份\ctog[0]人员。
动图较大,酌情点开

【新增功能】文字切换特效。

6
对话框扩展
对话文本:\win[cwi1o5do-5fw1fh1]\cin[do5t30]\cout[do5t30vo30]这是故事最开始的地方,没有人知晓TA如何而来\pause[do2o5]
动图较大,酌情点开

【新增功能】指定文字移入移出的目的地。

7
对话框扩展
预览图较大,酌情点开

【新增功能】利用 \next 转义符,不关闭当前对话框,继续执行之后的事件指令,在下一个显示文本时,接着之前的对话框继续显示。

8
粒子发射器
动图较大,酌情点开

【新增功能】为老鹰的一些独立系统UI的背景,增加了动态连线的粒子特效


○ BUG反馈

由于我个人力量有限,在我未能完全尝试的情况下,部分转义符的组合可能会产生奇怪的BUG,请最好 截图 并 记录相关转义符变量参数值 来回帖询问。

【2020.5.3 更新】 ⑨姐姐因为接单原因用到了这个插件,所以开了一个Q群(647297622)进行交流使用,欢迎大家一起来扩展对话框的可能性~
点开查看二维码



○ 关于整合

原则上我并不想和其他任何对话框进行整合,
当然如果它们足够有趣或者你用钱砸我,我会热心帮忙。
【2020.8.22】对话框增强了兼容性,现在我的对话框完全独立于默认的对话框了,所以理论上可以和其他对话框一同存在。
同时在脚本开头处新增了一个常量,当该常量置为 true 时,将使用默认对话框。
但在事件中开启 $game_message 中的开关 eagle_message 后,将转而使用我的对话框。
并且由于独立了,并行对话等Addon也可以一起随其他对话框同时使用了。
作者: Arfies    时间: 2019-3-30 15:39
老鹰出品必属精品!!
实不相瞒我已经盯上这个文字效果很久了
作者: garfeng    时间: 2019-3-30 15:46
期待好久了!
作者: fux2    时间: 2019-3-30 22:58
老鹰聚聚的作品质量都不用怀疑,直接收藏
作者: congwsbn    时间: 2019-3-31 00:45
老鹰是不是应该感谢我!每天给我传bug的日子(
作者: 百里_飞柳    时间: 2019-7-9 00:02
更新了两个gif示例图,最近新增加的功能,顺便修复了很多bug……
作者: fux2    时间: 2019-7-9 00:07
效果过分强大,加入精华~
作者: jianyulei    时间: 2019-7-9 14:13
本帖最后由 jianyulei 于 2019-7-9 14:15 编辑

不知道能不能支持对话框中显示函数返回的结果
目前我想要在对话框中显示一些方法或变量的运算结果都要先将数据保存到变量中然后再用\v,很不方便.
作者: 火锅深处    时间: 2019-7-9 21:53
本帖最后由 火锅深处 于 2019-7-9 22:57 编辑

今天更新的版本下来显示stack level too deep......
然后,之前的版本,有一个疑问,不过这个不知道应该在这里问还是单开一贴比较好......
就是如果和喵呜喵5的快进脚本配合的话,转移符“\!”貌似会影响整句话,比如说“我说:\!你好”,那么前面“我说”的部分也要多按一次回车才会出现,
另外就是如果加上这个快进脚本的话浮在句尾的那个飘来飘去的图案(一直不知道怎么叫)又会回到中间的位置,
不太懂脚本,这是什么原理呢

======================
stack level too deep的问题,虽然我也记得是那样,但好像并没看出多什么东西,而且又下载了一遍,还是同样问题......

快进脚本

作者: 百里_飞柳    时间: 2019-7-9 22:53
本帖最后由 百里_飞柳 于 2019-7-9 22:54 编辑
火锅深处 发表于 2019-7-9 21:53
今天更新的版本下来显示stack level too deep......
然后,之前的版本,有一个疑问,不过这个不知道应该在 ...


关于对话快进:
MESSAGE_EX#skip?方法,将在每帧判定是否执行快进,我写了false,但后面保留了被注释的 Input.trigger?(:CTRL),你将false和#删了,就是按下ctrl键快进跳过当前对话(并不是快速完成显示,而是直接强制结束并关闭当前对话框)

我并未开启该功能,快进是直接放弃未绘制的内容,但因为我对话框实现原理的限制,未绘制的随文本更新而生效的转义符也将被跳过,这可能会导致一些不必要的显示错误,如果想启用快进功能,请务必确保位于文本中间或结尾的转义符不是非常重要的设置。
作者: 白色幸福    时间: 2019-10-5 14:38
本帖最后由 白色幸福 于 2019-10-5 14:58 编辑

对话框demo报错,玩到村长的那个hold符那里就会直接弹出:



不是码农也看不懂到底怎么回事 GitHub的那个bug修复我不知道应该给他修在哪儿  删掉hod就没那事儿了
作者: 白色幸福    时间: 2019-10-5 19:11
本帖最后由 白色幸福 于 2019-10-5 19:55 编辑
白色幸福 发表于 2019-10-5 14:38
对话框demo报错,玩到村长的那个hold符那里就会直接弹出:


非常感谢指路
不过我个人问一下这个脚本到底怎么使用?
我个人用在我的项目里,一些地方字体非常的小,但一旦使用了字体放大,整个项目所有的字体除了地图显示不受控制外,其他所有字体都变大了(这两种皆没有使用您脚本所带的转换符,都是原版默认的文字格式),需要用上下键才能看清全部的对话。不过还是感谢做了这么好的脚本,画面干净多了,就是,我还不太会调整

刚刚发现只要人物对话中有一个\{,一旦字体开始变大,,所有的字体就会开始变大,变成统一的文字大小,如果要是后面有文字大小变化会变得更大,而且不受控制。然后就只能用上下键才能看全文字了……看来我还是没研究明白这个东西怎么回事
但是显示地图名称还是特别小的小字,真就蒙了,而且地图显示名称那里是不能通过脚本改变文字大小的。
emm之前那个文字大小是前置修改改了文字大小的锅……但是后面文字变大不受那个前置文字修改的影响,总而言之,只要项目中有一处使用了字体放大,所有的文字都会被放大,必须在通过缩小回复到原来的大小,而不会想原来一句话一个文字大小
请问怎么解决?
作者: 白色幸福    时间: 2019-10-6 00:33
本帖最后由 白色幸福 于 2019-10-6 13:39 编辑

请问一下 刚刚尝试使用了 cswing,但后面就怎么都关掉了后出现了其他的文字特效,而且出现的效果怎么也关不掉 请问这要怎么处理? 是不是demo中的脚本需要更新了?






昨天更新了一下脚本,从头到尾跑了一遍,发现文字不受控制的歪斜现象,不过不是句句都歪了,而是有一句开始歪有一句就不歪了。还是没找到解决办法  而且好像关键词和文字回看因为都是shift所以冲突了?还是因为对话框的原因?
emm也许有置换符可以关闭所有的特效就好了,检测了半天没找到到底问题再哪儿




作者: 白色幸福    时间: 2019-10-6 15:03
白色幸福 发表于 2019-10-6 00:33
请问一下 刚刚尝试使用了 cswing,但后面就怎么都关掉了后出现了其他的文字特效,而且出现的效果怎么也关不 ...

转义符没毛病,脚本也没检测出毛病,就是奇怪在特效其实根本不是这个特效,而且我关不掉了,最后只好删掉不用这个cswing了了
作者: 白色幸福    时间: 2019-10-6 16:41
白色幸福 发表于 2019-10-6 15:03
转义符没毛病,脚本也没检测出毛病,就是奇怪在特效其实根本不是这个特效,而且我关不掉了,最后只好删掉 ...

鹰哥那个我确定事件和文字效果是对上的。只用了cswing,前面的其他的特效效果都关了
作者: fox370    时间: 2019-12-20 23:01
不客气的收下了 谢谢鹰酱大佬啦
作者: 翠靈月    时间: 2020-4-29 18:17
想请教一下并行对话的部分
为什么照着示例做却会报错呢

另外想再请教一下
并行对话有办法实现当玩家面朝某个方向时才触发(面朝其他方向时不触发&对话关闭)的功能吗?
作者: 百里_飞柳    时间: 2020-4-29 19:12
翠靈月 发表于 2020-4-29 18:17
想请教一下并行对话的部分
为什么照着示例做却会报错呢

是改错了一个地方,已经更新

可以用 p.direction 获取玩家的朝向(2468四方向)进行判定

如果已经有详细的设计,推荐用并行事件+事件脚本 MESSAGE_PARA.add(name, list_str[, ensure_fin]) 与 MESSAGE_PARA.list_finish(name) 来手动处理……
作者: chanszeman1018    时间: 2020-4-29 19:14
提示: 作者被禁止或删除 内容自动屏蔽
作者: 翠靈月    时间: 2020-5-1 21:25
本帖最后由 翠靈月 于 2020-5-2 14:08 编辑

(已解决?)⑨姐姐表示下个版本的RGD会修复这个问题
-------------------

作者: 百里_飞柳    时间: 2020-5-3 11:51
最新更新,增加了一个实时交流的Q群

以及对话框等又更新优化了一轮,现在更加稳定高效了()
作者: miuka    时间: 2020-5-19 22:08
交流群搜不到是为什么2333
作者: miuka    时间: 2020-5-19 22:39
miuka 发表于 2020-5-19 22:08
交流群搜不到是为什么2333

可能是群里没有打开允许群搜群,不过二维码也可以
作者: 时久之妖    时间: 2020-6-4 19:55

demo玩到村长hold符那里报错了……看不懂是什么问题orz把GitHub里的对话框扩展脚本复制粘贴重新覆盖也还是这样
作者: 百里_飞柳    时间: 2020-8-22 18:58
增强了兼容性,现在可以通过切换对话框来与其他对话框脚本共同使用了

当然,也可以直接关闭我这个对话框,然后使用addon并行对话来进行一些特效演出
作者: 火锅深处    时间: 2020-10-8 12:16
本帖最后由 火锅深处 于 2020-10-23 22:56 编辑

报一个不是特别大的发现,第一张地图上走到第二个对话框时,如果移动到其他地图,会有个空对话框在地图上有短暂的停留
一般是在如图的位置,也有一次出现在屏幕更下方的位置。



=======================================================================================
以及发现事件簿的文字会把部分转义符记上去,是因为写法和其他转义符不同吗(不过这个新功能真是好顶赞)

=======================================================================================
哎......?又下了1008那个版本,结果上面那张画的对话没有了?这个日志内容是调查右边那个骷髅会出现吧?
P.S.话说,这段对话在上一个版本调查骷髅是没有显示的,但是日志里有,1008版本则是显示了滚动文字,而日志里没有

以及,在完成最后的事件之后如果打开菜单会出现这个问题↓ 我确定这个问题是上个版本里没有的


=======================================================================================
2020.10.23
新的疑问,应该不算是对话脚本里的,但是找不到这个的所以占这边问一下......
“场景自由呼叫”脚本会导致喵呜的截图存档没有截图,这是为什么?
截图存档

场景自由呼叫也贴一下

作者: Kim_Shyuen    时间: 2021-1-20 16:40
報個bug ,是脚本起衝突嗎?


之前試著把整段注釋掉就可以了,也不知道是不是因爲這樣 偶爾會無預警關閉游戲

作者: 火锅深处    时间: 2021-2-13 22:40
本帖最后由 火锅深处 于 2021-2-16 10:00 编辑

新的疑问......对话框那边可以通过兼容模式暂时关闭,选项框扩展有办法也暂时关闭嘛?
==================
2021.2.16
因为是无关紧要的发现所以就在这边说了吧,【事件日志】或【对话日志】除了要在“组件-位图绘制转义符文本”之下以外还需要装【对话框扩展】和【并行对话】才能跑,下次别忘了注释

另外不确定是不是我设置的问题(写的是1,应该没有更改这块的默认),现在的版本好像不支持快进了(用的是喵5的那个),手头上一个能用快进的版本是19年7月的,20年10月的就不行了。
作者: CongMingDa    时间: 2021-4-10 19:33
我想用对话框透明写一个故事,所以就需要对话框能写很多字
默认对话框只能写几行
可以实现吗
作者: an_ice    时间: 2021-7-29 21:21
发现大佬还在更新脚本,来问一个很傻瓜的问题。就是我只想使用对话框提供的文字效果,但是不想让脚本中的对话框覆盖系统默认对话框,这个时候我应该怎么设置?
作者: an_ice    时间: 2021-7-31 14:13
an_ice 发表于 2021-7-29 21:21
发现大佬还在更新脚本,来问一个很傻瓜的问题。就是我只想使用对话框提供的文字效果,但是不想让脚本中的对 ...

可能是我表达的不够清晰!我的意思是我想保留对话框的原本位置应该怎么设置,只要使用大佬的对话框,对话框就会到人物头上去,我想像13L一样用这个对话框,让对话框还是在屏幕下方,并且不跟随人物,但是不知道参数怎么设置。
作者: an_ice    时间: 2021-8-2 20:20
an_ice 发表于 2021-7-31 14:13
可能是我表达的不够清晰!我的意思是我想保留对话框的原本位置应该怎么设置,只要使用大佬的对话框,对话 ...

发现确实是复制大佬样例的时候没删\pop……我是傻瓜感谢大佬的耐心回复!!我懂了!
作者: 百里_飞柳    时间: 2021-8-23 17:32
N多次更新后的自顶:

- 把词条系统(文字版)加入了DEMO中,并且与Addon关键词信息查看进行适配
- 对话框增加了 {{}} 格式文本来调用ruby脚本
- 修复了对话框中的几个奇怪的应该不会有人触发的bug
- Addon选择框扩展优化的注释排版,并且增加了选项的名称,用于制作一次性选项与选过选项的变色
作者: Nil2018    时间: 2021-8-23 21:48
老鹰大大,这个对话拓展太醋虾了,比较头疼的是我发现和Sion防卡脚本有冲突,自己的工程事件比较多,比较依赖该脚本。
能麻烦您帮看看有方法解决吗?可以有偿!

Sion防卡
RUBY 代码复制
  1. # 事件管理器 v1.1 bug 修正
  2. # 优化默认脚本事件运行效率
  3.  
  4. class Game_Event
  5.   attr(:copy_id, :map_id)
  6.   attr_accessor :copy_self_switch
  7.  
  8.   # 开始
  9.  
  10.   # 默认脚本距离屏幕比较远的事件是不会自主移动的
  11.  
  12.   # 这段脚本让全屏的事件都可以按照设置好的自身移动路线前进,如果静止的事件比较多会
  13.   # 比较省资源。如果不需要这个功能,就删除 开始 ~ 结束 之间的脚本
  14.  
  15.   def update_self_movement
  16.     if @stop_count > stop_count_threshold
  17.       case @move_type
  18.       when 1;  move_type_random
  19.       when 2;  move_type_toward_player
  20.       when 3;  move_type_custom
  21.       end
  22.     end
  23.   end
  24.  
  25.   # 结束
  26.  
  27.   alias_method :sEventManager_init_public_members, :init_public_members
  28.   def init_public_members #覆盖
  29.     @gridding = $game_map.gridding
  30.     sEventManager_init_public_members
  31.   end
  32.   def moveto(x, y) #修改父类方法
  33.     gridding_remove
  34.     super
  35.     gridding_insert
  36.   end
  37.   def move_straight(d, turn_ok = true) #修改父类方法
  38.     gridding_remove
  39.     super
  40.     gridding_insert
  41.   end
  42.   def move_diagonal(horz, vert) #修改父类方法
  43.     gridding_remove
  44.     super
  45.     gridding_insert
  46.   end
  47.   def gridding_remove
  48.     @gridding[@x][@y].delete(self)
  49.   end
  50.   def gridding_insert
  51.     @gridding[@x][@y].push(self)
  52.   end
  53. end
  54.  
  55. class Game_Map
  56.   attr(:gridding)
  57.   alias_method :sEventManager_setup_events, :setup_events
  58.   def setup_events
  59.     @gridding = Array.new(width + 1) { Array.new(height + 1) {[]} }
  60.     sEventManager_setup_events
  61.   end
  62.   def refresh_tile_events #覆盖
  63.   end
  64.   def events_xy(x, y) #覆盖
  65.     @gridding[x][y]
  66.   end
  67.   def events_xy_nt(x, y) #覆盖
  68.     @gridding[x][y].select {|event| !event.through}
  69.   end
  70.   def tile_events_xy(x, y) #覆盖
  71.     @gridding[x][y].select {|event| event.tile? && !event.through}
  72.   end
  73. end
  74. #
  75. # 精灵管理
  76. class Spriteset_Map
  77.   # 设置事件直径,如果你使用的事件图片较大可以适当增大这个数值
  78.   # 以防止事件进入画面但是没有显示出来。
  79.   EventRadius = 2
  80.   alias_method :sEventManager_create_characters, :create_characters
  81.   def create_characters
  82.     sEventManager_create_characters
  83.     setup_event_sprites
  84.   end
  85.   def setup_event_sprites
  86.     @events_sprites = {}
  87.     @character_sprites.each {|sp|
  88.       @events_sprites[sp.character] = sp if sp.character.class == Game_Event
  89.     }
  90.     @events_sprites.each_value {|sp| @character_sprites.delete(sp)}
  91.   end
  92.   alias_method :sEventManager_dispose_characters, :dispose_characters
  93.   def dispose_characters
  94.     @events_sprites.each_value {|sprite| sprite.dispose if sprite}
  95.     sEventManager_dispose_characters
  96.   end
  97.   alias_method :sEventManager_update_characters, :update_characters
  98.   def update_characters
  99.     sEventManager_update_characters
  100.     update_event_sprites
  101.   end
  102.   def update_event_sprites
  103.     ox = $game_map.display_x - EventRadius
  104.     ex = $game_map.display_x + Graphics.width / 32.0 + EventRadius - 1
  105.     oy = $game_map.display_y - EventRadius
  106.     ey = $game_map.display_y + Graphics.height / 32.0 + EventRadius - 0.875
  107.     mw = $game_map.width
  108.     mh = $game_map.height
  109.     lv = $game_map.loop_vertical?
  110.     lh = $game_map.loop_horizontal?
  111.     @events_sprites.each {|event, sprite|
  112.       x = event.real_x
  113.       y = event.real_y
  114.       if (x > ox && x < ex || lv && x + mw > ox && x + mw < ex) &&
  115.          (y > oy && y < ey || lh && y + mh > oy && y + mh < ey)
  116.         sprite ? sprite.update :
  117.           @events_sprites[event] = Sprite_Character.new(@viewport1, event)
  118.       elsif sprite
  119.         sprite.dispose
  120.         @events_sprites[event] = nil
  121.       end
  122.     }
  123.   end
  124. end

作者: 百里_飞柳    时间: 2021-8-23 22:19
Nil2018 发表于 2021-8-23 21:48
老鹰大大,这个对话拓展太醋虾了,比较头疼的是我发现和Sion防卡脚本有冲突,自己的工程事件比较多,比较依 ...

这个的确是我对话框有个bug,导致未找到精灵时直接报错
下个版本会修复,未找到精灵时取消pop效果

和这个插件的兼容如下,放到两个脚本的下面就可以了
  1. #=============================================================================
  2. # ○ 对话框扩展 兼容【事件管理器 v1.1 by Sion】
  3. # 放置于【事件管理器 v1.1 by Sion】与【对话框扩展 by老鹰】之下
  4. #=============================================================================
  5. class Window_EagleMessage
  6.   #--------------------------------------------------------------------------
  7.   # ● 获取pop对象的精灵(用于计算偏移值)
  8.   #--------------------------------------------------------------------------
  9.   def eagle_get_pop_sprite
  10.     # 地图场景中,所存储的并非精灵,需要再次检索
  11.     if pop_params[:type] == :map_chara
  12.       begin
  13.         SceneManager.scene.spriteset.character_sprites.each do |s|
  14.           return s if s.character == @eagle_pop_obj
  15.         end
  16.         SceneManager.scene.spriteset.events_sprites.each do |e, s|
  17.           return s if e == @eagle_pop_obj
  18.         end
  19.       rescue
  20.       end
  21.       return nil
  22.     end
  23.     return @eagle_pop_obj
  24.   end
  25. end
  26. class Spriteset_Map
  27.   attr_reader :events_sprites
  28. end
复制代码

作者: 百里_飞柳    时间: 2021-10-24 22:16
值此程序员整数节日1024,给对话框的DEMO进行了更新

加上了最新写的 粒子发射器 插件,对话框可以使用 \pout 转义符调用粒子特效来移出文字
并且为 对话日志 等我的独立UI加上了炫酷的背景粒子连线的特效

大概没有人能看懂我的粒子系统的使用方法吧(瘫)
所以如果有什么有趣的粒子特效想法也欢迎大家讨论

然而现在这个 粒子发射器 还太菜了,只能进行粒子的发射,没法聚集……


作者: 应答    时间: 2021-11-4 12:41
我想问一下,如何让对话日志在打开和退出的时候有声音,就是打开菜单和退出菜单的那个声音
我在其中的好几个地方试图加上Sound.play_ok和Sound.play_cancel,但要么无效要么一直响
因为其它地方都是有音效的,就对话日志没有,感觉会很奇怪
然后我还改了一点地方,就是把那个退出的按钮改成只有X键,按Q键退出不了
作者: 应答    时间: 2021-11-4 22:46
大大,我按你说的在ui_init和uidispose的前面和后面加上了Sound.play_ok还有Sound.play_cancel,但是不行,报错为undefined method 『play』 for Sound:Module……
我翻了一下脚本手册,再尝试了一下:
RUBY 代码复制
  1. #---
  2.   # 定义确定音效与取消音效
  3.   #---
  4.   def self.play_ook
  5.     play_system_sound(1)
  6.   end
  7.   def self.play_ccancel
  8.     play_system_sound(2)
  9.   end

然后底下相应地改成:
RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   # ● 呼叫UI,并执行至结束
  3.   #--------------------------------------------------------------------------
  4.   def self.call
  5.     return if logs.size == 0
  6.     Sound.play_ook
  7.     ui_init
  8.     ui_update
  9.     ui_dispose
  10.     Sound.play_ccancel
  11.   end

还是失败……
所以要怎么加入打开和关闭音效呢?
作者: 应答    时间: 2021-11-5 00:35
真的可以了,那个ook和ccancel是我重新定义的,所以不是打错了
一开始我添加的就是「Sound.play_ok」和cancel,但不知道为什么报错了,所以我参照帮助手册的Sound模块自己定义了一个
不管了,反正解决了就行
作者: BCJenbo    时间: 2023-9-1 01:56
你好!
我正在使用谷歌翻譯,希望沒問題。

我發現了一個錯誤。當我使用你最新的MessageEX腳本時這個“\pop[0]\pout[1]\cwave[1]信念之護,嚴峻無畏
同心之伴,創造奇蹟\cwave[0]\temp"

給出一個錯誤。它僅適用於舊腳本的演示。

另外,在 MessageEX 演示中,當與骨骼對話時,此事件“\cin”不起作用。

我怎樣才能解決這個問題?
作者: BCJenbo    时间: 2023-9-3 01:42
谢谢你!

我有另一个问题。我的一个朋友将您的脚本翻译成英文(供私人使用),但我们想知道:我们可以在 https://forums.rpgmakerweb.com/index.php 上分享它们吗?当然,我们会写下您制作的内容并链接到您的 github 作为原始来源
作者: BCJenbo    时间: 2023-9-5 02:27
谢谢。
https://forums.rpgmakerweb.com/i ... d-by-google.160872/

Roninator2 是我的朋友我是 BCj
作者: 愚昧jun    时间: 2023-10-15 01:29
脚本纯小白问一个蠢问题,姓名框内人物名字的文字颜色是不能改成不同的人用不同的姓名颜色,只能大伙都用同一种文字颜色吗,我试了用“\c[2]\name[主角]”的话“主角”文字颜色还是统一的颜色,用“\name[主角]\c[2]”的话虽然“主角”文字颜色能变成紫色了,但是姓名框没了。有无能即时改姓名颜色又能保留姓名框的( ゚∀。)7
作者: Leku_Advance    时间: 2023-10-15 09:16
太酷了,回来试一试
作者: BCJenbo    时间: 2024-6-23 19:20
你好鹰,
我还有 2 个问题。是否可以像这样向消息添加消息框,而不是窗口皮肤?


我想我在你的 github 上看到了一些新脚本(Pixel Movement?)是否会有演示,或者不公开发布?

我用过谷歌翻译,希望没问题!
作者: 百里_飞柳    时间: 2024-6-23 23:18
本帖最后由 百里_飞柳 于 2024-6-23 23:30 编辑
BCJenbo 发表于 2024-6-23 19:20
你好鹰,
我还有 2 个问题。是否可以像这样向消息添加消息框,而不是窗口皮肤?


第一个问题:
对话框扩展 当然支持使用自定义的背景图片,以下是设置的说明:

1. 了解相关转义符参数:
在 \win 转义符的设置区域中,找到 :bg 和 :bgo 两个参数,:bg 是用来指定所使用的背景图片的ID,:bgo 是用来指定背景图片是如何与对话框窗口对齐的。

2.  在脚本中预设:
在 INDEX_TO_WINDOW_BG 常量中,可以设置 背景图片的ID => 背景图片的名称 的Hash。
比如: INDEX_TO_WINDOW_BG[1] = "Message_BG_1"   → 意义:当 :bg 为1时,使用 Graphics/System 目录下的 Message_BG_1.png 图片

3. 使用背景图片:

第一种方法:在 WIN_PARAMS_INIT 常量中,设置 :bg => 1 ,其中 1 是在脚本中预设的背景图片的ID;设置 :bgo => 7,其中 7 代表背景图片的左上角将始终和对话框的左上角对齐(PS:依据数字小键盘位置进行设置,比如 1 代表左下角对齐,5代表中心点对齐,6代表右边界中点对齐)。

第二种方法:在显示文本中,编写转义符 \win[bg=1 bgo=7]

4. 此外,关于姓名框、脸图、对话框底部的按键提示动画都可以设置。

针对图片中的样例,可以如下编写:

在 INDEX_TO_NAME_BG 中编写姓名框的背景图片ID => 背景图片名称,并使用 \name[姓名文本|bg=1 bgo=7 dx=0 dy=24] ,让姓名框放置于对话框左上角。

使用 \face[z=-1],让脸图放置于对话框下层。

使用 \pause[do=2],让按键提示动画显示在对话框底部。

5. 特别注意:
在最新版的对话框中(>=1.11.0),加入了 S_ID_RESET_ENV 常量,当设置为 true 时,将在对话框关闭时重置全部参数,
也因此,如果你想保留以上的设置,而不是每一次编写对话文本都要写一大串转义符,可以有以下方法:

第一个方法:就如 DEMO_EagleMessageEX 中一样,新建一个脚本页,对 WIN_PARAMS_INIT 等常量进行覆盖赋值。
第二个方法:利用 \env 转义符 和 DEFAULT_ENVS 常量,将全部设置写入一个环境,随后在显示文本中读取环境。




第二个问题:
我很想正式发布这些高级功能脚本,但因为它们设置复杂度、理解难度都较大,而且一般很难兼容其他人的更知名的使用更广泛的脚本,导致我没有精力像【对话框扩展】一样去日常维护它们。

只有当我在我的个人作品中使用时,才有精力去debug。

因此我没有进行公开发布。

(PS: 像素级移动 已经在 DEMO_EagleEventEX 中了。)

当然你依然可以使用它们,如果遇到脚本本身的bug也欢迎在Github上发issue,但我不会帮忙将它们与其他人的脚本进行兼容。

作者: BCJenbo    时间: 2024-7-8 23:24
百里_飞柳 发表于 2024-6-23 23:18
第一个问题:
对话框扩展 当然支持使用自定义的背景图片,以下是设置的说明:

抱歉回复晚了,但非常感谢您!
作者: 晨风1    时间: 2024-8-6 20:55
啊...本来以为我能用的,结果发现我用了ATS Message Options,里面的指定在某个事件上显示文本跟(即et[])与这个不兼容,请问有什么解决办法吗?(大部分文本我已经用这个搭建好了)
  1. #==============================================================================
  2. #    ATS: Message Options [VXA]
  3. #    Version: 1.0.7
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: 28 January 2013
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #
  9. #    This script allows you to control a number of things about the message
  10. #   window, such as its size and position. It also provides for scrolling
  11. #   and review, and it includes the option to create a name window to identify
  12. #   the speaker (or for any other use).
  13. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  14. #  ATS Series:
  15. #
  16. #    This script is part of the Advanced Text System series of scripts. These
  17. #   scripts are based off the Advanced Text System for RMVX, but since RMVX Ace
  18. #   has a much more sensibly designed message system, it is no longer necessary
  19. #   that it be one large script. For that reason, and responding to feedback on
  20. #   the ATS, I have split the ATS into multiple different scripts so that you
  21. #   only need to pick up the components for the features that you want. It is
  22. #   therefore easier to customize and configure.
  23. #
  24. #    To find more scripts in the ATS Series, please visit:
  25. #      http://rmrk.net/index.php/topic,44525.0.html
  26. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  27. #  Instructions:
  28. #
  29. #    There are a lot of configuration options in this script, and I direct you
  30. #   to the Editable Region at line 125 for detailed comments on what each does
  31. #   Here, I will just list them:
  32. #
  33. #          :append_text                       :scrolling_on
  34. #          :scroll_speed                      :pause_before_scroll
  35. #          :scroll_by_page                    :scroll_review
  36. #          :letter_sound_on                   :letter_se
  37. #          :letters_per_se                    :random_pitch
  38. #          :start_sound_on                    :start_se
  39. #          :pause_sound_on                    :pause_se
  40. #          :terminate_sound_on                :terminate_se
  41. #          :finish_sound_on                   :finish_se
  42. #          :message_windowskin                :message_dim_bg
  43. #          :message_win_x                     :message_win_y
  44. #          :character_size_offset             :do_not_obscure
  45. #          :message_win_width                 :message_win_height
  46. #          :message_win_padding               :fit_window_to_message
  47. #          :fit_window_width_range            :fit_window_height_range
  48. #          :name_win_min_width                :name_win_padding
  49. #          :name_format                       :name_win_align
  50. #          :name_win_x                        :name_win_y
  51. #          :name_win_x_offset                 :name_win_y_offset
  52. #
  53. #    As with other ATS scripts, you can change the value of these options in
  54. #   game with the following codes in a script call:
  55. #
  56. #      ats_next(:message_option, x)
  57. #      ats_all(:message_option, x)
  58. #
  59. #   Where :message_option is the symbol you want and x is the value you want
  60. #   to change it to. ats_next will only change it for the very next message,
  61. #   while ats_all will change it for every message to follow.
  62. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  63. #  List of Special Message Codes:
  64. #
  65. #    The following is a complete list of the message codes at your disposal.
  66. #   Simply insert them into a Display Message command.
  67. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68. #  Name Box:
  69. #
  70. # \nb{text}   - Shows the namebox with text displayed.
  71. # \nbl{text}  - Shows the namebox left of the message with text displayed.
  72. # \nbr{text}  - Shows the namebox right of the message with text displayed.
  73. # \nbt{text}  - Shows the namebox above the message with text displayed.
  74. # \nbb{text}  - Shows the namebox below the message with text displayed.
  75. # \nblt{text} - Shows the namebox left and above with text displayed.
  76. # \nblb{text} - Shows the namebox left and below with text displayed.
  77. # \nbrt{text} - Shows the namebox right and above with text displayed.
  78. # \nbrb{text} - Shows the namebox right and below with text displayed.
  79. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  80. #  Message Size and Position:
  81. #
  82. # \fit   - Fits the window to this message (:paragraph_format must be false)
  83. # \e[n]  - Sets the text box in reference to character n(0 = Player; >0 = Event)
  84. # \et[n] - Sets the text box above character n (0 = Player; >0 = Event)
  85. # \eb[n] - Sets the text box below character n (0 = Player; >0 = Event)
  86. # \el[n] - Sets the text box to the left of character n(0 = Player; >0 = Event)
  87. # \er[n] - Sets the text box to the right of character n(0 = Player; >0 = Event)
  88. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  89. #  Sound Effects:
  90. #
  91. # \lse - Turns the letter by letter SE on.
  92. # /lse - Turns the letter by letter SE off.
  93. # \pse - Turns the pause SE on.
  94. # /pse - Turns the pause SE off.
  95. # \fse - Turns the finish SE on.
  96. # /fse - Turns the finish SE off.
  97. # \tse - Turns the terminate SE on.
  98. # /tse - Turns the terminate SE off.
  99. # \pSE[file,x,y] - Play the "file" SE at volume x and pitch y
  100. # \pME[file,x,y] - Play the "file" ME at volume x and pitch y
  101. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  102. #  Other Effects:
  103. #
  104. # \pANIM[x,n] - Play the animation with ID n over character x
  105. # \pBLN[x,n] - Play the balloon with ID n over character x
  106. #==============================================================================

  107. $imported = {} unless $imported
  108. $imported[:ATS_MessageOptions] = true

  109. #==============================================================================
  110. # ** Game_ATS
  111. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  112. #  Summary of Changes:
  113. #    new public instance variables - append_text; scrolling_on; scroll_speed;
  114. #      pause_before_scroll; scroll_by_page; scroll_review; letter_sound_on;
  115. #      letter_se; letters_per_se; random_pitch; start_sound_on; start_se;
  116. #      pause_sound_on; pause_se; terminate_sound_on; terminate_se;
  117. #      finish_sound_on; finish_se; message_windowskin; message_dim_bg;
  118. #      message_win_x; message_win_y; character_size_offset; do_not_obscure;
  119. #      message_win_width; message_win_height; message_win_padding;
  120. #      fit_window_to_message; fit_window_width_range; fit_window_height_range;
  121. #      name_win_min_width; name_win_padding; name_format; name_win_align;
  122. #      name_win_x; name_win_y; name_win_x_offset; name_win_y_offset
  123. #==============================================================================

  124. class Game_ATS
  125.   CONFIG ||= {}
  126.   CONFIG[:ats_message_options] = {
  127.           ats_message_options: true,
  128.     #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  129.     #  EDITABLE REGION
  130.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  131.     #  :append_text - Set this value to either true or false. If true, then any
  132.     # immediately subsequent display text event commands with the same settings
  133.     # will be joined together and they will show in the same message window if
  134.     # there is space. This option is primarily useful for message scrolling and
  135.     # oversized windows. If you are using ATS: Formatting, the value set in
  136.     # this script applies and the one set in ATS: Formatting does not.
  137.     append_text:           true,
  138.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  139.     # Scrolling
  140.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  141.     #  If :scrolling_on is false, then whenever a message ends, it will pause
  142.     # and create a new page. If :scrolling_on is true, then it will smoothly
  143.     # scroll instead, and you can choose whether to scroll line by line or
  144.     # by page. Practically, :append_text needs to be true for this feature to
  145.     # be useful.
  146.     scrolling_on:          false,
  147.       #  :scroll_speed - the pixels scrolled per frame when scrolling. If this
  148.       # is 0, then it will be instant.
  149.       scroll_speed:        2,
  150.       #  :pause_before_scroll - when this is true, the message will pause
  151.       # before the page (or line) scrolls.
  152.       pause_before_scroll: false,
  153.       #  :scroll_by_page - If this is true, then the message will scroll one
  154.       # whole page at a time. If it is false, it will scroll after each line.
  155.       scroll_by_page:      false,
  156.       #  :scroll_review - When this is true, then at each time the message
  157.       # pauses, the player can use the Up and Down directional keys to review
  158.       # the entire message
  159.       scroll_review:       true,
  160.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  161.     # Sound Effects
  162.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  163.     # Letter By Letter SE
  164.     #  :letter_sound_on - when this is true, the sound specified below will
  165.     # be played as letters are drawn, according to a chosen frequency.
  166.     letter_sound_on:       true,
  167.       #  :letter_se - This determines what sound effect is played when
  168.       # :letter_sound_on is true. You set it as an array, with the first entry
  169.       # being the filename as a string, and the other entries being integers
  170.       # representing the volume. EX: ["Cursor2", 60],
  171.       letter_se:           ["text"],
  172.       #  :letters_per_se - This determines how frequently :letter_se is played
  173.       # when :letter_sound_on is true. Basically, the number you put in the
  174.       # amount of letters that are drawn between each sound effect. If, for
  175.       # instance, it is 5, then 5 letters are drawn between playing the SE.
  176.       letters_per_se:      1,
  177.       #  :random_pitch - This range determines the pitch the sound effect is
  178.       # played at. It is in the form x...y and if x is equal to y, then the SE
  179.       # is always played at that pitch. If they are different, x must be less
  180.       # than y and each SE will play at a pitch randomly selected between the
  181.       # x and y. It is used to simulate changes of pitch in speech.
  182.       random_pitch:        80...100,
  183.     # Start SE
  184.     #  :start_sound_on - when this is true, the sound specified at :start_se
  185.     # will play whenever a message first opens.
  186.     start_sound_on:        false,
  187.       #  :start_se - This determines what sound effect is played when
  188.       # :start_sound_on is true. You set it as an array, with the first entry
  189.       # being the filename as a string, and the other entries being integers
  190.       # representing the volume and the pitch. EX: ["Chime2", 80, 50],
  191.       start_se:            ["Chime2"],
  192.     # Pause SE
  193.     #  :pause_sound_on - when this is true, the sound specified at :pause_se is
  194.     # played whenever a message pauses and waits for player input.
  195.     pause_sound_on:        false,
  196.       #  :pause_se - This determines what sound effect is played when
  197.       # :pause_sound_on is true. You set it as an array, with the first entry
  198.       # being the filename as a string, and the other entries being integers
  199.       # representing the volume and the pitch. EX: ["Decision2"],
  200.       pause_se:            ["Decision2"],
  201.     # Finish SE
  202.     #  :finish_sound_on - when this is true, the sound specified at :finish_se
  203.     # is played whenever a message finishes.
  204.     finish_sound_on:       false,
  205.       #  :finish_se - This determines what sound effect is played when
  206.       # :finish_sound_on is true. You set it as an array, with the first entry
  207.       # being the filename as a string, and the other entries being integers
  208.       # representing the volume and the pitch. EX: ["Chime1", 120],
  209.       finish_se:           ["Chime1"],
  210.     # Terminate SE
  211.     #  :terminate_sound_on - when this is true, the sound specified at
  212.     # :terminate_se is played whenever a message finishes.
  213.     terminate_sound_on:    false,
  214.       #  :terminate_se - This determines what sound effect is played when
  215.       # :terminate_sound_on is true. You set it as an array, with the first
  216.       # entry being the filename as a string, and the other entries being
  217.       # integers representing the volume and the pitch. EX: ["Cancel2"],
  218.       terminate_se:        ["Cancel2"],
  219.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  220.     # Message Window Settings
  221.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  222.     # Message Graphics
  223.     #  :message_windowskin - This sets the windowskin of the message window
  224.     # and all its related windows. The graphic chosen must be in the System
  225.     # folder of Graphics.
  226.     message_windowskin:    "Window",
  227.     #  :message_dim_bg - This feature allows you to replace the default dim
  228.     # background with an image of your choosing. Just set it to a filename. The
  229.     # graphic chosen must be in the System folder of Graphics
  230.     message_dim_bg:        "",
  231.     # Message Position
  232.     #  :message_win_x - This determines the x-coordinate of the message window.
  233.     # When set to -1, it is centred. When set to any other integer, it is
  234.     # directly set to that x-coordinate on the screen. This is completely
  235.     # overridden when you use message codes to set the message window in
  236.     # reference to a character.
  237.     message_win_x:         -1, # -1 = centred
  238.     #  :message_win_y - This determines the y-coordinate of the message window.
  239.     # When set to -1, it defaults to the position setting in the normal message
  240.     # window. When set to any other integer, it is directly set to that
  241.     # y-coordinate on the screen. This is completely overridden when you
  242.     # use message codes to set the message window in reference to a character.
  243.     message_win_y:         -1, # -1 = default to position
  244.     #  :character_size_offset - This feature is used when setting the message
  245.     # window's position in reference to a character, and it should be set to
  246.     # the size of the character (in the direction the window is being set). In
  247.     # other words, if setting a window to above or below the character, this
  248.     # should be set to the height of that character. If setting it to the left
  249.     # or right of a character, this should be set to the width of the character
  250.     character_size_offset: 64,
  251.     #  :do_not_obscure - This feature is only useful if :message_win_y is set
  252.     # to -1 and you are using the default position setting. Basically, if you
  253.     # put the ID of any character (0 is the player; otherwise the ID of the
  254.     # event you don't want to obscure) in this array, then the message window
  255.     # will be repositioned so as not to obscure that character. In other words,
  256.     # if you set this value to [0, 5], then the message window will never
  257.     # obscure either the player or the event with ID 5. So, if a message window
  258.     # is set to bottom, but drawing it at the bottom would cover the player,
  259.     # then the message window will instead be positioned to Top.
  260.     do_not_obscure:        [],
  261.     # Message Window Size
  262.     #  :message_win_width - This sets the width, in pixels, of the message
  263.     # window. It is overridden if :fit_window_to_message is true.
  264.     message_win_width:     544,
  265.     #  :message_win_height - This sets the height, in pixels, of the message
  266.     # window. A normal line of text is 24 pixels high. This value is overridden
  267.     # if :fit_window_to_message is true.
  268.     message_win_height:    120,
  269.     #  :message_win_padding - This value determines the size, in pixels, of the
  270.     # border of the message window
  271.     message_win_padding:   12,
  272.     #  :fit_window_to_message - when this is true, the message window's width
  273.     # will be fitted to the longest line and the message window's height will
  274.     # be set to include as many lines as possible. The sizes in both respects
  275.     # are limited by :fit_window_width_range and :fit_window_height_range. If
  276.     # you are using ATS: Formatting, then this feature will only work if
  277.     # :paragraph_format is off.
  278.     fit_window_to_message: true,
  279.       #  :fit_window_width_range - This is a range in the form x...y, where
  280.       # x must be less than y. x is the minimum width the window to which the
  281.       # window can be set when using :fit_window_to_message, while y is the
  282.       # maximum.
  283.       fit_window_width_range: 160...544,
  284.       #  :fit_window_height_range - This is a range in the form x...y, where
  285.       # x must be less than y. x is the minimum height the window to which the
  286.       # window can be set when using :fit_window_to_message, while y is the
  287.       # maximum.
  288.       fit_window_height_range: 72...144,
  289.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  290.     # Name Window Settings
  291.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  292.     # Name Window Size
  293.     #  :name_win_min_width - normally, the name window will be sized to fit
  294.     # whatever name is input in it. This value determines the minimum width
  295.     # that the name window can be, such that if the name is shorter, the
  296.     # name window will be set to this size.
  297.     name_win_min_width:    32,
  298.     #  :name_win_padding - this determines the size of the border of the name
  299.     # window. The default for most other windows is 12.
  300.     name_win_padding:      8,
  301.     # Name Format
  302.     #  :name_format - This allows you to set some default formatting for names.
  303.     # Basically, it is a string ('%s'), and the %s will be replaced by whatever
  304.     # name you set for the message. This allows you to use some special message
  305.     # codes for every name, without having to put it in. For instance, if you
  306.     # set this value to '\c[16]%s', then every name would automatically be set
  307.     # to colour 16.
  308.     name_format:          '%s',
  309.     #  :name_win_align - This sets the alignment of the name in the window.
  310.     # Since the window is normally sized to fit the name, this will generally
  311.     # only matter if the name is short enough to engage the :name_win_min_width
  312.     # or if there is more than one line in the name window.
  313.     name_win_align:       1,
  314.     # Name Position
  315.     #  :name_win_x - This sets the x-position of the name window. It can be set
  316.     # to either :l, :r, or an integer. If :l, it will be set flush with the left
  317.     # corners of the message window, offset by + :name_win_x_offset. If :r, it
  318.     # will be set flush with the right corners of the message window, offset
  319.     # by - :name_win_x_offset. If an integer, it will be directly set to that
  320.     # x-coordinate on the screen.
  321.     name_win_x:           :l,
  322.     #  :name_win_y - This sets the y-position of the name window. It can be set
  323.     # to either :t, :b, or an integer. If :t, it will be set flush with the top
  324.     # corners of the message window, offset by + :name_win_y_offset. If :b, it
  325.     # will be set flush with the bottom corners of the message window, offset
  326.     # by - :name_win_y_offset. If an integer, it will be directly set to that
  327.     # y-coordinate on the screen.
  328.     name_win_y:           :t,
  329.     #  :name_win_x_offset - this is the number of pixels offset when
  330.     # :name_win_x is set to :l or :r. When :l, it is added. When :r, it is
  331.     # subtracted.
  332.     name_win_x_offset:    8,
  333.     #  :name_win_y_offset - this is the number of pixels offset when
  334.     # :name_win_y is set to :t or :b. When :t, it is added. When :b, it is
  335.     # subtracted.
  336.     name_win_y_offset:    8,
  337.           #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  338.     #  END EDITABLE REGION
  339.     #////////////////////////////////////////////////////////////////////////
  340.   }
  341.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  342.   # * Public Instance Variables
  343.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  344.   CONFIG[:ats_formatting].delete(:append_text) if $imported[:ATS_Formatting]
  345.   CONFIG[:ats_message_options].keys.each { |key| attr_accessor key }
  346.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  347.   # * Overwrite SE methods
  348.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  349.   [:letter_se, :start_se, :pause_se, :finish_se, :terminate_se].each { |method_name|
  350.     define_method(:"#{method_name}=") do |*args|
  351.       instance_variable_set(:"@#{method_name}", Game_ATS.set_sound_effect(*args))
  352.     end
  353.   }
  354.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  355.   # * Set Sound Effect
  356.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  357.   def self.set_sound_effect(settings)
  358.     return settings if settings.is_a?(RPG::SE)
  359.     settings = [settings] if settings.is_a?(String)
  360.     settings[1] = 80 if !settings[1]
  361.     RPG::SE.new(*settings)
  362.   end
  363.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  364.   # * Set Random Pitch
  365.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  366.   def random_pitch=(val)
  367.     @random_pitch = val.is_a?(Integer) ? letter_se.pitch..(letter_se.pitch + val) : val
  368.   end
  369. end

  370. #==============================================================================
  371. #  Initialize Common ATS Data if no other ATS script interpreted first
  372. #==============================================================================

  373. if !$imported[:AdvancedTextSystem]
  374.   #============================================================================
  375.   # *** DataManager
  376.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  377.   #  Summary of Changes:
  378.   #    aliased method - create_game_objects; make_save_contents;
  379.   #      extract_save_contents
  380.   #============================================================================
  381.   module DataManager
  382.     class << self
  383.       alias modb_ats_crtgmobj_6yh7 create_game_objects
  384.       alias mlba_ats_mksave_5tg9 make_save_contents
  385.       alias ma_ats_extrcsvcon_8uj2 extract_save_contents
  386.     end
  387.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  388.     # * Create Game Objects
  389.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  390.     def self.create_game_objects(*args, &block)
  391.       modb_ats_crtgmobj_6yh7(*args, &block)
  392.       $game_ats = Game_ATS.new
  393.       $game_ats.init_new_installs
  394.     end
  395.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  396.     # * Make Save Contents
  397.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  398.     def self.make_save_contents(*args, &block)
  399.       contents = mlba_ats_mksave_5tg9(*args, &block)
  400.       contents[:ats] = $game_ats
  401.       contents
  402.     end
  403.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  404.     # * Extract Save Contents
  405.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  406.     def self.extract_save_contents(contents, *args, &block)
  407.       ma_ats_extrcsvcon_8uj2(contents, *args, &block)
  408.       $game_ats = contents[:ats] ? contents[:ats] : Game_ATS.new
  409.       $game_ats.init_new_installs
  410.     end
  411.   end
  412.   
  413.   #============================================================================
  414.   # ** Game_ATS
  415.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  416.   #  This class holds the default data for all scripts in the ATS series
  417.   #============================================================================
  418.   
  419.   class Game_ATS
  420.     def initialize; reset; end
  421.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  422.     # * Reset any or all installed ATS scripts
  423.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  424.     def reset(script_name = nil)
  425.       if script_name.is_a? (Symbol) # If script to reset specified
  426.         CONFIG[script_name].each_pair { |key, value|
  427.           self.send("#{key}=".to_sym, value)
  428.           $game_message.send("#{key}=".to_sym, value)
  429.         }
  430.       else                          # Reset all ATS scripts
  431.         CONFIG.keys.each { |script| reset(script) }
  432.       end
  433.     end
  434.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  435.     # * Initialize any newly installed ATS scripts
  436.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  437.     def init_new_installs
  438.       CONFIG.keys.each { |script| reset(script) unless self.send(script) }
  439.     end
  440.   end
  441.   
  442.   #============================================================================
  443.   # ** Game_Message
  444.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  445.   #  Summary of Changes:
  446.   #    aliased method - clear
  447.   #============================================================================
  448.   
  449.   class Game_Message
  450.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  451.     # * Clear
  452.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  453.     alias mlb_ats_clrats_5tv1 clear
  454.     def clear(*args, &block)
  455.       mlb_ats_clrats_5tv1(*args, &block) # Run Original Method
  456.       return if !$game_ats
  457.       Game_ATS::CONFIG.values.each { |installed|
  458.         installed.keys.each { |key| self.send("#{key}=".to_sym, $game_ats.send(key)) }
  459.       }
  460.     end
  461.   end
  462.   
  463.   #============================================================================
  464.   # ** Game_Interpreter
  465.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  466.   #  Summary of Changes:
  467.   #    new methods - ats_all; ats_next
  468.   #============================================================================
  469.   
  470.   class Game_Interpreter
  471.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  472.     # * ATS All
  473.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  474.     def ats_all(sym, *args, &block)
  475.       $game_ats.send("#{sym}=".to_sym, *args, &block)
  476.       ats_next(sym, *args, &block)
  477.     end
  478.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  479.     # * ATS Next
  480.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  481.     def ats_next(sym, *args, &block)
  482.       $game_message.send("#{sym}=".to_sym, *args, &block)
  483.     end
  484.   end
  485. $imported[:AdvancedTextSystem] = true
  486. end

  487. #==============================================================================
  488. # ** Game_Message
  489. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  490. #  Summary of Changes:
  491. #    new attr_reader methods - show_on_character_id; show_on_character_pos
  492. #    new attr_accessor methods - append_text; scrolling_on; scroll_speed;
  493. #      pause_before_scroll; scroll_by_page; scroll_review; letter_sound_on;
  494. #      letter_se; letters_per_se; random_pitch; start_sound_on; start_se;
  495. #      pause_sound_on; pause_se; terminate_sound_on; terminate_se;
  496. #      finish_sound_on; finish_se; message_windowskin; message_dim_bg;
  497. #      message_win_x; message_win_y; character_size_offset; do_not_obscure;
  498. #      message_win_width; message_win_height; message_win_padding;
  499. #      fit_window_to_message; fit_window_width_range; fit_window_height_range;
  500. #      name_win_min_width; name_win_padding; name_format; name_win_align;
  501. #      name_win_x; name_win_y; name_win_x_offset; name_win_y_offset;
  502. #      message_name
  503. #    aliased method - clear; all_text
  504. #    new methods - atsmo_play_sound?; atsmo_setup_name_window
  505. #==============================================================================

  506. class Game_Message
  507.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  508.   # * Public Instance Variables
  509.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  510.   attr_reader :message_name
  511.   attr_reader :show_on_character_id
  512.   attr_reader :show_on_character_pos
  513.   Game_ATS::CONFIG[:ats_message_options].keys.each { |key| attr_accessor key }
  514.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  515.   # * Clear
  516.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  517.   alias maatsmo_cler_2yx7 clear
  518.   def clear(*args, &block)
  519.     @show_on_character_id = -1
  520.     @show_on_character_pos = :t
  521.     @message_name = nil
  522.     tso = @terminate_sound_on # Don't reset terminate sound
  523.     maatsmo_cler_2yx7(*args, &block) # Call Original Method
  524.     @terminate_sound_on = tso unless tso.nil?
  525.   end
  526.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  527.   # SE Definitions
  528.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  529.   [:letter, :start, :pause, :finish, :terminate].each { |method_name|
  530.     define_method(:"#{method_name}_se=") do |*args|
  531.       instance_variable_set(:"@#{method_name}_se", Game_ATS.set_sound_effect(*args))
  532.     end
  533.   }
  534.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  535.   # * Play Sound?
  536.   #    type : :letter, :start, :pause, :finish, or :terminate
  537.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  538.   def atsmo_play_sound?(type)
  539.     return instance_variable_get(:"@#{type}_sound_on") &&
  540.       !instance_variable_get(:"@#{type}_se").nil?
  541.   end
  542.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  543.   # * Set Random Pitch
  544.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  545.   def random_pitch=(val)
  546.     @random_pitch = val.is_a?(Integer) ? letter_se.pitch..(letter_se.pitch + val) : val
  547.   end
  548.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  549.   # * Set Name for Name Window
  550.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  551.   def message_name=(string)
  552.     @message_name = !@name_format.empty? ? sprintf(@name_format, string) : string
  553.   end
  554.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  555.   # * All Text
  556.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  557.   alias maatsmo_altx_7jv2 all_text
  558.   def all_text(*args, &block)
  559.     result = maatsmo_altx_7jv2(*args, &block) # Call Original Method
  560.     # Look for the Name Box Code
  561.     if result[/\\NB([LRTB]*)\{(.+?)\}/im]
  562.       atsmo_setup_name_window($2, $1)
  563.       result.gsub!(/\\NB([LRTB]*)\{(.+?)\}/im, "")
  564.     end
  565.     if result[/([\\\/])FIT/i]
  566.       @fit_window_to_message = $1 == "\\"
  567.       result.gsub!(/[\\\/]FIT/i, "")
  568.     end
  569.     if result[/\\E([LRTB]?)\[(\d+)\]/i]
  570.       @show_on_character_pos = $1.downcase.to_sym if !$1.empty?
  571.       @show_on_character_id = $2.to_i
  572.       # Don't show on character if the event referenced is nil
  573.       @show_on_character_id = -1 if show_on_character_id > 0 && !$game_map.events[show_on_character_id]
  574.       result.gsub!(/\\E[LRTB]?\[\d+\]/i, "")
  575.     end
  576.     result
  577.   end
  578.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  579.   # * Set Name
  580.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  581.   def atsmo_setup_name_window(name, pos)
  582.     self.message_name = name
  583.     pos.each_char {|letter|
  584.       val = letter.downcase.to_sym
  585.       case val
  586.       when :l, :r then self.name_win_x = val
  587.       when :t, :b then self.name_win_y = val
  588.       end
  589.     }
  590.   end
  591. end

  592. #==============================================================================
  593. # ** Game_Interpreter
  594. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  595. #  Summary of Changes:
  596. #    aliased methods - command_101; next_event_code
  597. #    new method - maatsf_same_message_conditions?
  598. #==============================================================================

  599. if !$imported[:ATS_Formatting]
  600.   class Game_Interpreter
  601.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  602.     # * Display Text Message
  603.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  604.     alias maatsf_disptext_3jf5 command_101
  605.     def command_101(*args, &block)
  606.       @ats_appending_text = $game_message.append_text
  607.       maatsf_disptext_3jf5(*args, &block) # Call Original Method
  608.       @ats_appending_text = false
  609.     end
  610.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  611.     # * Next Event Code
  612.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  613.     alias maatsf_nexcode_5rq9 next_event_code
  614.     def next_event_code(*args, &block)
  615.       result = maatsf_nexcode_5rq9(*args, &block) # Call Original Method
  616.       if @ats_appending_text && result == 101
  617.         if maats_same_message_conditions?(@index + 1)
  618.           @index += 1
  619.           result = next_event_code(*args, &block)
  620.         end
  621.       end
  622.       result
  623.     end
  624.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  625.     # * Same Message Conditions?
  626.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  627.     def maats_same_message_conditions?(list_index)
  628.       n_params = @list[list_index].parameters
  629.       if ($imported[:MA_CompositeGraphics] || $imported[:ATS_FaceOptions]) &&
  630.         @list[list_index + 1] && @list[list_index + 1].parameters[0][/^\\([AP])F\[(\d+)\]/i]
  631.         param = $2.to_i
  632.         actor = ($1 == 'A') ? $game_actors[param] : $game_party.members[param - 1]
  633.         return (actor.face_name == $game_message.face_name &&
  634.           actor.face_index == $game_message.face_index &&
  635.           n_params[2] == $game_message.background && n_params[3] == $game_message.position)
  636.       end
  637.       n_params[0] == $game_message.face_name && n_params[1] == $game_message.face_index &&
  638.         n_params[2] == $game_message.background && n_params[3] == $game_message.position
  639.     end
  640.   end
  641. end

  642. unless $imported[:"MA_ParagraphFormat_1.0.1"] # Overwrite if earlier version
  643.   #============================================================================
  644.   # ** MA_Window_ParagraphFormat
  645.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  646.   #  This module inserts into Window_Base and provides a method to format the
  647.   # strings so as to go to the next line if it exceeds a set limit. This is
  648.   # designed to work with draw_text_ex, and a string formatted by this method
  649.   # should go through that, not draw_text.
  650.   #============================================================================

  651.   module MA_Window_ParagraphFormat
  652.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  653.     # * Calc Line Width
  654.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  655.     def mapf_calc_line_width(line, tw = 0, contents_dummy = false)
  656.       return tw if line.nil?
  657.       line = line.clone
  658.       unless contents_dummy
  659.         real_contents = contents # Preserve Real Contents
  660.         # Create a dummy contents
  661.         self.contents = Bitmap.new(contents_width, 24)
  662.         reset_font_settings
  663.       end
  664.       pos = {x: 0, y: 0, new_x: 0, height: calc_line_height(line)}
  665.       test = @atsf_testing
  666.       @atsf_testing = true # This
  667.       while line[/^(.*?)\e(.*)/]
  668.         tw += text_size($1).width
  669.         line = $2
  670.         # Remove all ancillaries to the code, like parameters
  671.         code = obtain_escape_code(line)
  672.         # If direct setting of x, reset tw.
  673.         tw = 0 if ($imported[:ATS_SpecialMessageCodes] && code.upcase == 'X') ||
  674.           ($imported["YEA-MessageSystem"] && code.upcase == 'PX')
  675.         #  If I need to do something special on the basis that it is testing,
  676.         # alias process_escape_character and differentiate using @atsf_testing
  677.         process_escape_character(code, line, pos)
  678.       end
  679.       @atsf_testing = test
  680.       #  Add width of remaining text, as well as the value of pos[:x] under the
  681.       # assumption that any additions to it are because the special code is
  682.       # replaced by something which requires space (like icons)
  683.       tw += text_size(line).width + pos[:x]
  684.       unless contents_dummy
  685.         contents.dispose # Dispose dummy contents
  686.         self.contents = real_contents # Restore real contents
  687.       end
  688.       return tw
  689.     end
  690.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  691.     # * Format Paragraph
  692.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  693.     def mapf_format_paragraph(text, max_width = contents_width)
  694.       text = text.clone
  695.       #  Create a Dummy Contents - I wanted to boost compatibility by using the
  696.       # default process method for escape codes. It may have the opposite effect,
  697.       # for some :(
  698.       real_contents = contents # Preserve Real Contents
  699.       self.contents = Bitmap.new(contents_width, 24)
  700.       reset_font_settings
  701.       paragraph = ""
  702.       while !text.empty?
  703.         oline, nline, tw = mapf_format_by_line(text.clone, max_width)
  704.         # Replace old line with the new one
  705.         text.sub!(/#{Regexp.escape(oline)}/m, nline)
  706.         paragraph += text.slice!(/.*?(\n|$)/)
  707.         text.lstrip!
  708.       end
  709.       contents.dispose # Dispose dummy contents
  710.       self.contents = real_contents # Restore real contents
  711.       return paragraph
  712.     end
  713.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  714.     # * Format By Line
  715.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  716.     def mapf_format_by_line(text, max_width = contents_width)
  717.       oline, nline, tw = "", "", 0
  718.       loop do
  719.         #  Format each word until reach the width limit
  720.         oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)
  721.         return oline, nline, tw if done
  722.       end
  723.     end
  724.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  725.     # * Format By Word
  726.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  727.     def mapf_format_by_word(text, line, tw, max_width)
  728.       return line, line, tw, true if text.nil? || text.empty?
  729.       # Extract next word
  730.       if text.sub!(/([ \t\r\f]*)(\S*)([\n\f]?)/, "") != nil
  731.         prespace, word, line_end = $1, $2, $3
  732.         ntw = mapf_calc_line_width(word, tw, true)
  733.         pw = contents.text_size(prespace).width
  734.         if (pw + ntw >= max_width)
  735.           # Insert
  736.           if line.empty?
  737.             # If one word takes entire line
  738.             return prespace + word, word + "\n", ntw, true
  739.           else
  740.             return line + prespace + word, line + "\n" + word, tw, true
  741.           end
  742.         else
  743.           line += prespace + word
  744.           tw = pw + ntw
  745.           # If the line is force ended, then end
  746.           return line, line, tw, true if !line_end.empty?
  747.         end
  748.       else
  749.         return line, line, tw, true
  750.       end
  751.       return line, line, tw, false
  752.     end
  753.   end

  754.   class Window_Base
  755.     include MA_Window_ParagraphFormat unless $imported[:"MA_ParagraphFormat_1.0"]
  756.   end

  757.   $imported[:"MA_ParagraphFormat_1.0"] = true
  758.   $imported[:"MA_ParagraphFormat_1.0.1"] = true
  759. end

  760. #==============================================================================
  761. # *** MA Window ATS Message Options
  762. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  763. #  This module mixes in with Window_Message and the Name window
  764. #==============================================================================

  765. module MA_Window_ATS_MessageOptions
  766.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  767.   # * Resize
  768.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  769.   def resize(w, h)
  770.     if w != self.width || h != self.height
  771.       self.width = w
  772.       self.height = h
  773.       create_contents
  774.     end
  775.   end
  776. end

  777. #==============================================================================
  778. # ** Window_ATS_Name
  779. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  780. #  This window shows a single message to identify the speaker of a message.
  781. #==============================================================================

  782. class Window_ATS_Name < Window_Base
  783.   include MA_Window_ATS_MessageOptions
  784.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  785.   # * Object Initialization
  786.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  787.   def initialize(message_window)
  788.     @message_window = message_window
  789.     super(0, 0, $game_message.name_win_min_width, line_height + standard_padding*2)
  790.     @current_windowskin = windowskin
  791.     update_placement
  792.     self.visible = false
  793.     self.z = @message_window.z + 1
  794.   end
  795.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  796.   # * Frame Update
  797.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  798.   def update(*args, &block)
  799.     super(*args, &block)
  800.     if $game_message.message_name.nil?
  801.       self.visible = false
  802.     else
  803.       self.openness = @message_window.openness
  804.       self.visible = @message_window.visible
  805.       self.opacity = @message_window.opacity
  806.       self.back_opacity = @message_window.back_opacity
  807.       set_text($game_message.message_name)
  808.     end
  809.   end
  810.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  811.   # * Update Placement
  812.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  813.   def update_placement
  814.     set_x_position
  815.     set_y_position
  816.     update_padding
  817.   end
  818.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  819.   # * Set X Position
  820.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  821.   def set_x_position
  822.     self.x = case $game_message.name_win_x
  823.     when :l then @message_window.x + $game_message.name_win_x_offset
  824.     when :r then @message_window.x + @message_window.width - self.width - $game_message.name_win_x_offset
  825.     else $game_message.name_win_x
  826.     end
  827.   end
  828.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  829.   # * Set y Position
  830.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  831.   def set_y_position
  832.     case $game_message.name_win_y
  833.     when :t
  834.       self.y = @message_window.y - self.height + $game_message.name_win_y_offset
  835.       self.y = @message_window.y + @message_window.height - $game_message.name_win_y_offset if self.y < 0
  836.     when :b
  837.       self.y = @message_window.y + @message_window.height - $game_message.name_win_y_offset
  838.       self.y = @message_window.y - self.height + $game_message.name_win_y_offset if self.y + self.height > Graphics.height
  839.     else
  840.       self.y = $game_message.name_win_y
  841.     end
  842.   end
  843.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  844.   # * Refresh
  845.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  846.   def refresh
  847.     contents.clear
  848.     align = $game_message.name_win_align
  849.     if align > 0
  850.       y = 0
  851.       for line in convert_escape_characters(@text.clone).split(/\n/)
  852.         tw = mapf_calc_line_width(line)
  853.         x = align*((contents_width - tw) / 2)
  854.         draw_text_ex(x, y, line)
  855.         y += calc_line_height(line)
  856.       end
  857.     else
  858.       draw_text_ex(0, 0, @text)
  859.     end
  860.   end
  861.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  862.   # * Set Text
  863.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  864.   def set_text(text)
  865.     if text.is_a?(String) && (@text != text || $game_message.name_win_min_width > contents.width)
  866.       @text = text
  867.       resize(*calc_window_size_by_text(text)) unless text.empty?
  868.       update_placement
  869.       refresh
  870.     end
  871.   end
  872.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  873.   # * Calculate Width and Height
  874.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  875.   def calc_window_size_by_text(text)
  876.     text = convert_escape_characters(text.clone)
  877.     # Calculate width and height of window
  878.     fit_w = $game_message.name_win_min_width
  879.     h = standard_padding*2
  880.     text.split(/\n/).each { |line|
  881.       h += calc_line_height(line)
  882.       tw = mapf_calc_line_width(line)
  883.       fit_w = tw if tw > fit_w
  884.     }
  885.     w = [fit_w + (standard_padding*2), Graphics.width].min
  886.     return w, h
  887.   end
  888.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  889.   # * Standard Padding
  890.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  891.   def standard_padding
  892.     $game_message.name_win_padding
  893.   end
  894. end

  895. #==============================================================================
  896. # ** Window_Message
  897. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  898. #  Summary of Changes:
  899. #    aliased methods - initialize; create_all_windows; update_all_windows;
  900. #      update_placement; convert_escape_characters
  901. #    new method - maatsmo_convert_escape_characters; atsmo_update_placement_x;
  902. #      atsmo_update_placement_y; atsmo_update_placement_w;
  903. #      atsmo_update_placement_h;
  904. #    overwritten method - process_new_line; standard padding;
  905. #==============================================================================

  906. class Window_Message
  907.   include MA_Window_ATS_MessageOptions
  908.   IS_ATSF_ABOVE = $imported[:ATS_Formatting] # Check if Formatting installed
  909.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  910.   # * Object Initialization
  911.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  912.   alias maatsmo_initz_2uq7 initialize
  913.   def initialize(*args, &block)
  914.     @maatsmo_lblse_char_count = 0
  915.     @scroll_review_max_oy = 0
  916.     @atsmo_all_windows = []
  917.     maatsmo_initz_2uq7(*args, &block) # Call Original Method
  918.     @atsmo_old_windowskin = self.windowskin
  919.   end
  920.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  921.   # * Create All Windows
  922.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  923.   alias maatsmo_creatalwins_2jf4 create_all_windows
  924.   def create_all_windows(*args, &block)
  925.     @atsmo_all_windows.clear
  926.     maatsmo_creatalwins_2jf4(*args, &block) # Call Original Method
  927.     @atsmo_name_window = Window_ATS_Name.new(self)
  928.     @atsmo_all_windows.push(@gold_window, @choice_window, @number_window,
  929.       @item_window, @atsmo_name_window)
  930.   end
  931.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  932.   # * Create Back Bitmap
  933.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  934.   alias maatsmo_cretebbmp_3gl5 create_back_bitmap
  935.   def create_back_bitmap(*args, &block)
  936.     @back_bitmap.dispose if @back_bitmap && !@back_bitmap.disposed?
  937.     if $game_message.message_dim_bg.empty?
  938.       maatsmo_cretebbmp_3gl5(*args, &block)
  939.     else
  940.       @back_bitmap = Bitmap.new(width, height)
  941.       bbmp = Cache.system($game_message.message_dim_bg)
  942.       @back_bitmap.stretch_blt(@back_bitmap.rect, bbmp, bbmp.rect)
  943.     end
  944.     @back_sprite.bitmap = @back_bitmap if @back_sprite
  945.     @current_bbmp = $game_message.message_dim_bg
  946.   end
  947.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  948.   # * Standard Padding
  949.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  950.   def standard_padding
  951.     $game_message.message_win_padding # Get padding
  952.   end
  953.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  954.   # * Update All Windows
  955.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  956.   alias maatsmo_updtallwin_8ih4 update_all_windows
  957.   def update_all_windows(*args, &block)
  958.     maatsmo_updtallwin_8ih4(*args, &block) # Call Original Method
  959.     @atsmo_name_window.update
  960.   end
  961.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  962.   # * Free All Windows
  963.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  964.   alias maatsmo_dispallwins_4bx9 dispose_all_windows
  965.   def dispose_all_windows(*args, &block)
  966.     maatsmo_dispallwins_4bx9(*args, &block) # Call Original Method
  967.     @atsmo_name_window.dispose
  968.   end
  969.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  970.   # * Update Windowskins
  971.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  972.   def atsmo_update_windowskin
  973.     new_wskin = Cache.system($game_message.message_windowskin)
  974.     # If windowskin is new and exists
  975.     if new_wskin != self.windowskin && new_wskin.width > 32
  976.       ([self] + @atsmo_all_windows).each { |win| win.windowskin = new_wskin }
  977.       @atsmo_name_window.set_text("") # Clear to redraw in right colour
  978.     end
  979.   end
  980.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  981.   # * Update Placement
  982.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  983.   alias maatsmo_updplacem_3yg5 update_placement
  984.   def update_placement(*args, &block)
  985.     # Resize window
  986.     resize(atsmo_update_placement_w, atsmo_update_placement_h)
  987.     # Set X Position
  988.     self.x = atsmo_update_placement_x
  989.     # Set Y Position
  990.     self.y = atsmo_update_placement_y(*args, &block) # Original Method, essentially
  991.     update_padding
  992.     @atsmo_name_window.update_placement
  993.     create_back_bitmap if @current_bbmp != $game_message.message_dim_bg
  994.   end
  995.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  996.   # * Update X Position
  997.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  998.   def atsmo_update_placement_x
  999.     # Show on Character
  1000.     return show_on_character_x if $game_message.show_on_character_id >= 0
  1001.     # If not showing on character
  1002.     return $game_message.message_win_x == -1 ? # Centre or else direct set
  1003.       (Graphics.width - self.width) / 2 : $game_message.message_win_x
  1004.   end
  1005.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1006.   # * Update X in reference to character
  1007.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1008.   def show_on_character_x
  1009.     character = atsmo_get_character($game_message.show_on_character_id)
  1010.     x = case $game_message.show_on_character_pos
  1011.     when :t, :b then character.screen_x - (self.width / 2)
  1012.     when :l then character.screen_x - self.width - ($game_message.character_size_offset / 2)
  1013.     when :r then character.screen_x + ($game_message.character_size_offset / 2)
  1014.     else character.screen_x
  1015.     end
  1016.     [[x, Graphics.width - self.width].min, 0].max
  1017.   end
  1018.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1019.   # * Update Y Position
  1020.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1021.   def atsmo_update_placement_y(*args, &block)
  1022.     # Show on Character
  1023.     return show_on_character_y if $game_message.show_on_character_id >= 0
  1024.     # If not showing on a character
  1025.     if $game_message.message_win_y == -1
  1026.       do_not_obscure_characters unless $game_message.do_not_obscure.empty?
  1027.       maatsmo_updplacem_3yg5(*args, &block) # Call Original Method
  1028.       return self.y
  1029.     else
  1030.       @gold_window.y = $game_message.message_win_y > @gold_window.height ? 0 :
  1031.         Graphics.height - @gold_window.height
  1032.       return $game_message.message_win_y
  1033.     end
  1034.   end
  1035.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1036.   # * Update Y in reference to character
  1037.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1038.   def show_on_character_y
  1039.     character = atsmo_get_character($game_message.show_on_character_id)
  1040.     y = case $game_message.show_on_character_pos
  1041.     when :l, :r then character.screen_y - (($game_message.character_size_offset + self.height) / 2)
  1042.     when :t then character.screen_y - $game_message.character_size_offset - self.height
  1043.     when :b then character.screen_y
  1044.     end
  1045.     [[y, Graphics.height - self.height].min, 0].max
  1046.   end
  1047.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1048.   # * Update Message Window Width
  1049.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1050.   def atsmo_update_placement_w
  1051.     $game_message.message_win_width == -1 ? Graphics.width : $game_message.message_win_width
  1052.   end
  1053.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1054.   # * Update Message Window Height
  1055.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1056.   def atsmo_update_placement_h
  1057.     $game_message.message_win_height
  1058.   end
  1059.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1060.   # * Do Not Obstruct Characters
  1061.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1062.   def do_not_obscure_characters
  1063.     obscured = [0, 0, 0]
  1064.     positions = [2, 0, 1]
  1065.     positions.unshift(positions.delete($game_message.position))
  1066.     chosen_pos = positions[0]
  1067.     positions.each { |pos|
  1068.       y = ((Graphics.height - self.height) / 2)*pos
  1069.       range1 = y..(y + self.height)
  1070.       $game_message.do_not_obscure.each { |id|
  1071.         char = atsmo_get_character(id)
  1072.         next if char.nil?
  1073.         range2 = (char.screen_y - $game_message.character_size_offset)..char.screen_y
  1074.         obscured[pos] += 1 if range1 === range2.first || range2 === range1.first
  1075.       }
  1076.       chosen_pos = pos if obscured[pos] < obscured[chosen_pos]
  1077.     }
  1078.     $game_message.position = chosen_pos
  1079.   end
  1080.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1081.   # * Get Character
  1082.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1083.   def atsmo_get_character(id)
  1084.     id == 0 ? $game_player : $game_map.events[id]
  1085.   end
  1086.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1087.   # * Process All Text
  1088.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1089.   alias maatsmo_procsalltx_6fw2 process_all_text
  1090.   def process_all_text(*args, &block)
  1091.     # Play Start SE
  1092.     $game_message.start_se.play if $game_message.atsmo_play_sound?(:start)
  1093.     fit_window_to_message(convert_escape_characters($game_message.all_text.dup))
  1094.     atsmo_update_windowskin
  1095.     update_placement
  1096.     maatsmo_procsalltx_6fw2(*args, &block) # Call Original Method
  1097.     # Play Finish SE
  1098.     $game_message.finish_se.play if $game_message.atsmo_play_sound?(:finish)
  1099.   end
  1100.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1101.   # * Input Processing
  1102.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1103.   alias maatsmo_proceinpt_3rf6 process_input
  1104.   def process_input(*args, &block)
  1105.     # Don't play Pause Sound if Finish Sound played
  1106.     $game_message.pause_sound_on = false if $game_message.atsmo_play_sound?(:finish)
  1107.     maatsmo_proceinpt_3rf6(*args, &block)
  1108.   end
  1109.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1110.   # * Close Window and Wait for It to Fully Close
  1111.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1112.   alias maatsmo_closewat_4dr9 close_and_wait
  1113.   def close_and_wait(*args, &block)
  1114.     # Play Terminate SE
  1115.     $game_message.terminate_se.play if $game_message.atsmo_play_sound?(:terminate)
  1116.     $game_message.terminate_sound_on = $game_ats.terminate_sound_on
  1117.     maatsmo_closewat_4dr9(*args, &block) # Call Original Method
  1118.   end
  1119.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1120.   # * New Page
  1121.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1122.   alias maatsmo_newpge_3rj8 new_page
  1123.   def new_page(*args, &block)
  1124.     # Reset Contents size
  1125.     create_contents if contents.height > contents_height
  1126.     self.oy = 0
  1127.     maatsmo_newpge_3rj8(*args, &block) # Call Original Method
  1128.   end
  1129.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1130.   # * Convert Escape Characters
  1131.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1132.   if instance_methods(false).include?(:convert_escape_characters)
  1133.     # If convert_escape_characters already defined in Window_Message, just alias
  1134.     alias maatsmo_cnvrscchrc_7yc3 convert_escape_characters
  1135.     def convert_escape_characters(*args, &block)
  1136.       maatsmo_convert_escape_characters(maatsmo_cnvrscchrc_7yc3(*args, &block))
  1137.     end
  1138.   else
  1139.     # If convert_escape_characters undefined in Window_Message, call super method
  1140.     def convert_escape_characters(*args, &block)
  1141.       maatsmo_convert_escape_characters(super(*args, &block))
  1142.     end
  1143.   end
  1144.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1145.   # * ATS MO Convert Escape Characters
  1146.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1147.   def maatsmo_convert_escape_characters(text)
  1148.     # Sound Effects
  1149.     text.gsub!(/\eP_?([MS]E)\[\s*\"?([^\",\]]+)\"?(.*?)\]/i) { "\ePLAYSOUND\[#{$1.upcase},\"#{$2}\"#{$3.gsub(/ /, "")}\]" }
  1150.     text.gsub!(/\eP_?(ANIM|BLN)\[\s*(\d+)[\s,:;]*(\d+)\s*\]/i) { "\eANIMATION\[#{$1.upcase == "ANIM" ? 0 : 1},#{$2},#{$3}\]" }
  1151.     letter_ary = ["L", "P", "F", "T"]
  1152.     # Turn Sound Effects on or off
  1153.     text.gsub!(/([\e\/])([LPFT])SE/i) {
  1154.       num = ($1 == "\e" ? 0 : 1) + (2*letter_ary.index($2.upcase))
  1155.       "\eATSMOSE\[#{num}\]" }
  1156.     return text
  1157.   end
  1158.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1159.   # * Process Escape Character
  1160.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1161.   alias maatasmo_procescchar_2ia4 process_escape_character
  1162.   def process_escape_character(code, text, *args, &block) # (code, text, pos)
  1163.     case code.upcase
  1164.     when 'ATSMOSE'
  1165.       param = obtain_escape_param(text)
  1166.       return if @atsf_testing
  1167.       case param / 2
  1168.       when 0 then $game_message.letter_sound_on = (param == 0)    # Letter Sound
  1169.       when 1 then $game_message.pause_sound_on = (param == 2)     # Pause Sound
  1170.       when 2 then $game_message.finish_sound_on = (param == 4)    # Finish Sound
  1171.       when 3 then $game_message.terminate_sound_on = (param == 6) # Terminate Sound
  1172.       end
  1173.     when 'PLAYSOUND'
  1174.       return unless text.slice!(/^\[([MS]E),\"(.+?)\",?(\d*),?(\d*)\]/i)
  1175.       return if @atsf_testing
  1176.       RPG.const_get($1.to_sym).new($2, $3.empty? ? 80 : $3.to_i, $4.empty? ? 100 : $4.to_i).play
  1177.     when 'ANIMATION'
  1178.       return unless text.slice!(/^\[(\d+),(\d+),(\d+)\]/)
  1179.       return if @atsf_testing
  1180.       character = atsmo_get_character($2.to_i)
  1181.       if character
  1182.         case $1.to_i
  1183.         when 0 then character.animation_id = $3.to_i
  1184.         when 1 then character.balloon_id = $3.to_i
  1185.         end
  1186.       end
  1187.     else
  1188.       maatasmo_procescchar_2ia4(code, text, *args, &block) # Run Original Method
  1189.     end
  1190.   end
  1191.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1192.   # * Process Normal Character
  1193.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1194.   alias maatsmo_prcssnrmlch_3kz8 process_normal_character
  1195.   def process_normal_character(c, pos, *args, &block)
  1196.     maatsmo_prcssnrmlch_3kz8(c, pos, *args, &block) # Call Original Method
  1197.     # Play SE if not showing fast and the letter sound is on
  1198.     maatsmo_play_letter_by_letter_se if $game_message.atsmo_play_sound?(:letter) &&
  1199.       !@show_fast && !@line_show_fast
  1200.   end
  1201.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1202.   # * New Line Character Processing
  1203.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1204.   alias maatsmo_procnewlin_3jd8 process_new_line
  1205.   def process_new_line(text, pos, *args)
  1206.     if $game_message.scrolling_on # If using scrolling
  1207.       @line_show_fast = false
  1208.       super
  1209.       if $imported[:ATS_Formatting] && IS_ATSF_ABOVE
  1210.         maatsf_paragraph_new_line(method(:maatsmo_process_new_line_scroll), text, pos)
  1211.       else
  1212.         maatsmo_process_new_line_scroll(text, pos)
  1213.       end
  1214.     else # Not using scrolling, so no need to interfere with this method
  1215.       maatsmo_procnewlin_3jd8(text, pos, *args) # Call Original Method
  1216.     end
  1217.   end
  1218.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1219.   # * New Line Character Processing when scrolling
  1220.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1221.   def maatsmo_process_new_line_scroll(text, pos)
  1222.     if need_new_page?(text, pos)
  1223.       # Only pause if demanded
  1224.       input_pause if $game_message.pause_before_scroll && !@pause_skip
  1225.       scroll_h = !$game_message.scroll_by_page ? pos[:y] + pos[:height] : # Line
  1226.         contents.height + (pos[:y] - self.oy) # Page
  1227.       atsmo_scroll_page(text, pos, scroll_h)
  1228.       @show_fast = false # Don't speed through entire message
  1229.     end
  1230.   end
  1231.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1232.   # * Wait / Wait for One Character / Process Input
  1233.   #``````````````````````````````````````````````````````````````````````````
  1234.   # Do not permit these to run when testing
  1235.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1236.   [:wait, :wait_for_one_character].each { |meth|
  1237.     alias_method(:"maatsmo_#{meth}_6hb1", meth)
  1238.     define_method(meth) do |*args|
  1239.       send(:"maatsmo_#{meth}_6hb1", *args) unless @atsf_testing
  1240.     end
  1241.   }
  1242.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1243.   # * Input Pause
  1244.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1245.   alias maatsmo_inppuse_3kx5 input_pause
  1246.   def input_pause(*args, &block)
  1247.     return if @atsf_testing
  1248.     # Play Pause SE
  1249.     $game_message.pause_se.play if $game_message.atsmo_play_sound?(:pause) # Play
  1250.     if $game_message.scroll_review && self.oy > 0
  1251.       # If scroll review, need to overwrite this method
  1252.       self.pause = true
  1253.       wait(10)
  1254.       @scroll_review_max_oy = contents.height - contents_height
  1255.       until Input.trigger?(:B) || Input.trigger?(:C)
  1256.         update_scroll_review
  1257.         Fiber.yield
  1258.       end
  1259.       self.oy = @scroll_review_max_oy
  1260.       Input.update
  1261.       self.pause = false
  1262.     else
  1263.       maatsmo_inppuse_3kx5(*args, &block) # Call Original Method
  1264.     end
  1265.   end
  1266.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1267.   # * Play Letter By Letter SE
  1268.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1269.   def maatsmo_play_letter_by_letter_se
  1270.     # If drawn enough letters to play the SE
  1271.     if @maatsmo_lblse_char_count >= $game_message.letters_per_se
  1272.       @maatsmo_lblse_char_count = 0
  1273.       $game_message.letter_se.pitch = $game_message.random_pitch.first
  1274.       unless $game_message.random_pitch.first >= $game_message.random_pitch.last
  1275.         # Randomize pitch
  1276.         $game_message.letter_se.pitch += rand($game_message.random_pitch.last - $game_message.random_pitch.first)
  1277.       end
  1278.       $game_message.letter_se.play # Play Letter by Letter SE
  1279.     else
  1280.       @maatsmo_lblse_char_count += 1 # Advance character count
  1281.     end
  1282.   end
  1283.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1284.   # * Resize Contents
  1285.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1286.   def resize_contents(w, h)
  1287.     bmp = contents # Save old contents
  1288.     self.contents = Bitmap.new(w, h)
  1289.     self.contents.font = bmp.font.dup
  1290.     self.contents.blt(0, 0, bmp, bmp.rect) # Draw old contents onto new
  1291.     bmp.dispose
  1292.   end
  1293.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1294.   # * Fit Window to Message
  1295.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1296.   def fit_window_to_message(text)
  1297.     # Fit window to message if longes
  1298.     if !($imported[:ATS_Formatting] && $game_message.paragraph_format) &&
  1299.       $game_message.fit_window_to_message
  1300.       w, h = 0, 0
  1301.       for line in text.split(/[\n\r]+/)
  1302.         lw = mapf_calc_line_width(line) + new_line_x
  1303.         w = lw if lw > w
  1304.         h += calc_line_height(line)
  1305.       end
  1306.       $game_message.message_win_width = [$game_message.fit_window_width_range.last,
  1307.         [w + (standard_padding*2), $game_message.fit_window_width_range.first].max].min
  1308.       $game_message.message_win_height = [$game_message.fit_window_height_range.last,
  1309.         [h + (standard_padding*2), $game_message.fit_window_height_range.first].max].min
  1310.     end
  1311.   end
  1312.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1313.   # * Scroll to Next Line
  1314.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1315.   def atsmo_scroll_page(text, pos, height)
  1316.     resize_contents(contents.width, height)
  1317.     goal_oy = contents.height - contents_height
  1318.     if $game_message.scroll_speed <= 0
  1319.       self.oy = goal_oy # Instant scroll
  1320.     else
  1321.       until self.oy == goal_oy # Scroll until goal reached
  1322.         self.oy += [$game_message.scroll_speed, goal_oy - self.oy].min
  1323.         Fiber.yield
  1324.       end
  1325.     end
  1326.   end
  1327.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1328.   # * Update Scroll Review
  1329.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1330.   def update_scroll_review
  1331.     if Input.press?(:UP)
  1332.       self.oy -= [4, self.oy].min
  1333.     elsif Input.press?(:DOWN) # self.oy = contents.height - contents_height
  1334.       self.oy += [4, @scroll_review_max_oy - self.oy].min
  1335.     end
  1336.   end
  1337. end

  1338. #==============================================================================
  1339. # ** Window_ChoiceList
  1340. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1341. #  Summary of Changes:
  1342. #    aliased method - update_placement
  1343. #==============================================================================

  1344. class Window_ChoiceList
  1345.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1346.   # * Update Window Position
  1347.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1348.   alias maatsmo_updplace_3ib6 update_placement
  1349.   def update_placement(*args, &block)
  1350.     maatsmo_updplace_3ib6(*args, &block) # Call original method
  1351.     if !$imported[:ATS_AdvancedChoices]
  1352.       self.x = @message_window.x
  1353.       self.x += @message_window.width - self.width unless $game_message.name_win_x == :r
  1354.     end
  1355.   end
  1356. end
复制代码


作者: 晨风1    时间: 2024-8-15 22:40
请问一下,我画了很多对话框皮肤,想在游戏的不同进度下切换,怎么用这个做呢()
作者: 晨风1    时间: 2024-8-17 20:21
本帖最后由 晨风1 于 2024-8-17 20:22 编辑
晨风1 发表于 2024-8-15 22:40
请问一下,我画了很多对话框皮肤,想在游戏的不同进度下切换,怎么用这个做呢() ...


反馈一下,当在战斗里用pop的时候,如果pop对话上还有其他的指令,比如强制战斗指令,对话框会消失变成透明的..?这算是bug么
作者: 晨风1    时间: 2024-8-17 23:26
本帖最后由 晨风1 于 2024-8-17 23:27 编辑

对话框不显示,目前我就测出来一个当对话上方有强制战斗指令的时候对话框不显示,整个都是透明的(就跟暗色背景一样),但文字是正常的。应该还有别的触发方式但是我没测出来()
作者: 晨风1    时间: 2024-8-17 23:51
好的,感谢
作者: 小伊Yuki    时间: 2024-8-20 19:02
您好,请问在运用您的对话框后,选择光标怎么样才可以保持默认对话框下的样子?【光标依然保持正中心最下方位置】
以及如果可以的话,启用扩展后对话框出现能不能自定义成淡入淡出形式?最后感谢您的脚本!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1