标题: L&B CG系统报错 [打印本页] 作者: 泥路留痕 时间: 2013-7-16 13:49 标题: L&B CG系统报错 第一次发帖,请各位包涵。
标题:为什么L&B CG系统报错,请求解决方案。
因为脚本简单,故不提供工程和图片,请见谅。
随意新建工程,将以下脚本粘贴入工程。(注释为原作者添加,脚本第46行报错,已标记。错误原因:include?未定义。)
此脚本只需在事件中显示过前缀为cg的并且在PICYURES文件夹下的图片,即可自动存入数据库。(Graphics/Pictures/cg*)
望各位能够指出错误,谢谢!
=begin
class RPG::System
def cg_open
if @cg_open.nil?
return (@cg_open = [])
else
return @cg_open
end
end
end
=end
class Interpreter
alias baozi_is_a_gay_command_231 command_231
def command_231
$cg_list |= ["Graphics/Pictures/#{@parameters[1]}"]
save_data($cg_list, "Data/CG_List.rxdata")
baozi_is_a_gay_command_231
end
def open_all_cg
arr = Dir["Graphics/Pictures/cg*"]
arr.delete(".")
arr.delete("..")
arr.each{|line| line[-4,4] = ""}
$cg_list |= arr
save_data($cg_list, "Data/CG_List.rxdata")
end
end
class Scene_CG
def main
#changeTitle("CG鉴赏".to_ansi + "\000")
@preview = []
@bg = Window_Base.new(0,0,640,480)
@bg.z = -1000
@secected = -1
@cg_detail = Sprite.new
arr = Dir["Graphics/Pictures/cg*"]
arr.delete(".")
arr.delete("..")
arr.each{|line| line[-4,4] = ""}
#@cgs = arr & $cg_list
#for i in 0...arr.size
# if arr[i]
@cgs = arr
for bn in 0...arr.size
if $cg_list.include?(arr[bn])###########################这里报错!!!###################
s = Sprite.new
s.bitmap = Bitmap.new(arr[bn])
s.zoom_x = 0.2
s.zoom_y = 0.2
s.z = 999
s.x = bn % 4 * 160 + 16
s.y = (bn / 4).truncate * 120 + 16
@preview.push(s)
else
s = Sprite.new
s.bitmap = Bitmap.new(128,96)
s.bitmap.draw_text(0,(96 - 32)/2,128,32,"未取得此CG",1)
s.z = 999
s.x = bn % 4 * 160 + 16
s.y = (bn / 4).truncate * 120 + 16
@preview.push(s)
end
end
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入情报
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
Graphics.freeze
for i in @preview
i.dispose
end
@bg.dispose
end
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @cg_detail.z == 1000
@cg_detail.z = -1000
@cg_detail.bitmap = nil
else
$scene = Scene_Title.new(true)
end
end
return if @preview.empty?
x,y = Mouse.get_mouse_pos
for i in @preview
if x >= i.x && x <= (i.x + i.bitmap.width*i.zoom_x) && y >= i.y && y <= (i.y + i.zoom_y*i.bitmap.height)
@bg.cursor_rect = Rect.new(i.x-17,i.y-17,130,98)
end
end
if Input.trigger?(Input::C)
for i in @preview
if x >= i.x && x <= (i.x + i.bitmap.width) && y >= i.y && y <= (i.y + i.bitmap.height)
@selected = @preview.index(i)
end
end
if $cg_list.include?(@cgs[@selected])
$game_system.se_play($data_system.decision_se)
@cg_detail.bitmap = @preview[@selected].bitmap
@cg_detail.z = 1000
else
$game_system.se_play($data_system.buzzer_se)
end
end
end
end
注:此脚本应该是独立的。作者: 泥路留痕 时间: 2013-7-17 09:56 本帖最后由 泥路留痕 于 2013-7-18 14:50 编辑