赞 | 153 |
VIP | 10 |
好人卡 | 39 |
积分 | 93 |
经验 | 146191 |
最后登录 | 2024-5-6 |
在线时间 | 2504 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 9280
- 在线时间
- 2504 小时
- 注册时间
- 2011-5-20
- 帖子
- 15389
|
- #==============================================================================
- # ■ 提高游戏速度(v1.0.1) by 一箭烂
- #------------------------------------------------------------------------------
- # 设置Graphics的@speed_lv以提高游戏速度,
- # 请插在main以上的位置
- #
- # 属性:
- #
- # Graphics.speed_lv
- # 加快速度(倍数), 可修改
- #
- # 更新:
- #
- # - *1.0.1* (2011-04-21) By 一箭烂(YiJL)
- # *改了alias的办法, 解决F12问题
- # *换了速度变量的方式
- #
- # - *1.0.0* (2011-04-21) By 一箭烂(YiJL)
- # *初版
- # *对Graphics.frame_count的修正
- #
- #==============================================================================
- module Graphics
- @speed_lv = 2 # 加快速度(倍数)
- @timer = 0
- @speed_update = method("update") unless @speed_update
- #--------------------------------------------------------------------------
- # ● Graphics.update
- #--------------------------------------------------------------------------
- def self.update
- @timer += 1
- @timer %= @speed_lv
- if @timer >= (@speed_lv - 1)
- @speed_update.call # 更新游戏画面
- Graphics.frame_count -= 1
- end
- Graphics.frame_count += 1
- end
- #--------------------------------------------------------------------------
- # ● Graphics.speed_lv
- #--------------------------------------------------------------------------
- def self.speed_lv
- @speed_lv
- end
- #--------------------------------------------------------------------------
- # ● Graphics.speed_lv=
- #--------------------------------------------------------------------------
- def self.speed_lv=(value)
- @speed_lv = value
- end
- end
复制代码 这个脚本插到脚本编辑器最上面这个插到脚本编辑器的Main上面,其他脚本下面
顺便给容错脚本省的你问了- #==============================================================================
- # ■ 凌的容错脚本 v3 [120929]
- #------------------------------------------------------------------------------
- # 解决游戏因发布时缺少文件等错误而使游戏无法正常进行的问题。
- # 附赠功能:创建多层文件夹
- # By 凌童鞋(66RPG)
- #==============================================================================
- # [120927]:基础版,支持Bitmap及Audio容错
- # [120928]:修正IOError问题,感谢orzFly和雷达喵
- # [120928]:支持Graphics.transition容错及save_data自动创建目录
- # 修正部分BUG,感谢霜月冬音
- #==============================================================================
- File.open("errors.txt","w+"){|io|}
- class Dir
- class << self
- alias :lynn_mkdir :mkdir unless $@
- end
- def self.mkdir(path, mode = 0777)
- last_dir = ""
- path.gsub(/\w*\//) {|m|
- m.gsub(/\/|\\/){}
- if last_dir != ""
- last_dir = "#{last_dir}/#{m}"
- else
- last_dir = "#{m}"
- end
- if !FileTest.exist?(m) && !FileTest.directory?(m)
- self.lynn_mkdir(last_dir)
- end
- }
- end
- end
- module Kernel
- def write_errors(argu)
- open("errors.txt","a+"){|io| io.write(argu+"\n")if !io.read.to_s.include?(argu)}
- end
- def save_data(obj, filename)
- Dir.mkdir(filename) unless FileTest.exist?(filename)
- File.open(filename, "wb") { |io|
- Marshal.dump(obj, io)
- }
- end
- end
- class Bitmap
- alias :lynn_initialize :initialize unless $@
- def initialize(* argu)
- begin
- lynn_initialize(* argu)
- rescue Errno::ENOENT
- lynn_initialize(1,1)
- write_errors "Error:File not found on Bitmap.new\n#{argu[0]}"
- end
- end
- end
- module Audio
- class << self
- alias_method :lynn_bgm_play, :bgm_play unless $@
- alias_method :lynn_bgs_play, :bgs_play unless $@
- alias_method :lynn_me_play, :me_play unless $@
- alias_method :lynn_se_play, :se_play unless $@
- end
- def self.bgm_play(* argu)
- begin
- self.lynn_bgm_play(* argu)
- rescue Errno::ENOENT
- write_errors "Error:File not found on Audio.bgm_play\n#{argu[0]}"
- end
- end
- def self.bgs_play(* argu)
- begin
- self.lynn_bgs_play(* argu)
- rescue Errno::ENOENT
- write_errors "Error:File not found on Audio.bgs_play\n#{argu[0]}"
- end
- end
- def self.me_play(* argu)
- begin
- self.lynn_me_play(* argu)
- rescue Errno::ENOENT
- write_errors "Error:File not found on Audio.me_play\n#{argu[0]}"
- end
- end
- def self.se_play(* argu)
- begin
- self.lynn_se_play(* argu)
- rescue Errno::ENOENT
- write_errors "Error:File not found on Audio.se_play\n#{argu[0]}"
- end
- end
- end
- module Graphics
- class << self
- alias_method :lynn_transition, :transition unless $@
- end
- def self.transition(duration = 8, filename = "", vague = 40)
- if filename != ""
- if !FileTest.exist?(filename)
- write_errors "Error:File not found on Graphics.transition\n#{filename}"
- filename = ""
- end
- end
- self.lynn_transition(duration,filename,vague)
- end
- end
复制代码- #==============================================================================
- # ■ 凌的容错脚本 v3 附加包 [120929] [RMXP版本]
- #------------------------------------------------------------------------------
- # 解决游戏因发布时缺少文件等错误而使游戏无法正常进行的问题。
- #==============================================================================
- # [120929]:支援在事件中执行脚本的容错功能,同时输出所在地图与事件ID
- #==============================================================================
- # * 注意本脚本只能用于标准事件解释器结构的工程
- #==============================================================================
- class Interpreter
- #--------------------------------------------------------------------------
- # ● 脚本
- #--------------------------------------------------------------------------
- def command_355
- # script 设置第一行
- script = @list[@index].parameters[0] + "\n"
- # 循环
- loop do
- # 下一个事件指令在脚本 2 行以上的情况下
- if @list[@index+1].code == 655
- # 添加到 script 2 行以后
- script += @list[@index+1].parameters[0] + "\n"
- # 事件指令不在脚本 2 行以上的情况下
- else
- # 中断循环
- break
- end
- # 推进索引
- @index += 1
- end
- # 评价
- result = eval(script)
- # 返回值为 false 的情况下
- if result == false
- # 结束
- return false
- end
- # 继续
- return true
- end
- end
复制代码 容错脚本(2个要按顺序)放在Main上面,第二个脚本下面 |
|