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

Project1

 找回密码
 注册会员
搜索
查看: 4525|回复: 11

[讨论] XP 脚本 模组化运动 & 全系列补完

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
462 小时
注册时间
2007-7-30
帖子
643
发表于 2010-11-14 23:31:11 | 显示全部楼层 |阅读模式

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

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

x
介于 VX 脚本有很好的模组化示范
XP 的脚本就到没那么有系列化的整理
(虽然偶比较喜欢 XP...)

所以在这里发起 XP 脚本 模组化运动
当然不是把脚本通通写成模组(Modules)
而是像 VX 那样有着良好的继承关系

在整理 XP 脚本的同时
希望也能一并附加上某些常用到的特殊功能(例: String 转码...)

也希望能够遵循以下MS是规则的东东
1. 不破坏原本架构=> 这是当然的, 要不RMXP 就只能靠脚本生存了= =|
2. 能附上良好的注释=> 让大家看懂你在做啥...
3. 发问请至沙发善用点评若针对某脚本可以在该帖点评=> 因为点评只有发帖者会收到提醒, 回覆时请记得PM对方
4. 请抱着学习的心态来完成=> 一边磨练脚本嘛...
5. 请保持过程身心愉悦

于是让我们开始吧~~

点评

Unicode <=> UTF-8 <=> GBK ...  发表于 2010-11-15 20:10
string转码是。。。?  发表于 2010-11-15 13:21

评分

参与人数 1星屑 +2 收起 理由
fux2 + 2 点亮加分图标

查看全部评分

RGE这万年大坑 啥时填起来@@

Lv1.梦旅人

梦石
0
星屑
50
在线时间
462 小时
注册时间
2007-7-30
帖子
643
 楼主| 发表于 2010-11-14 23:31:17 | 显示全部楼层
本帖最后由 david50407 于 2010-11-15 23:52 编辑

于是S系列采用禾西的当作基础吧...
过几天整理整理我写的再放上来
RGE这万年大坑 啥时填起来@@

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
245
在线时间
227 小时
注册时间
2009-7-26
帖子
216
发表于 2010-11-15 00:35:42 | 显示全部楼层
这个很不错的样子(个人也是比较喜欢XP……主要是……VX的人物总是方的很纠结……)
这里提到的继承关系是指把无意义的重复代码给做成父类然后继承的意思么?
(顺便把一些写的垃圾的代码给优化下)
P.S. 不过一个人估计应该是做不来,多人做估计会做重复工……是不是具体分工下效率比较高……

点评

恩... 分工吗? 我觉得只要有个主架构 然后沙发给人声明进度就好  发表于 2010-11-15 20:04
不要吐槽我⋯⋯
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7926
在线时间
1181 小时
注册时间
2007-7-29
帖子
2055
发表于 2010-11-15 00:40:42 | 显示全部楼层
本帖最后由 enghao_lim 于 2010-11-15 00:42 编辑

对xp比较有爱,如果有用我愿意意帮忙,
只是有点不解?是类似SDK这样的运动?

点评

