设为首页收藏本站

仙剑之十里坡

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 4049|回复: 8
打印 上一主题 下一主题

[6r教程整理]对话框加强脚本

[复制链接]

160

主题

6

听众

1万

积分

超级版主

蜀山剑侠银行行长

超级版主

  • TA的每日心情
    开心
    前天 21:35
  • 签到天数: 858 天

    [LV.10]以坛为家III

    精华
    3
    积分
    13202
    历练
    7
    声望
    24
    人气
    2361

    金融巨子 润泽万物 坚若磐石

    单身中……
    帮我摆脱单身吧
    跳转到指定楼层
    1
    发表于 2010-7-6 22:40:04 |只看该作者 |倒序浏览
    1. #\a[n] : n帧之后自动关闭对话框
    2. #\b: Banner mode. 文字将显示在对话框的正中间(横竖都是中间)。不能与其他类似功能同用(柳柳按:没什么用处的功能,中文不需要这么排版)
    3. #\c[n] 改变为第n种颜色. 使用\d或者\c[0]回复正常颜色。
    4. #\d: 回复默认字体、大小、颜色、高度。
    5. #\f[n] : 改变为第n种字体,使用\d回复默认字体。
    6. #\g : 显示金钱窗口
    7. #\h[n] : 改变文字的字沉高度,使用\d或\h[32]回复默认状态(柳柳按:这个功能没什么用处)
    8. #\j[n] : 显示n象素的空白(柳柳按:对于中文而言无用的功能)
    9. #\i[n] : 显示第n号物品的图标和名称
    10. #\k[n] : 显示第n号特技的图标和名称.
    11. #\m[n] : 显示第n号防具的图标和名称.
    12. #\w[n] : 显示第n号武器的图标和名称.
    13. #\n[n] : 显示第n号英雄名称(柳柳按:就是默认功能).
    14. #\o[n] : 更改文字的透明度为n.
    15. #\r: 右对齐(柳柳按:比较不实用).  
    16. #\s[n] : 更改字体大小(柳柳按:不要改得太大,否则会出格,会变丑的^__^).
    17. #\v[n] : 显示第n号变量的数值.
    18. #\x: 居中对齐,必须在一行的开头用(柳柳按:比较不实用。其实这些排版功能不如打几个空格).
    19. #\\ : 显示"\"这个符号.
    20. class Window_Message < Window_Selectable
    21.   attr_accessor :autoclosetime
    22.   attr_accessor :op
    23. # ----------------------------
    24.   def initialize
    25.     super(80, 304, 480, 160)
    26.     self.contents = Bitmap.new(width - 32, height - 32)
    27.     self.visible = false
    28.     self.z = 9998
    29.     @fade_in = false
    30.     @fade_out = false
    31.     @contents_showing = false
    32.     @cursor_width = 0
    33.     @autoclosetime = -1
    34.     @op = 255
    35.     @refreshflag = false
    36.     self.active = false
    37.     self.index = -1
    38.   end
    39. # ----------------------------
    40.   def dispose
    41.     terminate_message
    42.     $game_temp.message_window_showing = false
    43.     if @input_number_window != nil
    44.       @input_number_window.dispose
    45.     end
    46.     super
    47.   end
    48. # ----------------------------
    49.   def terminate_message
    50.     self.active = false
    51.     self.pause = false
    52.     self.index = -1
    53.     self.contents.clear
    54.     @contents_showing = false
    55.     if $game_temp.message_proc != nil
    56.       $game_temp.message_proc.call
    57.     end
    58.     $game_temp.message_text = nil
    59.     $game_temp.message_proc = nil
    60.     $game_temp.choice_start = 99
    61.     $game_temp.choice_max = 0
    62.     $game_temp.choice_cancel_type = 0
    63.     $game_temp.choice_proc = nil
    64.     $game_temp.num_input_start = 99
    65.     $game_temp.num_input_variable_id = 0
    66.     $game_temp.num_input_digits_max = 0
    67.     if @gold_window != nil
    68.       @gold_window.dispose
    69.       @gold_window = nil
    70.     end
    71.   end
    72. # ----------------------------
    73.   def refresh
    74.     self.contents.clear
    75.     self.contents.font.color = normal_color
    76.     self.contents.font.name = "宋体"
    77.     self.contents.font.size = 18
    78.     x = y = 0
    79.     @cursor_width = 0
    80.     @autoclosetime = -1
    81.     @refreshflag = true
    82.     lineheight = 32
    83.     active = ""
    84.     a = ""
    85.     centerflag = false
    86.     rightflag = false
    87.     bannerflag = false
    88.     if $game_temp.choice_start == 0
    89.       x = 8
    90.     end
    91.     if $game_temp.message_text != nil
    92.       text = $game_temp.message_text
    93.       begin
    94.       last_text = text.clone
    95.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
    96.       end until text == last_text
    97.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
    98.    $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
    99.       end
    100.       text.gsub!(/\\\\/) { "\000" }
    101.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
    102.       text.gsub!(/\\[Gg]/) { "\002" }
    103.       text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]" }
    104.       text.gsub!(/\\[Ff]\[([0-9]+)\]/) { "\004[#{$1}]" }
    105.       text.gsub!(/\\[Aa]\[([0-9]+)\]/) { "\005[#{$1}]" }
    106.       text.gsub!(/\\[Xx]/) { "\006" }
    107.       text.gsub!(/\\[Rr]/) { "\007" }
    108.       text.gsub!(/\\[Dd]/) { "\011" }
    109.       text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\023[#{$1}]" }
    110.       text.gsub!(/\\[Bb]/) { "\017" }
    111.       text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\014[#{$1}]" }
    112.       text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\015[#{$1}]" }
    113.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\016[#{$1}]" }
    114.       text.gsub!(/\\[Jj]\[([0-9]+)\]/) { "\013[#{$1}]" }
    115.       text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\021[#{$1}]" }
    116.       text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\022[#{$1}]" }
    117.       while ((c = text.slice!(/./m)) != nil)
    118.         if c == "\000"
    119.           c = "\\"
    120.         end
    121.         if c == "\001"
    122.           text.sub!(/\[([0-9]+)\]/, "")
    123.           color = $1.to_i
    124.           if color >= 0 and color <= 7
    125.             self.contents.font.color = text_color(color)
    126.           end
    127.           next
    128.         end
    129.         if c == "\002"
    130.           if @gold_window == nil
    131.             @gold_window = Window_Gold.new
    132.             @gold_window.x = 560 - @gold_window.width
    133.             if $game_temp.in_battle
    134.               @gold_window.y = 192
    135.             else
    136.               @gold_window.y = self.y >= 128 ? 32 : 384
    137.             end
    138.             @gold_window.opacity = self.opacity
    139.             @gold_window.back_opacity = self.back_opacity
    140.           end
    141.           next
    142.         end
    143.           if c == "\003"
    144.           text.sub!(/\[([0-9]+)\]/, "")
    145.           item_sub = $1.to_i
    146.           c = $data_items[item_sub].name
    147.           l = self.contents.text_size&copy;.width
    148.           draw_item_name($data_items[item_sub], x, y * 32 + 1)
    149.           x = x + l + 24
    150.           next
    151.         end
    152.          if c == "\004"
    153.           text.sub!(/\[([0-9]+)\]/, "")
    154.           fontize = $1.to_i
    155.           case fontize
    156.             when 1  
    157.               self.contents.font.name = "黑体"
    158.             when 2  
    159.               self.contents.font.name = "宋体"
    160.             when 3  
    161.               self.contents.font.name = "隶书"
    162.             when 4  
    163.               self.contents.font.name = "幼圆"
    164.           end
    165.           next
    166.         end
    167.          if c == "\005"
    168.           text.sub!(/\[([0-9]+)\]/, "")
    169.           @autoclosetime = $1.to_i
    170.           next
    171.         end
    172.         if c == "\006"
    173.           centerflag = true
    174.           next
    175.         end
    176.         if c == "\007"
    177.           rightflag = true
    178.           next
    179.         end
    180.         if c == "\011"
    181.           self.contents.font.name = "Arial"
    182.           self.contents.font.size = 18
    183.           self.contents.font.color = normal_color
    184.           lineheight = 32
    185.           next
    186.         end
    187.         if c == "\014"
    188.           text.sub!(/\[([0-9]+)\]/, "")
    189. w_sub = $1.to_i
    190.           c = $data_weapons[w_sub].name
    191.           l = self.contents.text_size&copy;.width
    192.           bitmap = RPG::Cache.icon($data_weapons[w_sub].icon_name)
    193.           self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24))
    194.           x += 28
    195.           self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c)
    196.           x = x + l
    197.           next
    198.         end

    复制代码
    分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    转播转播0 分享淘帖0 分享分享0 收藏收藏0

    160

    主题

    6

    听众

    1万

    积分

    超级版主

    蜀山剑侠银行行长

    超级版主

  • TA的每日心情
    开心
    前天 21:35
  • 签到天数: 858 天

    [LV.10]以坛为家III

    精华
    3
    积分
    13202
    历练
    7
    声望
    24
    人气
    2361

    金融巨子 润泽万物 坚若磐石

    单身中……
    帮我摆脱单身吧
    2
    发表于 2010-7-6 22:40:24 |只看该作者
    1.           if c == "\015"
    2.           text.sub!(/\[([0-9]+)\]/, "")
    3.           a_sub = $1.to_i
    4.           c = $data_armors[a_sub].name
    5.           l = self.contents.text_size&copy;.width
    6.           bitmap = RPG::Cache.icon($data_armors[a_sub].icon_name)
    7.           self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24))
    8.           x += 28
    9.           self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c)
    10.           x = x + l
    11.           next
    12.         end
    13.           if c == "\016"
    14.           text.sub!(/\[([0-9]+)\]/, "")
    15.           @op = $1.to_i
    16.           next
    17.         end
    18.          if c == "\017"
    19.           bannerflag = true
    20.           next
    21.         end
    22.         if c == "\018"
    23.           text.sub!(/\[([0-9]+)\]/, "")
    24.           jump = $1.to_i        
    25.           x += jump
    26.           next
    27.         end
    28.           if c == "\021"
    29.           text.sub!(/\[([0-9]+)\]/, "")
    30.           lineheight = $1.to_i
    31.           next
    32.         end
    33.         if c == "\022"
    34.           text.sub!(/\[([0-9]+)\]/, "")
    35.           skill_sub = $1.to_i
    36.           c = $data_skills[skill_sub].name
    37.           l = self.contents.text_size&copy;.width
    38.           bitmap = RPG::Cache.icon($data_skills[skill_sub].icon_name)
    39.           self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24))
    40.           x += 28
    41.           self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c)
    42.           x = x + l
    43.           next
    44.         end
    45.          if c == "\023"
    46.           text.sub!(/\[([0-9]+)\]/, "")
    47.           bigness = $1.to_i
    48.           self.contents.font.size = bigness
    49.           next
    50.         end
    51.         if c == "\n"
    52.           if centerflag == true
    53.             x = 448 - x
    54.             x = x / 2
    55.             self.contents.draw_text(x, 32 * y, 448-x, lineheight, a)
    56.           end
    57.           if rightflag == true
    58.             x = 448 - x
    59.             self.contents.draw_text(x, 32 * y, 448-x, lineheight, a)
    60.           end
    61.           if bannerflag == true
    62.             x = 448 - x
    63.             x = x / 2
    64.             self.contents.draw_text(x, 44, 448-x, lineheight, a)
    65.           end
    66.           a = ""
    67.           centerflag = false
    68.           rightflag = false
    69.           bannerflag = false
    70.           if y >= $game_temp.choice_start
    71.             @cursor_width = [@cursor_width, x].max
    72.           end
    73.           y += 1
    74.           x = 0
    75.           if y >= $game_temp.choice_start
    76.             x = 8
    77.           end
    78.           next
    79.         end
    80.         if centerflag == false && rightflag == false && bannerflag == false
    81.         self.contents.draw_text(4 + x, 32 * y, 40, lineheight, c)
    82.         x += self.contents.text_size&copy;.width
    83.       else
    84.         a += c
    85.         x += self.contents.text_size&copy;.width
    86. 4楼

    87.         end
    88.       end
    89.     end
    90.     if $game_temp.choice_max > 0
    91.       @item_max = $game_temp.choice_max
    92.       self.active = true
    93.       self.index = 0
    94.     end
    95.     if $game_temp.num_input_variable_id > 0
    96.       digits_max = $game_temp.num_input_digits_max
    97.       number = $game_variables[$game_temp.num_input_variable_id]
    98.       @input_number_window = Window_InputNumber.new(digits_max)
    99.       @input_number_window.number = number
    100.       @input_number_window.x = self.x + 8
    101.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
    102.     end
    103.   end
    104.   #--------------------------------------------------------------------------
    105.   # ● 设置窗口位置与不透明度
    106.   #--------------------------------------------------------------------------
    107.   def reset_window
    108.     if $game_temp.in_battle
    109.       self.y = 16
    110.     else
    111.       case $game_system.message_position
    112.       when 0  # 上
    113.         self.y = 16
    114.       when 1  # 中
    115.         self.y = 160
    116.       when 2  # 下
    117.         case $msr
    118.         when 0
    119.           self.y = 304
    120.         when 1
    121.           self.y =  
    122.       when 999  #自制对话框
    123.         self.x=180
    124.         self.y=306
    125.         self.width = 440
    126.         self.height = 160
    127.         self.opacity=0
    128.         self.back_opacity=0
    129.         self.contents = Bitmap.new(width - 32, height - 32)
    130.       end
    131.     end
    132.     if $game_system.message_frame == 0
    133.       self.opacity = 255
    134.     else
    135.       self.opacity = 0
    136.     end
    137.     self.back_opacity = 160
    138.   end
    139. # ----------------------------   
    140.   def update
    141.     super
    142.     if @refreshflag && @fade_in == false
    143.       self.contents_opacity = @op
    144.      end
    145.     if @autoclosetime == 0
    146.     @autoclosetime = -1
    147.      terminate_message
    148.    end
    149.     if @autoclosetime >= 1
    150.     @autoclosetime -= 1
    151.     end
    152.     if @fade_in
    153.       self.contents_opacity += 24
    154.       if @input_number_window != nil
    155.         @input_number_window.contents_opacity += 24
    156.       end
    157.       if self.contents_opacity >= @op
    158.         @fade_in = false
    159.       end
    160.       return
    161.     end
    162.     if @input_number_window != nil
    163.       @input_number_window.update
    164.       if Input.trigger?(Input::C)
    165.         $game_system.se_play($data_system.decision_se)
    166.         $game_variables[$game_temp.num_input_variable_id] =
    167.           @input_number_window.number
    168.         $game_map.need_refresh = true
    169.         @input_number_window.dispose
    170.         @input_number_window = nil
    171.         terminate_message
    172.       end
    173.       return
    174.     end
    175.     if @contents_showing
    176.       if $game_temp.choice_max == 0
    177.         self.pause = true
    178.       end
    179.       if Input.trigger?(Input::B)
    180.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
    181.           $game_system.se_play($data_system.cancel_se)
    182.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
    183.           terminate_message
    184.         end
    185.       end
    186.       if Input.trigger?(Input::C)
    187.         if $game_temp.choice_max > 0
    188.           $game_system.se_play($data_system.decision_se)
    189.           $game_temp.choice_proc.call(self.index)
    190.         end
    191.         @op = 255
    192.         terminate_message
    193.       end
    194.       return
    195.     end
    196.     if @fade_out == false and $game_temp.message_text != nil
    197.       @contents_showing = true
    198.       $game_temp.message_window_showing = true
    199.       reset_window
    200.       refresh
    201.       Graphics.frame_reset
    202.       self.visible = true
    203.       self.contents_opacity = 0
    204.       if @input_number_window != nil
    205.         @input_number_window.contents_opacity = 0
    206.       end
    207.       @fade_in = true
    208.       return
    209.     end
    210.     if self.visible
    211.       @fade_out = true
    212.       self.opacity -= 48
    213.       if self.opacity == 0
    214.         self.visible = false
    215.         @fade_out = false
    216.         $game_temp.message_window_showing = false
    217.       end
    218.       return
    219.     end
    220.   end
    221. # ----------------------------
    222.   def update_cursor_rect
    223.     if @index >= 0
    224.       n = $game_temp.choice_start + @index
    225.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
    226.     else
    227.       self.cursor_rect.empty
    228.     end
    229.   end
    230. end
    复制代码
    于是饮酒乐甚,扣舷而歌之。歌曰:“桂棹兮兰桨,击空明兮溯流光。残阳阳兮是羊羊,吾乃最爱南宫煌。”
    回复

    使用道具 举报

    1008

    主题

    5

    听众

    2万

    积分

    返璞归真

    不器用な星の瞬き

    会员等级: 10

  • TA的每日心情
    擦汗
    2024-4-17 22:49
  • 签到天数: 1362 天

    [LV.10]以坛为家III

    精华
    2
    积分
    23735
    历练
    3
    声望
    133
    人气
    2536

    转帖之王 金融巨子 黑色羽翼

    单身中……
    帮我摆脱单身吧
    3
    发表于 2010-7-9 16:35:34 |只看该作者
    恭喜,我找到这个脚本会出错的地方了!
    夜空の星に 捧げた願いの
    欠片積めて 爆誕する奇跡
    回复

    使用道具 举报

    160

    主题

    6

    听众

    1万

    积分

    超级版主

    蜀山剑侠银行行长

    超级版主

  • TA的每日心情
    开心
    前天 21:35
  • 签到天数: 858 天

    [LV.10]以坛为家III

    精华
    3
    积分
    13202
    历练
    7
    声望
    24
    人气
    2361

    金融巨子 润泽万物 坚若磐石

    单身中……
    帮我摆脱单身吧
    4
    发表于 2010-7-10 14:27:31 |只看该作者
    说说啊。
    于是饮酒乐甚,扣舷而歌之。歌曰:“桂棹兮兰桨,击空明兮溯流光。残阳阳兮是羊羊,吾乃最爱南宫煌。”
    回复

    使用道具 举报

    1008

    主题

    5

    听众

    2万

    积分

    返璞归真

    不器用な星の瞬き

    会员等级: 10

  • TA的每日心情
    擦汗
    2024-4-17 22:49
  • 签到天数: 1362 天

    [LV.10]以坛为家III

    精华
    2
    积分
    23735
    历练
    3
    声望
    133
    人气
    2536

    转帖之王 金融巨子 黑色羽翼

    单身中……
    帮我摆脱单身吧
    5
    发表于 2010-7-10 14:29:11 |只看该作者
    让要用的人自己找吧……
    夜空の星に 捧げた願いの
    欠片積めて 爆誕する奇跡
    回复

    使用道具 举报

    160

    主题

    6

    听众

    1万

    积分

    超级版主

    蜀山剑侠银行行长

    超级版主

  • TA的每日心情
    开心
    前天 21:35
  • 签到天数: 858 天

    [LV.10]以坛为家III

    精华
    3
    积分
    13202
    历练
    7
    声望
    24
    人气
    2361

    金融巨子 润泽万物 坚若磐石

    单身中……
    帮我摆脱单身吧
    6
    发表于 2010-7-10 14:39:43 |只看该作者
    反正我不用,我只是发脚本的。
    于是饮酒乐甚,扣舷而歌之。歌曰:“桂棹兮兰桨,击空明兮溯流光。残阳阳兮是羊羊,吾乃最爱南宫煌。”
    回复

    使用道具 举报

    1008

    主题

    5

    听众

    2万

    积分

    返璞归真

    不器用な星の瞬き

    会员等级: 10

  • TA的每日心情
    擦汗
    2024-4-17 22:49
  • 签到天数: 1362 天

    [LV.10]以坛为家III

    精华
    2
    积分
    23735
    历练
    3
    声望
    133
    人气
    2536

    转帖之王 金融巨子 黑色羽翼

    单身中……
    帮我摆脱单身吧
    7
    发表于 2010-7-10 14:41:58 |只看该作者
    其实拿到脚本后看一遍,基本上都能找出
    夜空の星に 捧げた願いの
    欠片積めて 爆誕する奇跡
    回复

    使用道具 举报

    160

    主题

    6

    听众

    1万

    积分

    超级版主

    蜀山剑侠银行行长

    超级版主

  • TA的每日心情
    开心
    前天 21:35
  • 签到天数: 858 天

    [LV.10]以坛为家III

    精华
    3
    积分
    13202
    历练
    7
    声望
    24
    人气
    2361

    金融巨子 润泽万物 坚若磐石

    单身中……
    帮我摆脱单身吧
    8
    发表于 2010-7-16 18:56:18 |只看该作者
    本帖最后由 最爱南宫煌 于 2010-7-16 18:59 编辑

    - -由于黑猫同志的怀疑,我找了一个修改版的,原作者说,这个修改版修正了一个冲突,但忘了具体是什么……(佩服这位仁兄的记性)
    可是那个在电子书文件里,无法复制,所以,没办法……
    于是饮酒乐甚,扣舷而歌之。歌曰:“桂棹兮兰桨,击空明兮溯流光。残阳阳兮是羊羊,吾乃最爱南宫煌。”
    回复

    使用道具 举报

    1008

    主题

    5

    听众

    2万

    积分

    返璞归真

    不器用な星の瞬き

    会员等级: 10

  • TA的每日心情
    擦汗
    2024-4-17 22:49
  • 签到天数: 1362 天

    [LV.10]以坛为家III

    精华
    2
    积分
    23735
    历练
    3
    声望
    133
    人气
    2536

    转帖之王 金融巨子 黑色羽翼

    单身中……
    帮我摆脱单身吧
    9
    发表于 2010-7-16 19:08:41 |只看该作者
    我是说一个很NC的错误
    夜空の星に 捧げた願いの
    欠片積めて 爆誕する奇跡
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 加入我们

    手机版|Archiver|仙剑之十里坡 ( 苏ICP备11022766号 )  

    GMT+8, 2024-4-30 00:06 , Processed in 0.722355 second(s), 45 queries .

    Powered by Discuz! X2.5

    © 2001-2012 Comsenz Inc.

    回顶部