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

Project1

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

[已经过期] 加强对话框 与 多选项脚本 冲突

[复制链接]

Lv1.梦旅人

梦石
0
星屑
147
在线时间
141 小时
注册时间
2011-6-1
帖子
343
跳转到指定楼层
1
发表于 2017-7-19 13:01:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 乐之魂 于 2017-7-20 19:25 编辑

对话框用的是最新的对话框加强脚本,会与搜索道的多选项脚本 有冲突,就是第5项起不显示,而且有效的选项只有1和2项。求助

RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #------------------------------------------------------------------------------
  4. # 原版:趙雲
  5. # 重制:RyanBern  2015.08.24
  6. #------------------------------------------------------------------------------
  7. # 更新记录:
  8. #     2015.09.06    少许BUG修复,附加战斗场景对话效果
  9. #     2015.11.05    修复临时更改字号功能
  10. #     2015.11.13    增加更改姓名颜色的功能,修复显示 BUG
  11. #     2016.01.19    增加大型半身像对话框设置,快捷方式设置,高级快捷方式设置
  12. #     2016.05.10    增加对话框开关,打开指定开关时暂时屏蔽本对话加强窗口
  13. #                   增加\f[头像]的功能,可以显示正方形的说话者头像
  14. #     2016.08.26    简化代码,增加自动对话功能,高速跳过对话功能
  15. #     2016.11.05    增加自动调节文字位置的功能,当对话框太靠近屏幕上方或者下方
  16. #                   时,脚本会更换成另外一个显示的方向。
  17. #     2017.01.11    增加连行功能和兼容 VA 的头像组功能
  18. #==============================================================================
  19.  
  20. #——说明
  21.  
  22. # 使用时,要在Graphics文件夹下新建一个名为Faces的文件夹,用于存储头像
  23. # 对话框的窗口素材可不必和系统窗口相同,请将对话框窗口素材放到
  24. # Graphics/Windowskins文件夹下,并附上两个气泡箭头素材,用于指向说话者,
  25. # 命名规则为“对话框窗口素材名-top”和“对话框窗口素材名-under”
  26. # 然后在本脚本的设置区域修改。
  27.  
  28. # 默认为一个字一个字的方式,如果需要一次全部显示,
  29. # 请打开特定开关(默认为 21 号)
  30.  
  31. # 打开开关(默认为 22 号)后,对话时按下[空格键]可以瞬间显示全部对话。
  32.  
  33. # 打卡开关(默认为 23 号)后,屏蔽加强对话框,将使用 XP 默认对话框。
  34.  
  35. # 打开开关(默认为 24 号)后,对话框可以在对话显示完毕后自动消失,适合制作
  36. # 场景 CG,需要进行选择或数字输入的情况不会自动消失。此外在文本框中使用\t[数字]
  37. # 也可达到相似效果,不过作用范围仅限本次对话框。
  38.  
  39. # 打开开关(默认为 25 号)后,按下 CTRL 键可以快速跳过对话,需要进行选择或者数字
  40. # 输入的情况不会跳过。
  41.  
  42. # 打开开关(默认为 26 号)后,对话框的位置会自动调节,使其不会遮挡说话者
  43. # 默认对话字没有声音,如果需要声音,
  44. # 请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  45. # 我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音
  46.  
  47. # 其他在对话中可以使用的功能:
  48.  
  49. # \n[1]:显示1号角色的姓名
  50.  
  51. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  52. # \nc[0-7]:更改姓名框颜色
  53.  
  54. # 非战斗时,\p功能可以自动调整对话框位置
  55. # \p[1] :对话框出现在1号事件的上方
  56. # \p[0] :主人公上方出现对话框
  57. # \p[-1]:对话框出现在屏幕下方,这种特殊类型的对话框在有大型半身像时使用
  58. #——————————————————使用\p功能后可以自动调整对话框大小
  59. # 使用\p功能后,使用事件指令[更改文章选项]可更改对话框的位置
  60. #   [上] :对话框出现在说话者上方
  61. #   [下] :对话框出现在说话者下方
  62. #   [中] :对话框出现在屏幕正中
  63. # 战斗时,\p功能有所变化
  64. # \p[1]:对话框出现在ID为1的角色战斗图附近(这个角色必须是队伍中的成员)
  65. # \p[1001]:对话框出现在Index为1的敌人战斗图附近--也就是说敌人的位置从
  66. #           1001开始算起,1002则是代表Index为2的敌人。
  67. # 战斗时使用\p指令+[更改文章选项]依然是有效的,但是如果不使用\p指令,那么
  68. # 对话框则会一直出现在屏幕正上方。
  69.  
  70. # \\:显示"\"这个符号
  71.  
  72. # \v[1] :显示变量1
  73.  
  74. # \v[a1] :显示防具1
  75.  
  76. # \v[w1] :显示武器1
  77.  
  78. # \v[i1] :显示物品1
  79.  
  80. # \v[s1] :显示特技1
  81.  
  82. # \ic[001-Weapon01] : 显示图标"001-Weapon01.png"
  83.  
  84. # \c[0-7]:更改颜色
  85.  
  86. # \g:显示金钱窗口
  87.  
  88. # \a[SE文件名]:对话的时候播放SE
  89.  
  90. # \s[1-19]:更改弹字的速度
  91.  
  92. # \.   :停顿一刹那(1、2帧)
  93. # \|   :停顿片刻(20帧)
  94.  
  95. # \>   :文字不用打字方式
  96. # \<   :文字使用打字方式
  97.  
  98. # \!   :等待玩家按回车再继续
  99. # \~   :文字直接消失
  100.  
  101. # \I   :下一行从这个位置开始
  102.  
  103. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  104.  
  105. # \h[12]:改用12号字
  106.  
  107. # \b[50]:空50象素
  108.  
  109. # \t[20]:对话显示完毕后等待 20 帧自动消失
  110.  
  111. # \L[001]:在左边显示半身像"Graphics/Faces/001.png",并左右镜像反转
  112. # \R[001]:在右边显示半身像"Graphics/Faces/001.png"
  113. # \f[001]:在左边显示正方形头像"Graphics/Faces/001.png"
  114. # 注:不推荐同时使用显示半身像的功能和显示头像的功能。显示的头像图片大小
  115. #     不得超过 120x120,如果图片超过这个大小,图片将会被放缩
  116. # \gf[001, 0]:在左边显示正方形头像组"Graphics/Faces/001.png"的第一个
  117. # 注:头像组排序方式默认如下(先数第一行,再数第二行,可调节每行的头像个数)
  118. #  -----------------
  119. #  | 0 | 1 | 2 | 3 |
  120. #  -----------------
  121. #  | 4 | 5 | 6 | 7 |
  122. #  -----------------
  123.  
  124. # \+:必须放在每一行的末尾,表示连行,它将合并下一个【显示文章】指令(需要
  125. #     在下面的设置区域调节 Max_Lines 以保证文字能正常显示出来)
  126.  
  127. #==============================================================================
  128. # 设置区域(其他参数的调节请看这里)
  129. #==============================================================================
  130. module RB
  131. end
  132. module RB::Mes_Config
  133.   # 打开 XX 号开关后,关闭打字效果
  134.   No_Typing = 21
  135.   # 打开 XX 号开关后,按下[空格键]可以瞬间显示全部文字
  136.   Write_Skip = 22
  137.   # 打开 XX 号开关后,屏蔽加强对话框(使用默认对话框)
  138.   Mes_Disabled = 23
  139.   # 主角名字字符缩写
  140.   Regex_Player_Name = /pn(\d+)/
  141.   # 主角姓名框底色(RGBA)
  142.   Name_Bar_Color = Color.new(120, 180, 250, 80)
  143.   # 字体大小
  144.   Size = 18
  145.   # 对话框窗口皮肤(不写为和系统皮肤相同)
  146.   Mes_Windowskin = "001-Blue01"
  147. #######  Mes_Windowskin = "001-Blue011"
  148.   # 最大行数(初值为 4,尽量不要修改,如果考虑合并选择项和连行,可以设置为 6 以上)
  149.   # 此最大行数仅在 \p 指令下有效,如果不使用 \p 指令那么对话框还是 4 行的高度
  150.   Max_Lines = 8
  151.   # 画面宽度和高度(width / height)
  152.   # 此设置一般不需要更改,当使用分辨率扩张脚本时,将如下的值改成你游戏的分辨率即可。
  153.   #Graphics_Width = 640
  154.   Graphics_Width = 590
  155. # Graphics_Height = 480
  156.   Graphics_Height = 446
  157.   # 打开 XX 号开关后,对话自动结束(不用按下 C 键)
  158.   Auto_Terminate = 24
  159.   # 打开 XX 号开关后,按下 CTRL 可以高速跳过对话
  160.   Text_Skip_Fast = 25
  161.   # 打开 XX 号开关后,自动调节对话框使其不会挡住说话者
  162.   Auto_Adjust_Mes_Pos = 26
  163.   # 对话自动结束延迟(单位:帧)
  164.   Auto_Terminate_Frame = 10
  165.   # 头像组:横向单元数
  166.   Face_Group_W = 4
  167.   # 头像组:纵向单元数
  168.   Face_Group_H = 2  
  169.   # 默认姓名文字颜色(和系统默认编号一致)
  170.   Name_Color_Default = 6
  171.   # 快捷指令,定义后,可以直接在文本框中输入快捷指令
  172.   # 定义方式为 快捷指令 => 完整指令 ,使用方式为 \sc[快捷指令]
  173.   # 注意,指令中通常包含反斜线'\',因此需要使用单引号的字符串,
  174.   # 或者用"\\"进行转义。下面是一个例子:
  175.   # 这样定义后,输入\sc[pn1]就等效为 \name[pn1]\r[L1]\p[-1]
  176.   Shortcuts = {
  177.     #'pn1' => '\name[pn1]\r[L1]\p[-1]'
  178.   }
  179.   # 高级快捷指令定义,类似于宏展开,需要借助正则表达式(高级用户使用)
  180.   Shortcuts_Regexp = {
  181.     /\\pn1/ => '\name[pn1]\r[L1]\p[-1]',
  182.     /\\[Rr]ed\[(.*?)\]/m => '\c[2]\1\c[0]',
  183.     /\\[Cc]ol\[(\d+)\]\{(.*?)\}/m => '\c[\1]\2\c[0]',
  184.   }
  185. end
  186. #==============================================================================
  187. # RPG::Cache
  188. #------------------------------------------------------------------------------
  189. # RPG::Cache 追加定义
  190. #==============================================================================
  191. module RPG::Cache
  192.   def self.face(filename)
  193.     self.load_bitmap("Graphics/Faces/", filename)
  194.   end
  195. end
  196.  
  197. #==============================================================================
  198. # ■ Game_System
  199. #------------------------------------------------------------------------------
  200. #  处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
  201. # $game_system 。
  202. #==============================================================================
  203.  
  204. class Game_System
  205.   attr_accessor :soundname_on_speak
  206.   alias carol3_ini initialize
  207.   def initialize
  208.     carol3_ini
  209.     @soundname_on_speak = nil
  210.   end
  211. end
  212.  
  213. #==============================================================================
  214. # ■ Window_Message
  215. #------------------------------------------------------------------------------
  216. #   修改的对话框类。
  217. #==============================================================================
  218. class Window_Message_RB < Window_Selectable
  219.   include RB::Mes_Config
  220.   #--------------------------------------------------------------------------
  221.   # ● 初始化状态
  222.   #--------------------------------------------------------------------------
  223.   def initialize
  224.     super(80, 304, 480, 160)
  225. #    super(180, 304, 180, 160)
  226.     self.contents = Bitmap.new(1, 1)
  227.     self.visible = false
  228.     self.z = 9998
  229.     @fade_in = false
  230.     @fade_out = false
  231.     @contents_showing = false
  232.     @write_skip = false
  233.     @text_skip = false
  234.     @cursor_width = 0
  235.     @face_h = 0
  236.     self.active = false
  237.     self.index = -1
  238.     if $game_system.soundname_on_speak == nil then
  239.       $game_system.soundname_on_speak = ""
  240.     end
  241.     self.windowskin = RPG::Cache.windowskin(Mes_Windowskin) if Mes_Windowskin != ""
  242.     @opacity_text_buf = Bitmap.new(32, 32)
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● 释放
  246.   #--------------------------------------------------------------------------
  247.   def dispose
  248.     terminate_message
  249.     $game_temp.message_window_showing = false
  250.     if @input_number_window != nil
  251.       @input_number_window.dispose
  252.     end
  253.     super
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● 处理信息结束
  257.   #--------------------------------------------------------------------------
  258.   def terminate_message
  259.     self.active = false
  260.     self.pause = false
  261.     self.index = -1
  262.     self.contents.clear
  263.     # 清除显示中标志
  264.     @contents_showing = false
  265.     # 呼叫信息调用
  266.     if $game_temp.message_proc != nil
  267.       $game_temp.message_proc.call
  268.     end
  269.     # 清除文章、选择项、输入数值的相关变量
  270.     $game_temp.message_text = nil
  271.     $game_temp.message_proc = nil
  272.     $game_temp.choice_start = 99
  273.     $game_temp.choice_max = 0
  274.     $game_temp.choice_cancel_type = 0
  275.     $game_temp.choice_proc = nil
  276.     $game_temp.num_input_start = 99
  277.     $game_temp.num_input_variable_id = 0
  278.     $game_temp.num_input_digits_max = 0
  279.     # 清除头像(由于是 RPG::Cache 所以无需释放)
  280.     @face_bitmap = nil
  281.     @face_group_bitmap = nil
  282.     @face_ok = false
  283.     # 清除跳过标志
  284.     @write_skip = false
  285.     @text_skip = false
  286.     # 释放金钱窗口
  287.     if @gold_window != nil
  288.       @gold_window.dispose
  289.       @gold_window = nil
  290.     end
  291.     # 释放姓名窗口
  292.     if @name_window_text != nil
  293.       @name_window_text.dispose
  294.       @name_window_text = nil
  295.     end
  296.     # 释放右侧立绘
  297.     if @right_picture != nil
  298.       @right_picture.dispose
  299.       @right_picture = nil
  300.     end   
  301.     # 释放左侧立绘
  302.     if @left_picture != nil
  303.       @left_picture.dispose
  304.       @left_picture = nil
  305.     end
  306.     # 释放姓名蓝条
  307.     if @bar != nil
  308.       @bar.bitmap.dispose
  309.       @bar.dispose
  310.       @bar = nil
  311.     end
  312.     # 释放气泡图标
  313.     if @k_tale != nil
  314.       @k_tale.dispose
  315.       @k_tale = nil
  316.     end
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # ● 刷新
  320.   #--------------------------------------------------------------------------
  321.   def refresh
  322.     # 初期化
  323.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  324.     @face_indent = 0
  325.     @opacity = 255
  326.     @cursor_width = 0
  327.     @write_speed = 0
  328.     @write_wait = 0
  329.     @mid_stop = false
  330.     @popchar = -2
  331.     @auto_terminate = -1
  332.     if $game_temp.choice_start == 0
  333.       @x = 8
  334.     end
  335.     if $game_temp.message_text != nil
  336.       @now_text = $game_temp.message_text
  337.       # Shortcuts 预处理
  338.       @now_text.gsub!(/\\sc\[(.*?)\]/) { Shortcuts[$1] || "" }
  339.       # Shortcuts_Regexp 预处理
  340.       Shortcuts_Regexp.each_pair do |regex, str|
  341.         @now_text.gsub!(regex, str)
  342.       end
  343.       # 头像设置
  344.       if (/\\[Ff]\[(.+?)\]/.match(@now_text)) != nil
  345.         @face_bitmap = RPG::Cache.face($1)
  346.         @x = @face_indent = [128, @face_bitmap.width + 4].min
  347.         @now_text.gsub!(/\\[Ff]\[(.+?)\]/) { "" }
  348.       end
  349.       # 头像组设置
  350.       if (/\\[Gg]f\[(.+?)\s*,\s*(\d+)\]/).match(@now_text) != nil
  351.         @face_group_bitmap = RPG::Cache.face($1)
  352.         idx = $2.to_i
  353.         ix, iy = idx % Face_Group_W, idx / Face_Group_W
  354.         w, h = @face_group_bitmap.width / Face_Group_W, @face_group_bitmap.height / Face_Group_H
  355.         @face_bitmap = Bitmap.new(w, h)
  356.         @face_bitmap.blt(0, 0, @face_group_bitmap, Rect.new(ix * w, iy * h, w, h))
  357.         @x = @face_indent = [128, @face_bitmap.width + 4].min
  358.         @now_text.gsub!(/\\[Gg]f\[(.+?)\s*,\s*(\d+)\]/) { "" }
  359.       end
  360.       #——左半身像设置
  361.       if (/\\[Ll]\[(.+?)\]/.match(@now_text)) != nil then
  362.         @face = $1
  363.         if @left_picture != nil
  364.           @left_picture.dispose
  365.         end
  366.         @left_picture = Sprite.new
  367.         @left_picture.bitmap = RPG::Cache.face(@face)
  368.         @left_picture.mirror = true
  369.         @x = @face_indent = @left_picture.bitmap.width
  370.         @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  371.       end
  372.       #——右半身像设置
  373.       if (/\\[Rr]\[(.+?)\]/.match(@now_text)) != nil then
  374.         @face = $1
  375.         if @right_picture != nil
  376.           @right_picture.dispose
  377.         end
  378.         @right_picture = Sprite.new
  379.         @right_picture.bitmap = RPG::Cache.face(@face)
  380.         @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  381.       end
  382.       # 显示人物姓名
  383.       name_window_set = false
  384.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  385.         name_window_set = true
  386.         name_text = $1
  387.         if Regex_Player_Name =~ name_text
  388.           name_text = $game_actors[$1.to_i].name
  389.         end
  390.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  391.       end
  392.       # 人物姓名颜色
  393.       name_color = text_color(Name_Color_Default)
  394.       if (/\\[Nn]c\[(\d+)\]/.match(@now_text)) != nil
  395.         name_color = text_color($1.to_i)
  396.         @now_text.sub!(/\\[Nn]c\[(\d+)\]/) { "" }
  397.       end
  398.       # 文字位置的判定
  399.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text)) != nil then
  400.         @popchar = $1.to_i
  401.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  402.       end
  403.       # 自动结束判定
  404.       @auto_terminate = Auto_Terminate_Frame if $game_switches[Auto_Terminate]
  405.       if (/\\[Tt]\[(\d+)\]/).match(@now_text)
  406.         @auto_terminate = $1.to_i
  407.         @now_text.gsub!(/\\[Tt]\[(\d+)\]/) { "" }
  408.       end
  409.       # 开始替换文字(\v)
  410.       begin
  411.         last_text = @now_text.clone
  412.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  413.       end until @now_text == last_text
  414.       # 替换控制码
  415.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  416.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  417.       end
  418.       @now_text.gsub!(/\\\\/) { "\000" }
  419.       @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  420.       @now_text.gsub!(/\\[Gg]/) { "\002" }
  421.       @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  422.       @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  423.       @now_text.gsub!(/\\[.]/) { "\005" }
  424.       @now_text.gsub!(/\\[|]/) { "\006" }
  425.       @now_text.gsub!(/\\[Ii]c\[(.*?)\]/) { "\030[#{$1}] "}
  426.       @now_text.gsub!(/\\[>]/) { "\016" }
  427.       @now_text.gsub!(/\\[<]/) { "\017" }
  428.       @now_text.gsub!(/\\[!]/) { "\020" }
  429.       @now_text.gsub!(/\\[~]/) { "\021" }
  430.       @now_text.gsub!(/\\[Ii]/) { "\023" }
  431.       @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  432.       @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  433.       @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  434.       # 根据 \p 的不同设置对话框大小
  435.       if @popchar >= 0 # \p 的情况下自动调节
  436.         @text_save = @now_text.clone
  437.         process_real_text
  438.         @max_x = name_window_set ? contents.text_size(name_text).width : 0
  439.         @max_y = Max_Lines
  440.         for i in 0...Max_Lines
  441.           line = @text_save.split(/\n/)[Max_Lines-i-1]
  442.           @max_y -= 1 if line == nil && @max_y <= Max_Lines - i
  443.           next if line == nil
  444.           contents.font.size = Size
  445.           cx = contents.text_size(line).width
  446.           @max_x = cx if cx > @max_x
  447.         end
  448.         if @right_picture != nil && !@right_picture.disposed?
  449.           self.width = @max_x + 48 + @face_indent + @right_picture.bitmap.width
  450.         else
  451.           self.width = @max_x + 48 + @face_indent
  452.         end
  453.         @face_h = @face_bitmap == nil ? 0 : [120, @face_bitmap.height].min
  454.         if $game_temp.num_input_variable_id > 0
  455.           self.height = [(@max_y - 1) * line_height + 96, @face_h + 32].max
  456.         else
  457.           self.height = [(@max_y - 1) * line_height + 64, @face_h + 32].max
  458.       end
  459.  
  460.         # 生成气泡图标
  461.         @k_tale = Sprite.new
  462.       elsif @popchar == -1
  463.         line_count = @now_text.split(/\n/).size
  464.         line_count = [Max_Lines , [line_count, 4].max].min
  465.         self.width = Graphics_Width
  466.         self.height = [64 + line_height * (line_count - 1), @face_h + 32].max
  467.         @max_x = self.width - 32 - @face_indent
  468.       else
  469.         self.width = Graphics_Width * 0.6
  470.         self.height = 64 + line_height * 3
  471.         @max_x = self.width - 32 - @face_indent
  472.       end
  473.       # 如果设置了姓名框
  474.       if name_window_set
  475.         off_x = 0
  476.         off_y = -40
  477.         space = 2
  478.         x = self.x + off_x - space / 2
  479.         y = self.y + off_y - space / 2
  480.         w = self.contents.text_size(name_text).width + 26 + space
  481.         h = 40 + space
  482.         x = self.x + off_x + 4
  483.         y = self.y + off_y
  484.         @name_window_text = Air_Text.new(self.x + @face_indent+4+8, self.y+16, name_text, name_color)
  485.         @name_window_text.z = self.z + 2
  486.         @bar = Sprite.new
  487.         @bar.bitmap = Bitmap.new(self.width, 24)
  488.         face_cut = @face_bitmap == nil ? 0 : @face_indent + 2
  489.         @bar.x = self.x + 8 + face_cut
  490.         @bar.y = self.y + 16
  491.         @bar.z = self.z + 2
  492.         @bar.bitmap.fill_rect(0,0,self.width-16-face_cut,24, Name_Bar_Color)
  493.       end
  494.       # 一切设置完毕后,创建 contents
  495.       if self.contents != nil
  496.         self.contents.dispose
  497.         self.contents = nil
  498.       end
  499.       self.contents = Bitmap.new(width - 32, height - 32)
  500.       self.contents.font.color = normal_color
  501.       self.contents.font.size = Size
  502.     end
  503.     # 如果选择项被设置
  504.     if $game_temp.choice_max > 0
  505.       @item_max = $game_temp.choice_max
  506.       self.active = true
  507.       self.index = 0
  508.     end
  509.     # 如果数值输入被设置
  510.     if $game_temp.num_input_variable_id > 0
  511.       digits_max = $game_temp.num_input_digits_max
  512.       number = $game_variables[$game_temp.num_input_variable_id]
  513.       @input_number_window = Window_InputNumber.new(digits_max)
  514.       @input_number_window.number = number
  515.     end
  516.     # 更新窗口位置
  517.     update_window_pos
  518.   end
  519.   #--------------------------------------------------------------------------
  520.   # ● 更新
  521.   #--------------------------------------------------------------------------
  522.   def update
  523.     super
  524.     # 使用默认窗口外观的情况下,如果窗口的外关被变更了、再设置
  525.     if $game_system.windowskin_name != @windowskin_name && Mes_Windowskin == ""
  526.       @windowskin_name = $game_system.windowskin_name
  527.       self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  528.     end
  529.     # 地图中实时更新位置
  530.     if @k_tale != nil && @k_tale.visible && !$game_temp.in_battle
  531.       update_window_pos
  532.     end
  533.     # [空格键]跳过描绘
  534.     if $game_switches[Write_Skip] && Input.trigger?(Input::C)
  535.       @write_skip = true
  536.     end
  537.     # CTRL 高速跳过对话
  538.     if $game_switches[Text_Skip_Fast] && Input.trigger?(Input::CTRL)
  539.       # 选择项或数字输入时无法高速跳过
  540.       if $game_temp.choice_max > 0 || @input_number_window != nil
  541.         @write_skip = true
  542.       else
  543.         @text_skip = true
  544.       end
  545.     end
  546.     # 描绘头像
  547.     if @face_bitmap != nil && !@face_ok
  548.       face_real_w = [120, @face_bitmap.width].min
  549.       face_real_h = [120, @face_bitmap.height].min
  550.       self.contents.stretch_blt(Rect.new(0, 0, face_real_w, face_real_h), @face_bitmap, Rect.new(0, 0, @face_bitmap.width, @face_bitmap.height))
  551.       @face_ok = true
  552.     end
  553.     # 淡入中的情况下
  554.     if @fade_in
  555.       self.contents_opacity += 24
  556.       if @input_number_window != nil
  557.         @input_number_window.contents_opacity += 24
  558.       end
  559.       if self.contents_opacity == 255
  560.         @fade_in = false
  561.       end
  562.       return
  563.     end
  564.     @now_text = nil if @now_text == ""
  565.     # 逐个描绘文字
  566.     if @now_text != nil && @mid_stop == false && !@text_skip
  567.       if @write_wait > 0
  568.         @write_wait -= 1
  569.         return
  570.       end
  571.       while true
  572.         @max_x = @x if @max_x < @x
  573.         @max_y = @y if @max_y < @y
  574.         # 处理字符
  575.         if (c = @now_text.slice!(/./m)) != nil
  576.           # \\的情况下
  577.           if c == "\000"
  578.             c = "\\"
  579.           end
  580.           # \c的情况下
  581.           if c == "\001"
  582.             @now_text.sub!(/\[([0-9]+)\]/, "")
  583.             color = $1.to_i
  584.             if color >= 0 and color <= 7
  585.               self.contents.font.color = text_color(color)
  586.             end
  587.             c = ""
  588.           end
  589.           # \g的情况下
  590.           if c == "\002"
  591.             if @gold_window == nil && @popchar <= 0
  592.               @gold_window = Window_Gold.new
  593.               @gold_window.x = 560 - @gold_window.width
  594.               if $game_temp.in_battle
  595.                 @gold_window.y = 192
  596.               else
  597.                 @gold_window.y = self.y >= 128 ? 32 : 384
  598.               end
  599.               @gold_window.opacity = self.opacity
  600.               @gold_window.back_opacity = self.back_opacity
  601.             end
  602.             c = ""
  603.           end
  604.           # \s的情况下
  605.           if c == "\003"
  606.             @now_text.sub!(/\[([0-9]+)\]/, "")
  607.             speed = $1.to_i
  608.             if speed >= 0 and speed <= 19
  609.               @write_speed = speed
  610.             end
  611.             c = ""
  612.           end
  613.           # \a的情况下
  614.           if c == "\004"
  615.             @now_text.sub!(/\[(.*?)\]/, "")
  616.             se_filename = "Audio/SE/#{$1}"
  617.             if FileTest.exist?(se_filename)
  618.               Audio.se_play(se_filename)
  619.             end
  620.             c = ""
  621.           end
  622.           # \.的情况下
  623.           if c == "\005"
  624.             @write_wait += 5
  625.             c = ""
  626.           end
  627.           # \|的情况下
  628.           if c == "\006"
  629.             @write_wait += 20
  630.             c = ""
  631.           end
  632.           # \>的情况下
  633.           if c == "\016"
  634.             text_not_skip = false
  635.             c = ""
  636.           end
  637.           # \<的情况下
  638.           if c == "\017"
  639.             text_not_skip = true
  640.             c = ""
  641.           end
  642.           # \!的情况下
  643.           if c == "\020"
  644.             @mid_stop = true
  645.             c = ""
  646.           end
  647.           # \~的情况下
  648.           if c == "\021"
  649.             terminate_message
  650.             return
  651.           end
  652.           # \i的情况下
  653.           if c == "\023"
  654.             @indent = @x
  655.             c = ""
  656.           end
  657.           # \o的情况下
  658.           if c == "\024"
  659.             @now_text.sub!(/\[([0-9]+)\]/, "")
  660.             @opacity = $1.to_i
  661.             c = ""
  662.           end
  663.           # \h的情况下
  664.           if c == "\025"
  665.             @now_text.sub!(/\[([0-9]+)\]/, "")
  666.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  667.             c = ""
  668.           end
  669.           # \b的情况下
  670.           if c == "\026"
  671.             @now_text.sub!(/\[([0-9]+)\]/, "")
  672.             @x += $1.to_i
  673.             c = ""
  674.           end
  675.           # 图标的情况
  676.           if c == "\030"
  677.             @now_text.sub!(/\[(.*?)\]/, "")
  678.             self.contents.blt(@x , @y * line_height + (line_height - 24) / 2, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  679.             if $game_system.soundname_on_speak != ""
  680.               Audio.se_play($game_system.soundname_on_speak)
  681.             end
  682.             @x += 24
  683.             c = ""
  684.           end
  685.           # 另起一行的情况下
  686.           if c == "\n"
  687.             if @lines >= $game_temp.choice_start
  688.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  689.             end
  690.             @lines += 1
  691.             @y += 1
  692.             @x = 0 + @indent + @face_indent
  693.             if @lines >= $game_temp.choice_start
  694.               @x = 8 + @indent + @face_indent
  695.             end
  696.             c = ""
  697.           end
  698.           if c != ""
  699.             # 文字描画
  700.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size) / 2, c, @opacity)
  701.             if $game_system.soundname_on_speak != "" then
  702.               Audio.se_play($game_system.soundname_on_speak)
  703.             end
  704.           end
  705.         else
  706.           break
  707.         end
  708.         if !$game_switches[No_Typing] && !@write_skip
  709.           break
  710.         end
  711.       end
  712.       @write_wait += @write_speed
  713.       return
  714.     end
  715.     # 数值输入的处理
  716.     if @input_number_window != nil
  717.       @input_number_window.update
  718.       # 确认
  719.       if Input.trigger?(Input::C)
  720.         $game_system.se_play($data_system.decision_se)
  721.         $game_variables[$game_temp.num_input_variable_id] =
  722.           @input_number_window.number
  723.         $game_map.need_refresh = true
  724.         @input_number_window.dispose
  725.         @input_number_window = nil
  726.         terminate_message
  727.       end
  728.       return
  729.     end
  730.     # 跳过对话
  731.     if @text_skip
  732.       @now_text = nil
  733.       terminate_message
  734.       return
  735.     end
  736.     # 文章显示中的情况下
  737.     if @contents_showing
  738.       if $game_temp.choice_max == 0
  739.         self.pause = true
  740.       end
  741.       # auto terminate
  742.       if $game_temp.choice_max == 0 && @auto_terminate > 0
  743.         @auto_terminate -= 1
  744.         if @auto_terminate == 0
  745.           terminate_message
  746.         end
  747.         return
  748.       end
  749.       # 取消
  750.       if Input.trigger?(Input::B)
  751.         if $game_temp.choice_max > 0 && $game_temp.choice_cancel_type > 0
  752.           $game_system.se_play($data_system.cancel_se)
  753.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  754.           terminate_message
  755.         end
  756.       end
  757.       # 确定
  758.       if Input.trigger?(Input::C)
  759.         if @mid_stop
  760.           @mid_stop = false
  761.           return
  762.         else
  763.           if $game_temp.choice_max > 0
  764.             $game_system.se_play($data_system.decision_se)
  765.             $game_temp.choice_proc.call(self.index)
  766.           end
  767.           terminate_message
  768.         end
  769.       end
  770.       return
  771.     end
  772.     if @fade_out == false and $game_temp.message_text != nil
  773.       @contents_showing = true
  774.       $game_temp.message_window_showing = true
  775.       refresh
  776.       Graphics.frame_reset
  777.       self.visible = true
  778.       self.contents_opacity = 0
  779.       if @input_number_window != nil
  780.         @input_number_window.contents_opacity = 0
  781.       end
  782.       @fade_in = true
  783.       return
  784.     end
  785.     if self.visible
  786.       @fade_out = true
  787.       self.opacity -= 48
  788.       if self.opacity == 0
  789.         self.visible = false
  790.         @fade_out = false
  791.         $game_temp.message_window_showing = false
  792.       end
  793.       return
  794.     end
  795.   end
  796.   #--------------------------------------------------------------------------
  797.   # ● 预览实际描绘内容(计算窗口宽用)
  798.   #--------------------------------------------------------------------------
  799.   #    实际对 @text_save 进行操作
  800.   #    此方法用于去除某些控制码引起窗口过长的影响
  801.   #--------------------------------------------------------------------------
  802.   def process_real_text
  803.     return if @text_save.nil?
  804.     regex = /[\001-\006\016\017\020\021\024](\[.*?\]){0,1}/
  805.     regex30 = /\030\[.*?\]/
  806.     @text_save.gsub!(regex, "")
  807.     @text_save.gsub!(regex30, "   ")
  808.   end
  809.   #--------------------------------------------------------------------------
  810.   # ● 获得角色(\p功能)
  811.   #--------------------------------------------------------------------------
  812.   def get_character(parameter)
  813.     case parameter
  814.     when 0
  815.       return $game_player
  816.     else
  817.       events = $game_map.events
  818.       return events == nil ? nil : events[parameter]
  819.     end
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ● 获得战斗者(\p功能,此功能仅在战斗中有效)
  823.   #--------------------------------------------------------------------------
  824.   #    parameter : 1-999 表示主角 ID,1001-1008 表示索引为1-8的各个敌人
  825.   #--------------------------------------------------------------------------
  826.   def get_battler(parameter)
  827.     if parameter < 1000
  828.       return $game_actors[parameter]
  829.     else
  830.       return $game_troop.enemies[parameter - 1001]
  831.     end
  832.   end
  833.   #--------------------------------------------------------------------------
  834.   # ● 计算 y 偏移量(\p功能,这是考虑到不同战斗图/行走图的高度不同)
  835.   #--------------------------------------------------------------------------
  836.   #    character : 角色/战斗者
  837.   #--------------------------------------------------------------------------
  838.   def process_y_shift(character)
  839.     rate = character.is_a?(Game_Battler) ? 1 : 4
  840.     bmp = character.is_a?(Game_Battler) ?
  841.       RPG::Cache.battler(character.battler_name, character.battler_hue) :
  842.       RPG::Cache.character(character.character_name, character.character_hue)
  843.     return bmp.height / rate + 16
  844.   end
  845.   #--------------------------------------------------------------------------
  846.   # ● 更新窗口位置(所有组件)
  847.   #--------------------------------------------------------------------------
  848.   def update_window_pos
  849.     # 如果使用了 \p 设置位置
  850.     if @popchar >= 0
  851.       character = $game_temp.in_battle ? get_battler(@popchar) : get_character(@popchar)
  852.       final_pos = $game_system.message_position
  853.       if character != nil
  854.         x = [[character.screen_x - self.width / 2, 4].max, Graphics_Width - 4 - self.width].min
  855.         # adjust final_pos automatically when it is enabled
  856.         # ignore the case when pos == 1
  857.         if $game_switches[Auto_Adjust_Mes_Pos] && final_pos != 1
  858.           # try default mes_pos first
  859.           temp_y = final_pos == 2 ? [character.screen_y + 16, 4].max :
  860.             character.screen_y - process_y_shift(character) - self.height
  861.  
  862.           # set pos == 0 if temp_y exceeds the boundary of the screen
  863.           final_pos = 0 if temp_y > Graphics_Height - 4 - self.height && final_pos == 2
  864.           final_pos = 2 if temp_y < 4 && final_pos == 0
  865.         end
  866.         if final_pos == 2
  867.           y = [[character.screen_y + 16, 4].max, Graphics_Height - 4 - self.height].min
  868.         elsif final_pos == 0
  869.           y = [[character.screen_y - process_y_shift(character) - self.height, 4].max, Graphics_Height - 4 - self.height].min
  870.         else
  871.           x = (Graphics_Width - self.width) / 2
  872.           y = (Graphics_Height - self.height) / 2
  873.         end
  874.         self.x = x
  875.         self.y = y
  876.         # 设置气泡图标
  877.         if @k_tale != nil
  878.           @k_tale.x = character.is_a?(Game_Character) ?
  879.             ( character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16 :
  880.             character.screen_x
  881.           k_tale_filename = Mes_Windowskin == "" ? $game_system.windowskin_name : Mes_Windowskin
  882.           suffix = final_pos == 2 ? "-under" : "-top"
  883.           # reload @k_tale's bitmap
  884.           @k_tale.bitmap = RPG::Cache.windowskin(k_tale_filename + suffix)
  885.           if final_pos == 2
  886.             @k_tale.y = self.y - 16
  887.           elsif final_pos == 0
  888.             @k_tale.y = self.y + self.height - 16
  889.           else
  890.             @k_tale.visible = false
  891.           end
  892.           @k_tale.z = 9999
  893.         end
  894.       end
  895.     elsif @popchar == -1
  896.      # self.x = 0
  897.      # self.y = Graphics_Height - self.height
  898.       self.x = 26
  899.       self.y = Graphics_Height - self.height
  900.       self.width = 590
  901.  
  902.     else # 无 \p 的情况下
  903.       self.x = (Graphics_Width - self.width) / 2
  904.       # 处于战斗中时
  905.       if $game_temp.in_battle
  906.         self.y = 16
  907.       else
  908.         # 显示文章位置的分支
  909.         case $game_system.message_position
  910.         when 0 # 上
  911.           self.y = 16
  912.         when 1 # 中
  913.           self.y = (Graphics_Height - self.height) / 2
  914.         when 2 # 下
  915.           self.y = (Graphics_Height - self.height - 16)
  916.         end
  917.       end
  918.     end # of @popchar >= 0
  919.     # 设置左侧立绘
  920.     if @left_picture != nil and !@left_picture.disposed?
  921.       @left_picture.x = self.x + 8
  922.       @left_picture.y = self.y - @left_picture.bitmap.height + self.height - 8
  923.       @left_picture.z = self.z + 4
  924.     end
  925.     # 设置右侧立绘
  926.     if @right_picture != nil and !@right_picture.disposed?
  927.       @right_picture.x = self.x + self.width - @right_picture.bitmap.width - 8
  928.       @right_picture.y = self.y - @right_picture.bitmap.height + self.height - 8
  929.       @right_picture.z = self.z + 4
  930.     end
  931.     # 设置姓名空气文字坐标
  932.     if @name_window_text != nil
  933.       @name_window_text.x = self.x + @face_indent - 4
  934.       @name_window_text.y = self.y
  935.     end
  936.     # 设置姓名蓝条坐标
  937.     if @bar != nil
  938.       face_cut = @face_bitmap == nil ? 0 : @face_indent + 2
  939.       @bar.x = self.x + 8 + face_cut
  940.       @bar.y = self.y + 16
  941.     end
  942.     # 设置数字处理
  943.     if @input_number_window != nil
  944.       @input_number_window.x = self.x + @face_indent
  945.       @input_number_window.y = self.y + 8 + $game_temp.num_input_start * line_height
  946.     end
  947.     # 设置不透明度
  948.     if $game_system.message_frame == 0
  949.       self.opacity = 255
  950.       self.back_opacity = 200
  951.     else
  952.       self.opacity = 0
  953.       self.back_opacity = 200
  954.     end
  955.   end
  956.   #--------------------------------------------------------------------------
  957.   # ● line_height
  958.   #--------------------------------------------------------------------------
  959.   # 返回值 : 行高
  960.   #--------------------------------------------------------------------------
  961.   def line_height
  962.     return [[Size * 15 / 10, 18].max, 32].min
  963.   end
  964.   #--------------------------------------------------------------------------
  965.   # ● 文字描画
  966.   #--------------------------------------------------------------------------
  967.   # target :描绘的目标 bitmap 对象
  968.   # x      :x 坐标
  969.   # y      :y 坐标
  970.   # str   :描绘的文字
  971.   # opacity:不透明度(0~255)
  972.   # 返回值 :文字宽度(@x 的增加值)。
  973.   #--------------------------------------------------------------------------
  974.   def opacity_draw_text(target, x, y, str,opacity)
  975.     height = target.font.size
  976.     width = target.text_size(str).width
  977.     opacity = [[opacity, 0].max, 255].min
  978.     if opacity == 255
  979.       target.draw_text(x, y, width, height, str)
  980.       return width
  981.     else
  982.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  983.         @opacity_text_buf.dispose
  984.         @opacity_text_buf = Bitmap.new(width, height)
  985.       else
  986.         @opacity_text_buf.clear
  987.       end
  988.       @opacity_text_buf.font.size = target.font.size
  989.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  990.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  991.     return width
  992.     end
  993.   end
  994.   #--------------------------------------------------------------------------
  995.   # ● \V 变换
  996.   #--------------------------------------------------------------------------
  997.   # option : 选项,'i'物品,'w'武器,'a'防具,'s'技能
  998.   # index  : 数据库的索引
  999.   #--------------------------------------------------------------------------
  1000.   def convart_value(option, index)
  1001.     option == nil ? option = "" : nil
  1002.     option.downcase!
  1003.     case option
  1004.       when "i"
  1005.         unless $data_items[index].name == nil
  1006.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  1007.         end
  1008.       when "w"
  1009.         unless $data_weapons[index].name == nil
  1010.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  1011.         end
  1012.       when "a"
  1013.         unless $data_armors[index].name == nil
  1014.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  1015.         end
  1016.       when "s"
  1017.         unless $data_skills[index].name == nil
  1018.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  1019.         end
  1020.       else
  1021.       r = $game_variables[index]
  1022.     end
  1023.     r == nil ? r = "" : nil
  1024.     return r
  1025.   end
  1026.   #--------------------------------------------------------------------------
  1027.   # ● 释放
  1028.   #--------------------------------------------------------------------------
  1029.   def dispose
  1030.     terminate_message
  1031.     unless @opacity_text_buf.disposed?
  1032.       @opacity_text_buf.dispose
  1033.     end
  1034.     $game_temp.message_window_showing = false
  1035.     if @input_number_window != nil
  1036.       @input_number_window.dispose
  1037.     end
  1038.     super
  1039.   end
  1040.   #--------------------------------------------------------------------------
  1041.   # ● 刷新光标矩形
  1042.   #--------------------------------------------------------------------------
  1043.   def update_cursor_rect
  1044.     if @index >= 0
  1045.       n = $game_temp.choice_start + @index
  1046.       self.cursor_rect.set(4 + @indent + @face_indent, n * line_height, @cursor_width, line_height)
  1047.     else
  1048.       self.cursor_rect.empty
  1049.     end
  1050.   end
  1051. end
  1052. #==============================================================================
  1053. # ■ Air_Text
  1054. #------------------------------------------------------------------------------
  1055. #   空气文字,借助窗口显示文字,但是不显示窗口载体。
  1056. #==============================================================================
  1057. class Air_Text < Window_Base
  1058.   #--------------------------------------------------------------------------
  1059.   # ● 对象初始化
  1060.   #--------------------------------------------------------------------------
  1061.   def initialize(x, y, designate_text, color)
  1062.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  1063.     self.opacity = 0
  1064.     self.back_opacity = 0
  1065.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  1066.     self.contents.font.size = 20
  1067.     self.contents.font.color = color
  1068.     w = self.contents.width
  1069.     h = self.contents.height
  1070.     self.contents.draw_text(0, 0, w, h, designate_text)
  1071.   end
  1072.   #--------------------------------------------------------------------------
  1073.   # ● 释放
  1074.   #--------------------------------------------------------------------------
  1075.   def dispose
  1076.     self.contents.clear
  1077.     super
  1078.   end
  1079. end
  1080.  
  1081. class Interpreter
  1082.   include RB::Mes_Config
  1083.   #--------------------------------------------------------------------------
  1084.   # ● 显示文章
  1085.   #--------------------------------------------------------------------------
  1086.   def command_101
  1087.     # 另外的文章已经设置过 message_text 的情况下
  1088.     if $game_temp.message_text != nil
  1089.       # 结束
  1090.       return false
  1091.     end
  1092.     # 设置信息结束后待机和返回调用标志
  1093.     @message_waiting = true
  1094.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  1095.     # message_text 设置为 1 行
  1096.     # check whether \+ exists
  1097.     append = /\\\+$/ =~ @list[@index].parameters[0]
  1098.     line = @list[@index].parameters[0].sub(/\\\+$/, "")
  1099.     $game_temp.message_text = line + "\n"
  1100.     line_count = 1
  1101.     # 循环
  1102.     loop do
  1103.       # 下一个事件指令为文章两行以上的情况
  1104.       if @list[@index+1].code == 401 || @list[@index+1].code == 101 && append
  1105.         append = /\\\+$/ =~ @list[@index+1].parameters[0]
  1106.         line = @list[@index+1].parameters[0].sub(/\\\+$/, "")
  1107.         # message_text 添加到第 2 行以下
  1108.         $game_temp.message_text += line + "\n"
  1109.         line_count += 1
  1110.       # 事件指令不在文章两行以下的情况
  1111.       else
  1112.         # 下一个事件指令为显示选择项的情况下
  1113.         if @list[@index+1].code == 102
  1114.           # 如果选择项能收纳在画面里
  1115.           if @list[@index+1].parameters[0].size <= Max_Lines - line_count
  1116.             # 推进索引
  1117.             @index += 1
  1118.             # 设置选择项
  1119.             $game_temp.choice_start = line_count
  1120.             setup_choices(@list[@index].parameters)
  1121.           end
  1122.         # 下一个事件指令为处理输入数值的情况下
  1123.         elsif @list[@index+1].code == 103
  1124.           # 如果数值输入窗口能收纳在画面里
  1125.           if line_count < Max_Lines
  1126.             # 推进索引
  1127.             @index += 1
  1128.             # 设置输入数值
  1129.             $game_temp.num_input_start = line_count
  1130.             $game_temp.num_input_variable_id = @list[@index].parameters[0]
  1131.             $game_temp.num_input_digits_max = @list[@index].parameters[1]
  1132.           end
  1133.         end
  1134.         # 继续
  1135.         return true
  1136.       end
  1137.       # 推进索引
  1138.       @index += 1
  1139.     end
  1140.   end
  1141. end
  1142.  
  1143. class Scene_Map
  1144.   include RB::Mes_Config
  1145.   alias rb_update_20160408 update
  1146.   def update
  1147.     if @rb_mes_disabled != $game_switches[Mes_Disabled]
  1148.       @rb_mes_disabled = $game_switches[Mes_Disabled]
  1149.       @message_window.dispose if @message_window != nil
  1150.       @message_window = @rb_mes_disabled ? Window_Message.new : Window_Message_RB.new
  1151.     end
  1152.     rb_update_20160408
  1153.   end
  1154. end
  1155.  
  1156. class Scene_Battle
  1157.   include RB::Mes_Config
  1158.   alias rb_update_20160408 update
  1159.   def update
  1160.     if @rb_mes_disabled != $game_switches[Mes_Disabled]
  1161.       @rb_mes_disabled = $game_switches[Mes_Disabled]
  1162.       @message_window.dispose if @message_window != nil
  1163.       @message_window = @rb_mes_disabled ? Window_Message.new : Window_Message_RB.new
  1164.     end
  1165.     rb_update_20160408
  1166.   end
  1167. end
  1168.  
  1169.  
  1170. #==============================================================================
  1171. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  1172. #==============================================================================








然后这是多选项脚本
RUBY 代码复制
  1. class Game_Temp
  2.   attr_accessor :need_show_more
  3.   attr_accessor :window_pos_y
  4.   attr_accessor :choices
  5.  
  6.   alias old_ini initialize
  7.   def initialize
  8.     old_ini
  9.     @need_show_more = false
  10.     @window_pos_y = 16
  11.     @choices = nil
  12.   end
  13. end
  14.  
  15. class Window_Message < Window_Selectable
  16.   alias old_ref refresh
  17.   def refresh
  18.     if $game_temp.need_show_more
  19.       self.y = $game_temp.window_pos_y
  20.       self.height = 160 + 32 * ($game_temp.choice_max - 4)
  21.       self.contents = Bitmap.new(self.width - 32, self.height - 32)
  22.     else
  23.       self.height = 160
  24.       self.contents = Bitmap.new(self.width - 32, self.height - 32)
  25.     end
  26.     old_ref
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● 刷新画面
  30.   #--------------------------------------------------------------------------
  31.   def update
  32.     super
  33.     # 渐变的情况下
  34.     if @fade_in
  35.       self.contents_opacity += 24
  36.       if @input_number_window != nil
  37.         @input_number_window.contents_opacity += 24
  38.       end
  39.       if self.contents_opacity == 255
  40.         @fade_in = false
  41.       end
  42.       return
  43.     end
  44.     # 输入数值的情况下
  45.     if @input_number_window != nil
  46.       @input_number_window.update
  47.       # 确定
  48.       if Input.trigger?(Input::C)
  49.         $game_system.se_play($data_system.decision_se)
  50.         $game_variables[$game_temp.num_input_variable_id] =
  51.           @input_number_window.number
  52.         $game_map.need_refresh = true
  53.         # 释放输入数值窗口
  54.         @input_number_window.dispose
  55.         @input_number_window = nil
  56.         terminate_message
  57.       end
  58.       return
  59.     end
  60.     # 显示信息中的情况下
  61.     if @contents_showing
  62.       # 如果不是在显示选择项中就显示暂停标志
  63.       if $game_temp.choice_max == 0
  64.         self.pause = true
  65.       end
  66.       # 取消
  67.       if Input.trigger?(Input::B)
  68.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  69.           $game_system.se_play($data_system.cancel_se)
  70.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  71.           $game_variables[100] = $game_temp.choice_cancel_type - 1
  72.           $game_temp.need_show_more = false
  73.           terminate_message
  74.         end
  75.       end
  76.       # 确定
  77.       if Input.trigger?(Input::C)
  78.         if $game_temp.choice_max > 0
  79.           $game_system.se_play($data_system.decision_se)
  80.           $game_variables[100] = self.index
  81.           $game_temp.choice_proc.call(self.index)
  82.         end
  83.         $game_temp.need_show_more = false
  84.         terminate_message
  85.       end
  86.       return
  87.     end
  88.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  89.     if @fade_out == false and $game_temp.message_text != nil
  90.       @contents_showing = true
  91.       $game_temp.message_window_showing = true
  92.       reset_window
  93.       refresh
  94.       Graphics.frame_reset
  95.       self.visible = true
  96.       self.contents_opacity = 0
  97.       if @input_number_window != nil
  98.         @input_number_window.contents_opacity = 0
  99.       end
  100.       @fade_in = true
  101.       return
  102.     end
  103.     # 没有可以显示的信息、但是窗口为可见的情况下
  104.     if self.visible
  105.       @fade_out = true
  106.       self.opacity -= 48
  107.       if self.opacity == 0
  108.         self.visible = false
  109.         @fade_out = false
  110.         $game_temp.message_window_showing = false
  111.       end
  112.       return
  113.     end
  114.   end
  115. end
  116.  
  117. class Interpreter
  118.   def command_102
  119.     # 文章已经设置过 message_text 的情况下
  120.     if $game_temp.message_text != nil
  121.       # 结束
  122.       return false
  123.     end
  124.     # 设置信息结束后待机和返回调用标志
  125.     @message_waiting = true
  126.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  127.     # 设置选择项
  128.     $game_temp.message_text = ""
  129.     $game_temp.choice_start = 0
  130.     if $game_temp.need_show_more
  131.       @parameters = [$game_temp.choices, $game_temp.choice_cancel_type]
  132.     end
  133.     setup_choices(@parameters)
  134.     # 继续
  135.     return true
  136.   end
  137. end




这两个脚本加在一起多选项脚本就无效了,求助

Project对话框 多选项.rar

201.92 KB, 下载次数: 103

Lv5.捕梦者 (版主)

梦石
1
星屑
23963
在线时间
3338 小时
注册时间
2011-7-8
帖子
3925

开拓者

2
发表于 2017-7-20 00:57:37 | 只看该作者
RB的这个脚本也支持超过4个的选项吧

点评

我感觉RB这脚本应该不支持  发表于 2017-7-20 16:49
熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
147
在线时间
141 小时
注册时间
2011-6-1
帖子
343
3
 楼主| 发表于 2017-7-20 16:11:33 | 只看该作者
guoxiaomi 发表于 2017-7-20 00:57
RB的这个脚本也支持超过4个的选项吧

是支持4个以上啊,但是把对话框脚本一加进去,就无效了……求助
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9497
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

4
发表于 2017-7-21 00:32:04 | 只看该作者
大致看了一下。这两个脚本目前来看不可能兼容,整合在一起不如重新做一个。如果有需求,我可以想想怎么把这对话框里加个多项选择。

点评

那最好啦,VX都有恶意多选项脚本,希望这也有,这个多选项脚本应该可以拿来参考吧  发表于 2017-7-23 17:00
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-4 05:16

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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