基本上完全明白了。这活动很有爱,找个空闲的时间我来写写几个。  发表于 2010-11-16 15:56
基本上完全明白了。这活动很有爱,找个空闲的时间我来写写几个。  发表于 2010-11-16 15:55
基本上完全明白了。这活动很有爱,找个空闲的时间我来写写几个。  发表于 2010-11-16 15:51
不过也希望能有类似SDK的帮助文档(毕竟被重写了嘛~~  发表于 2010-11-16 14:05
SDK其实也有父类继承的说。  发表于 2010-11-15 21:53
回复 支持 反对

使用道具 举报

Lv2.观梦者

酱油的

梦石
0
星屑
930
在线时间
2161 小时
注册时间
2007-12-22
帖子
3271

贵宾

发表于 2010-11-15 03:53:59 | 显示全部楼层
本帖最后由 禾西 于 2010-11-15 04:04 编辑

哦?終于有人提出這個計劃了嗎?好吧,那麼最萌的scene_base先上

@wins[Symbol] = Window Obj #加入窗口實例
note: 將窗口加入wins中可以不需考慮釋放的問題
  1. #=================================================================
  2. # ■ ::Scene_Base / 原始介面類
  3. #// Date 2.11.09
  4. #// Ver. 1.01
  5. #// by 禾西
  6. #------------------------------------------------------------------------------
  7. class Scene_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 主处理
  10.   #--------------------------------------------------------------------------
  11.   def main
  12.     @wins  = {}
  13.     start
  14.     # 执行过渡
  15.     Graphics.transition
  16.     # 主循环
  17.     loop do
  18.       Input.update      #刷新「輸入信息」
  19.       Graphics.update   #刷新「游戏畫面」
  20.       # 刷新画面
  21.       update
  22.       # 如果切换画面就中断循环
  23.       break if $scene != self
  24.     end
  25.     # 准备过渡
  26.     Graphics.freeze
  27.     @wins.each_value do |window| window.dispose end
  28.     terminate
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 开始
  32.   #--------------------------------------------------------------------------
  33.   def start
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 刷新
  37.   #--------------------------------------------------------------------------
  38.   def update
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 终止
  42.   #--------------------------------------------------------------------------
  43.   def terminate
  44.   end
  45. end
复制代码
一般來說,你只需要重定義 start、update、terminate就可以了。
而事實上,如果你把window丟進@win中,連terminate都不需要。
這是一個 Scene_End 的范例:

  1. class Scene_End < Scene_Base
  2.   #--------------------------------------------------------------------------
  3.   # ● 开始
  4.   #--------------------------------------------------------------------------
  5.   def start
  6.     # 生成命令窗口
  7.     s1 = "返回标题画面"
  8.     s2 = "退出"
  9.     s3 = "取消"
  10.     @wins[:command] = Window_Command.new(192, [s1, s2, s3])
  11.     @wins[:command].x = 320 - @wins[:command].width / 2
  12.     @wins[:command].y = 240 - @wins[:command].height / 2
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 刷新画面
  16.   #--------------------------------------------------------------------------
  17.   def update
  18.     # 刷新命令窗口
  19.     @wins[:command].update
  20.     # 按下 B 键的情况下
  21.     if Input.trigger?(Input::B)
  22.       # 演奏取消 SE
  23.       $game_system.se_play($data_system.cancel_se)
  24.       # 切换到菜单画面
  25.       $scene = Scene_Menu.new(5)
  26.       return
  27.     end
  28.     # 按下 C 键的场合下
  29.     if Input.trigger?(Input::C)
  30.       # 命令窗口光标位置分支
  31.       case @wins[:command].index
  32.       when 0  # 返回标题画面
  33.         command_to_title
  34.       when 1  # 退出
  35.         command_shutdown
  36.       when 2  # 取消
  37.         command_cancel
  38.       end
  39.       return
  40.     end
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # ● 选择命令 [返回标题画面] 时的处理
  44.   #--------------------------------------------------------------------------
  45.   def command_to_title
  46.     # 演奏确定 SE
  47.     $game_system.se_play($data_system.decision_se)
  48.     # 淡入淡出 BGM、BGS、ME
  49.     Audio.bgm_fade(800)
  50.     Audio.bgs_fade(800)
  51.     Audio.me_fade(800)
  52.     # 切换到标题画面
  53.     $scene = Scene_Title.new
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● 选择命令 [退出] 时的处理
  57.   #--------------------------------------------------------------------------
  58.   def command_shutdown
  59.     # 演奏确定 SE
  60.     $game_system.se_play($data_system.decision_se)
  61.     # 淡入淡出 BGM、BGS、ME
  62.     Audio.bgm_fade(800)
  63.     Audio.bgs_fade(800)
  64.     Audio.me_fade(800)
  65.     # 退出
  66.     $scene = nil
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 选择命令 [取消] 时的处理
  70.   #--------------------------------------------------------------------------
  71.   def command_cancel
  72.     # 演奏确定 SE
  73.     $game_system.se_play($data_system.decision_se)
  74.     # 切换到菜单画面
  75.     $scene = Scene_Menu.new(5)
  76.   end
  77. end
复制代码
召喚腳本上色功能,召喚腳本縮放功能……

点评

命令窗口 的命令也模组化吧 (笑  发表于 2010-11-15 20:13

评分

参与人数 1星屑 +40 收起 理由
david50407 + 40 Good~

查看全部评分

不做頭像做簽名,看我囧冏有神(多謝山人有情提供 )
回复 支持 反对

使用道具 举报

Lv2.观梦者

酱油的

梦石
0
星屑
930
在线时间
2161 小时
注册时间
2007-12-22
帖子
3271

贵宾

发表于 2010-11-15 04:43:52 | 显示全部楼层
本帖最后由 禾西 于 2010-11-15 05:03 编辑

另外一個是 Window_Selectable
update 被斬開了。新增了on_left, on_right, on_up, on_down, on_L, on_R 方法來直接重定義鍵盤信息處理。
  1. #==============================================================================
  2. # ■ Wnd_Selectable / 拥有光标的移动以及滚动功能的原始窗口类。
  3. # Date 08.06.10
  4. # Draft 2 by 禾西
  5. # Ver 1.1
  6. # < Window_Base < Window
  7. #==============================================================================
  8. # 用變量 @rowh 代替列高
  9. # 增加 #.close 方法來unactivate window
  10. # update_cursor_rect 只在光標位置變更才調用
  11. # 增加 on_left, on_right, on_up, on_down, on_L, on_R 方法
  12. #------------------------------------
  13. class Wnd_Selectable < Window_Base
  14.   #--------------------------------------------------------------------------
  15.   # ● 凍結選擇
  16.   #--------------------------------------------------------------------------
  17.   def close
  18.     @index = 0
  19.     update_cursor_rect
  20.     self.cursor_rect.empty
  21.     @index =-1
  22.   end
  23. #==============================================================================
  24. # 原始方法
  25. #==============================================================================
  26.   #--------------------------------------------------------------------------
  27.   # ● 定义实例变量
  28.   #--------------------------------------------------------------------------
  29.   attr_reader   :index                    # 光标位置
  30.   attr_reader   :help_window              # 帮助窗口
  31.   #--------------------------------------------------------------------------
  32.   # ● 初始画对像
  33.   #     x      : 窗口的 X 坐标
  34.   #     y      : 窗口的 Y 坐标
  35.   #     width  : 窗口的宽
  36.   #     height : 窗口的高
  37.   #--------------------------------------------------------------------------
  38.   def initialize(x, y, width, height)
  39.     @item_max   ||= 1
  40.     @column_max ||= 1
  41.     @index ||= -1
  42.     @rowh  ||= 32
  43.     super(x, y, width, height)
  44.   end
  45.   #--------------------------------------------------------------------------
  46.   # ● 设置光标的位置
  47.   #     index : 新的光标位置
  48.   #--------------------------------------------------------------------------
  49.   def index=(index)
  50.     @index = index
  51.     # 刷新帮助文本 (update_help 定义了继承目标)
  52.     if self.active and @help_window != nil
  53.       update_help
  54.     end
  55.     # 刷新光标矩形
  56.     update_cursor_rect
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # ● 获取行数
  60.   #--------------------------------------------------------------------------
  61.   def row_max
  62.     # 由项目数和列数计算出行数
  63.     return (@item_max + @column_max - 1) / @column_max
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 获取开头行
  67.   #--------------------------------------------------------------------------
  68.   def top_row
  69.     # 将窗口内容的传送源 Y 坐标、1 行的高 @rowh 等分
  70.     return self.oy / @rowh
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 设置开头行
  74.   #     row : 显示开头的行
  75.   #--------------------------------------------------------------------------
  76.   def top_row=(row)
  77.     # row 未满 0 的场合更正为 0
  78.     if row < 0
  79.       row = 0
  80.     end
  81.     # row 超过 row_max - 1 的情况下更正为 row_max - 1
  82.     if row > row_max - 1
  83.       row = row_max - 1
  84.     end
  85.     # row 1 行高的 @rowh 倍、窗口内容的传送源 Y 坐标
  86.     self.oy = row * @rowh
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 获取 1 页可以显示的行数
  90.   #--------------------------------------------------------------------------
  91.   def page_row_max
  92.     # 窗口的高度,设置画面的高度减去 @rowh ,除以 1 行的高度 @rowh
  93.     return (self.height - @rowh) / @rowh
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 获取 1 页可以显示的项目数
  97.   #--------------------------------------------------------------------------
  98.   def page_item_max
  99.     # 将行数 page_row_max 乘上列数 @column_max
  100.     return page_row_max * @column_max
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● 帮助窗口的设置
  104.   #     help_window : 新的帮助窗口
  105.   #--------------------------------------------------------------------------
  106.   def help_window=(help_window)
  107.     @help_window = help_window
  108.     # 刷新帮助文本 (update_help 定义了继承目标)
  109.     if self.active and @help_window != nil
  110.       update_help
  111.     end
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 更新光标举行
  115.   #--------------------------------------------------------------------------
  116.   def update_cursor_rect
  117.     # 光标位置不满 0 的情况下
  118.     if @index < 0
  119.       self.cursor_rect.empty
  120.       return
  121.     end
  122.     # 获取当前的行
  123.     row = @index / @column_max
  124.     # 当前行被显示开头行前面的情况下
  125.     if row < self.top_row
  126.       # 从当前行向开头行滚动
  127.       self.top_row = row
  128.     end
  129.     # 当前行被显示末尾行之后的情况下
  130.     if row > self.top_row + (self.page_row_max - 1)
  131.       # 从当前行向末尾滚动
  132.       self.top_row = row - (self.page_row_max - 1)
  133.     end
  134.     # 计算光标的宽
  135.     cursor_width = self.width / @column_max - @rowh
  136.     # 计算光标坐标
  137.     x = @index % @column_max * (cursor_width + @rowh)
  138.     y = @index / @column_max * @rowh - self.oy
  139.     # 更新国标矩形
  140.     self.cursor_rect.set(x, y, cursor_width, @rowh)
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 刷新画面
  144.   #--------------------------------------------------------------------------
  145.   def update
  146.     super
  147.     # 可以移动光标的情况下
  148.     if self.active and @item_max >= 0 and @index >= 0
  149.       on_down()  if Input.repeat?(Input::DOWN) # 方向键下被按下
  150.       on_up()    if Input.repeat?(Input::UP)   # 方向键上被按下
  151.       on_right() if Input.repeat?(Input::RIGHT)# 方向键右被按下
  152.       on_left()  if Input.repeat?(Input::LEFT) # 方向键左被按下
  153.       on_R() if Input.repeat?(Input::R)# R 键被按下
  154.       on_L() if Input.repeat?(Input::L)# L 键被按下
  155.     end
  156.     # 刷新帮助文本 (update_help 定义了继承目标)
  157.     if self.active and @help_window != nil
  158.       update_help
  159.     end
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 下
  163.   #--------------------------------------------------------------------------
  164.   def on_down
  165.     return if @item_max <= 0
  166.     # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  167.     # 或光标位置在(项目数-列数)之前的情况下
  168.     if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
  169.     true#@index <= @item_max - @column_max #<==話說這個東東有啥有--a
  170.       # 光标向下移动
  171.       $game_system.se_play($data_system.cursor_se)
  172.       self.index = (@index + @column_max) % @item_max
  173.     end
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● 上
  177.   #--------------------------------------------------------------------------
  178.   def on_up
  179.     return if @item_max <= 0
  180.     # 列数不是 1 并且方向键的下的按下状态不是重复的情况、
  181.     # 或光标位置在列之后的情况下
  182.     if (@column_max == 1 and Input.trigger?(Input::UP)) or
  183.     true#@index >= @column_max #<==話說這個東東有啥有--a
  184.       # 光标向上移动
  185.       $game_system.se_play($data_system.cursor_se)
  186.       self.index = (@index - @column_max + @item_max) % @item_max
  187.     end
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ● 右
  191.   #--------------------------------------------------------------------------
  192.   def on_right
  193.     # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
  194.     if @column_max >= 2 and @index < @item_max - 1
  195.       # 光标向右移动
  196.       $game_system.se_play($data_system.cursor_se)
  197.       self.index += 1
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● 左
  202.   #--------------------------------------------------------------------------
  203.   def on_left
  204.     # 列数为 2 以上并且、光标位置在(项目数 - 1)之前的情况下
  205.     if @column_max >= 2 and @index > 0
  206.       # 光标向右移动
  207.       $game_system.se_play($data_system.cursor_se)
  208.       self.index -= 1
  209.     end
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● R
  213.   #--------------------------------------------------------------------------
  214.   def on_R
  215.     # 显示的最后行在数据中最后行上方的情况下
  216.     if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  217.       # 光标向后移动一页
  218.       $game_system.se_play($data_system.cursor_se)
  219.       self.top_row += self.page_row_max
  220.       self.index = [@index + self.page_item_max, @item_max - 1].min
  221.     end
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● L
  225.   #--------------------------------------------------------------------------
  226.   def on_L
  227.     # 显示的开头行在位置 0 之后的情况下
  228.     if self.top_row > 0
  229.       # 光标向前移动一页
  230.       $game_system.se_play($data_system.cursor_se)
  231.       self.top_row -= self.page_row_max
  232.       self.index = [@index - self.page_item_max, 0].max
  233.     end
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● 虛函數
  237.   #--------------------------------------------------------------------------
  238.   def update_help
  239.   end
  240. end
复制代码
這應該是個很好的示例,這個選擇窗口需要特殊的行高,同時也是斜向排布的,因此我需要把左、下二鍵;上右二鍵的行為設為一致:
  1. class Window_Command < Wnd_Selectable
  2.   #--------------------------------------------------------------------------
  3.   # ● 初始化对像
  4.   #     width    : 窗口的宽
  5.   #     commands : 命令字符串序列
  6.   #--------------------------------------------------------------------------
  7.   def initialize(commands)
  8.     @item_max = commands.size # 重定義的 item_max
  9.     @commands = commands
  10.     @rowh  = 64 # 重定義的 rowh
  11.     super(-16, -16, 740, 580)
  12.     self.windowskin = nil
  13.     self.contents = loadbitmap("Graphics/menu/menu1.png")
  14.     self.index = 0
  15.     self.z = 10
  16.     self.opacity = 0
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 索引
  20.   #--------------------------------------------------------------------------
  21.   def index=(int)
  22.     super(int)
  23.     if int >= 0
  24.       self.contents = loadbitmap("Graphics/menu/menu#{int+1}.png")
  25.     else
  26.       self.contents = nil
  27.     end
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 重定義的左鍵
  31.   #--------------------------------------------------------------------------
  32.   def on_left
  33.     on_down
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 重定義的右鍵
  37.   #--------------------------------------------------------------------------
  38.   def on_right
  39.     on_up
  40.   end
  41. end
复制代码

点评

精灵想起了以前我写的《上下左右都可以选择的脚本》  发表于 2010-11-16 17:23
其實下面那個是示例,重定義了Window_Command……  发表于 2010-11-16 00:56
左、下二鍵;上右二鍵的行為設為一致:用 alias 如何?  发表于 2010-11-15 20:06
其实不一定要保持Window_Command 之类的名称 额... 我的意思是也可以这样命名WCommand STitle 之类的(如果全部整理的话就没有必要完全照原来的名称了)  发表于 2010-11-15 20:03
不做頭像做簽名,看我囧冏有神(多謝山人有情提供 )
回复 支持 反对

使用道具 举报

Lv2.观梦者

酱油的

梦石
0
星屑
930
在线时间
2161 小时
注册时间
2007-12-22
帖子
3271

贵宾

发表于 2010-11-15 04:48:37 | 显示全部楼层
三連擊。以上兩個腳本都是新增的腳本,可以和原腳本并存。可以當作另一套kit?(笑)

点评

恩  发表于 2010-11-15 20:08
不做頭像做簽名,看我囧冏有神(多謝山人有情提供 )
回复 支持 反对

使用道具 举报

Lv1.梦旅人

辉瑞中国首席研究员<

梦石
0
星屑
50
在线时间
142 小时
注册时间
2008-1-18
帖子
2129
发表于 2010-11-15 12:57:07 | 显示全部楼层
说实话,这就是我觉得VX脚本看着不顺眼的地方
可能是我这只彩笔跟高手的区别吧
来6r就是等某位仁兄的巨坑

褴褛着身行无端,囊中羞涩空心酸。
平生几无得意事,倒塔泡面宅寝室。
惟羡隔壁高帅富,雨露春风月夜声。
青丝无处觅其踪,只有硬盘苍井空。
莫云男儿空悲愁,鸿鹄岂不天际游。
坐断天下执鹿首,千百金帛万兜鍪。
夜深忽梦某年月,再见女神欲语迟。
吊丝终有逆袭日,木耳再无回粉时。
回复 支持 反对

使用道具 举报

乌有君
乌有君  发表于 2010-11-15 13:48:17
本帖最后由 匿名 于 2010-11-15 13:54 编辑

于是……人类又开始逐步接近黑幕中的某些神秘力量了么(大雾)
搬个板凳围观一下

另:
其实所有窗口类只需要一个窗口类即可……
所有场景类只需要一个场景类即可……
去掉下面那个窗口中和MESSAGE类似的东西之外,汝等能发现什么微妙之处么

  1. class Window_tessst < Window_Base
  2.   #这只是另一个低调的黑幕脚本
  3.   def initialize( x , y , weight , height , texxt )
  4.      super(x, y, weight, height)
  5.      self.contents = Bitmap.new(width - 32, height - 32)
  6.      self.z = 9998
  7.      @texxt = texxt
  8.      @tasklist = []
  9.      refresh
  10.    end
  11.    def pushtask(task)
  12.      @tasklist.push(task)
  13.    end
  14.    def settask(task)
  15.      @tasklist = task
  16.    end
  17.    def deletetask(task)
  18.      @tasklist.delete(task)
  19.    end
  20.    def cleantask
  21.      @tasklist = []
  22.    end
  23.    
  24.    def refresh
  25.     new_contents_clear()
  26.     if @tasklist != nil and @tasklist != []
  27.       for i in @tasklist
  28.         eval(i)
  29.       end
  30.     end
  31.     self.contents.font.color = normal_color
  32.     x = y = 0
  33.     @cursor_width = 0
  34.    
  35.     # 有等待显示的文字的情况下
  36.     if @texxt != nil
  37.       text = @texxt.clone
  38.       # 限制文字处理
  39.       begin
  40.         last_text = text.clone
  41.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  42.       end until text == last_text
  43.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  44.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  45.       end
  46.       # 为了方便、将 "\\\\" 变换为 "\000"
  47.       text.gsub!(/\\\\/) { "\000" }
  48.       # "\\C" 变为 "\001" に、"\\G" 变为 "\002"
  49.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  50.       text.gsub!(/\\[Gg]/) { "\002" }
  51.       text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  52.       # c 获取 1 个字 (如果不能取得文字就循环)
  53.       while ((c = text.slice!(/./m)) != nil)
  54.         # \\ 的情况下
  55.         if c == "\000"
  56.           # 还原为本来的文字
  57.           c = "\\"
  58.         end
  59.         # \C[n] 的情况下
  60.         if c == "\001"
  61.           # 更改文字色
  62.           text.sub!(/\[([0-9]+)\]/, "")
  63.           color = $1.to_i
  64.           if color >= 0 and color <= 7
  65.             self.contents.font.color = text_color(color)
  66.           end
  67.           # 下面的文字
  68.           next
  69.         end
  70.         # \G 的情况下
  71.         if c == "\002"
  72.           # 生成金钱窗口
  73.           if @gold_window == nil
  74.             @gold_window = Window_Gold.new
  75.             @gold_window.x = 560 - @gold_window.width
  76.             if $game_temp.in_battle
  77.               @gold_window.y = 192
  78.             else
  79.               @gold_window.y = self.y >= 128 ? 32 : 384
  80.             end
  81.             @gold_window.opacity = self.opacity
  82.             @gold_window.back_opacity = self.back_opacity
  83.           end
  84.           # 下面的文字
  85.           next
  86.         end
  87.         
  88.         if c == "\025"
  89.           text.sub!(/\[([0-9]+)\]/, "")
  90.           self.contents.font.size = [[$1.to_i, 6].max, 32].min
  91.           next
  92.         end
  93.         # 另起一行文字的情况下
  94.         if c == "\n"
  95.           # 刷新选择项及光标的高
  96.           if y >= $game_temp.choice_start
  97.             @cursor_width = [@cursor_width, x].max
  98.           end
  99.           # y 加 1
  100.           y += 1
  101.           x = 0
  102.           # 移动到选择项的下一行
  103.           if y >= $game_temp.choice_start
  104.             x = 8
  105.           end
  106.           # 下面的文字
  107.           next
  108.         end
  109.         # 描绘文字
  110.         self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  111.         # x 为要描绘文字的加法运算
  112.         x += self.contents.text_size(c).width
  113.         end
  114.       end
  115.     end
  116.   def update
  117.     super
  118.   end
  119.   def setskin(name)
  120.       @windowskin_name = name
  121.       self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  122.   end
  123.   def settext(text)
  124.     @texxt = text
  125.   end  
  126.   def gettext
  127.     return @texxt
  128.   end

  129.   
  130.   
  131.   

  132. end
复制代码

点评

蛇前辈这里就不要捂得那么严实嘛,黑幕不能得分吖。  发表于 2010-11-16 14:31
6R BUG....  发表于 2010-11-16 14:07
对不起,你不能对匿名帖评分,请返回。 ... 本想+5的...  发表于 2010-11-16 14:07
对不起,你不能对匿名帖评分,请返回。 ... 本想+5的...  发表于 2010-11-16 14:06
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
462 小时
注册时间
2007-7-30
帖子
643
 楼主| 发表于 2010-11-16 14:20:13 | 显示全部楼层
于是自顶防淹没 + 补充
表示如果有人写的话就会 +分分
看禾西的时间应该是之前写的吧
没想到竟然会在这揭露出来 (大惊

感谢fux2的高亮亮~~

表示先预订 Window_Gold 之类的简单类
因为想做简单Window的整合扩充
预计是WShow.new(:gold, :time) 之类的方法

也整合鼠标如何? (笑
(设置个啥默认关闭就好)

点评

這東西其實很早就寫好了。不過想發布出來大概也沒有人會要,于是就黑幕了。09年以後寫的腳本基本上都沒有發布(笑  发表于 2010-11-16 14:46
难得一见的讨论帖不亮之怎行,本来想亮绿的,但不知道其他版主前辈意见如何,所以加粗。  发表于 2010-11-16 14:24
RGE这万年大坑 啥时填起来@@

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 09:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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