设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 46308|回复: 149
打印 上一主题 下一主题

[原创发布] 【老鹰的RGSS3脚本小巢】对话框扩展(9.6英语版)

[复制链接]

Lv6.析梦学徒

老鹰

梦石
40
星屑
34435
在线时间
6702 小时
注册时间
2012-5-26
帖子
3246

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

跳转到指定楼层
1
发表于 2019-3-30 15:04:55 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 百里_飞柳 于 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也可以一起随其他对话框同时使用了。

评分

参与人数 37星屑 +1000 +37 收起 理由
夜久优奈 + 1 精品文章
hamiya + 1 哇塞好强挖!
D_Lohy + 1 I got it!
老白窗晗 + 1 太强了!
刘呱 + 1 棒啊!
bronya + 1 精品文章
ac97428 + 1 精品文章
AhsleaXron + 1 精品文章
越前リョーマ + 1 gif很生动
言言UwU + 1 精品文章

查看全部评分

Lv1.梦旅人

梦石
0
星屑
198
在线时间
14 小时
注册时间
2022-12-22
帖子
19
54
发表于 4 天前 | 只看该作者
我又来反馈上次那个战斗中对话框皮肤消失的bug啦...
战斗脚本使用的是Yea的Battle engine.
第零回合,也就是战斗开始时对话框是正常的.
具体触发方式是第0回合过后所设置的所有对话,对话框都会消失.变为透明.
(目前测出的触发方式是这个)

点评

粗暴修复了,删去默认战斗中的这个设置,让对话框开启时不关闭状态栏就好,反正我的对话框也可以任意调整位置,一般不会盖住状态栏了()  发表于 4 天前
发现问题,是和默认战斗有冲突,默认战斗对话框打开前会关闭状态栏、对话框openness设0,但我的对话框没有open动作了,所以背景无了  发表于 4 天前
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
732
在线时间
87 小时
注册时间
2019-8-20
帖子
6
53
发表于 2024-8-20 19:02:07 | 只看该作者
您好,请问在运用您的对话框后,选择光标怎么样才可以保持默认对话框下的样子?【光标依然保持正中心最下方位置】
以及如果可以的话,启用扩展后对话框出现能不能自定义成淡入淡出形式?最后感谢您的脚本!

点评

非常感谢!问题解决了。  发表于 2024-8-20 22:33
第二个找 func 转义符 里面的open 和close 可以设置对话框打开和关闭的效果,你可以自己改成其它效果试试看  发表于 2024-8-20 21:44
可以的,请找到pause转义符的注释,将里面的位置从0(文字末尾)改成2(对话框底部),还可以设置dx和dy来进行坐标偏移  发表于 2024-8-20 21:42
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
198
在线时间
14 小时
注册时间
2022-12-22
帖子
19
52
发表于 2024-8-17 23:51:15 | 只看该作者
好的,感谢

点评

如果新版本还遇到同样的问题,最好能写下对话文本里用了哪些转义符,是什么时机出现的对话背景消失  发表于 2024-8-17 23:54
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
198
在线时间
14 小时
注册时间
2022-12-22
帖子
19
51
发表于 2024-8-17 23:26:27 | 只看该作者
本帖最后由 晨风1 于 2024-8-17 23:27 编辑

对话框不显示,目前我就测出来一个当对话上方有强制战斗指令的时候对话框不显示,整个都是透明的(就跟暗色背景一样),但文字是正常的。应该还有别的触发方式但是我没测出来()

点评

请先确保是1.11.9,因为之前修复过窗口背景消失的bug;又如果是默认战斗系统,我方角色是没有屏幕坐标的,所以pop[-1]时就会显示在左上角看不见  发表于 2024-8-17 23:40
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
198
在线时间
14 小时
注册时间
2022-12-22
帖子
19
50
发表于 2024-8-17 20:21:14 | 只看该作者
本帖最后由 晨风1 于 2024-8-17 20:22 编辑
晨风1 发表于 2024-8-15 22:40
请问一下,我画了很多对话框皮肤,想在游戏的不同进度下切换,怎么用这个做呢() ...


反馈一下,当在战斗里用pop的时候,如果pop对话上还有其他的指令,比如强制战斗指令,对话框会消失变成透明的..?这算是bug么

点评

具体是什么时机消失的,是默认战斗系统里吗?是对话框不显示还是我方角色状态栏不显示  发表于 2024-8-17 23:24
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
198
在线时间
14 小时
注册时间
2022-12-22
帖子
19
49
发表于 2024-8-15 22:40:10 | 只看该作者
请问一下,我画了很多对话框皮肤,想在游戏的不同进度下切换,怎么用这个做呢()

点评

具体看 \win 转义符的注释和设置,里面的:skin 可以指定当前对话框的窗口皮肤的序号,序号到图片的对应设置是在下面一点的常量里,默认 0 => Window  发表于 2024-8-16 19:05
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
198
在线时间
14 小时
注册时间
2022-12-22
帖子
19
48
发表于 2024-8-6 20:55:48 | 只看该作者
啊...本来以为我能用的,结果发现我用了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
复制代码

点评

你在我的脚本开头 【兼容模式】里的false 改成 true,然后按注释里写的来切换所用的对话框  发表于 2024-8-6 22:25
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
657
在线时间
47 小时
注册时间
2022-2-6
帖子
18
47
发表于 2024-7-8 23:24:55 | 只看该作者
百里_飞柳 发表于 2024-6-23 23:18
第一个问题:
对话框扩展 当然支持使用自定义的背景图片,以下是设置的说明:

抱歉回复晚了,但非常感谢您!
回复 支持 反对

使用道具 举报

Lv6.析梦学徒

老鹰

梦石
40
星屑
34435
在线时间
6702 小时
注册时间
2012-5-26
帖子
3246

极短24评委极短23参与极短22参与极短21评委老司机慢点开短篇十吟唱者组别冠军开拓者剧作品鉴家

46
 楼主| 发表于 2024-6-23 23:18:09 | 只看该作者
本帖最后由 百里_飞柳 于 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,但我不会帮忙将它们与其他人的脚本进行兼容。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-20 22:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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