Project1
标题:
脚本截图存档20行发生了RuntimeError,求帮助
[打印本页]
作者:
wymrbwgq
时间:
2012-1-27 18:18
标题:
脚本截图存档20行发生了RuntimeError,求帮助
本帖最后由 wymrbwgq 于 2012-1-27 19:06 编辑
这是我的截图存档脚本
求帮助……
[/code]#===============================================================================[code]
复制代码
BBS_66RPG_DIR = "Save/" # 储存文件夹名,请制作游戏时自行建立此文件夹
[/code]
code]
复制代码
# 若想使用自定义背景图,脚本62行的井号去掉,并放置一张相应图形。
[/code]
[code]
复制代码
# 在你的Scene_Title中找到这一段(如果使用其他插件脚本,在插件中找):
[/code]# for i in 0..3
[code]
复制代码
# if FileTest.exist?("Save#{i+1}.rxdata")
[/code]# 请自行把0..3改为0..最大进度号,比如0..9
[code]
复制代码
# "Save#{i+1}.rxdata" 改为"Save/Save#{i}.rxdata"
[/code]
[code]
复制代码
# 增加进度的方法:138,258行,继续添加。你也可以改“进度X”为“回忆X”或者“红/绿/蓝笔记本”
[/code]
[code]
复制代码
# 注意:这个脚本是兼容亿万星辰的“轩辕剑菜单”的版本,不过用在其他场合貌似也不会出错
[/code]# 使用时把这个脚本放在“轩辕剑菜单”脚本的下方,也就是更靠近Main的位置
[code]
复制代码
# 兼容处理:叶子
[/code]#===============================================================================
[code]
复制代码
module Screen
[/code]@screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
[code]
复制代码
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
[/code]@findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
[code]
复制代码
module_function
[/code]#-----------------------------------------------------------------------------
[code]
复制代码
# here comes the stuff...
[/code]# i add here the stuff for automatic change of the number for the screenshot
[code]
复制代码
# so it wont overrite the old one...
[/code]# if you want to change so stuff change them in this line below
[code]
复制代码
# or you can change them in your command line... like
[/code]# Screen::shot("screenshot", 2)
[code]
复制代码
# this change the name and the type of the screenshot
[/code]# (0 = bmp, 1 = jpg and 2 = png)
[code]
复制代码
# ----------------------------------------------------------------------------
[/code]def shot(file = "shot", typ = 1)
[code]
复制代码
# to add the right extension...
[/code] if typ == 0
[code]
复制代码
typname = ".bmp"
[/code] elsif typ == 1
[code]
复制代码
typname = ".jpg"
[/code] elsif typ == 2
[code]
复制代码
typname = ".png"
[/code] end
[code]
复制代码
file_index = 0
[/code] dir = "Save/"
[code]
复制代码
# make the filename....
[/code] file_name = dir + file.to_s + typname.to_s
[code]
复制代码
if $shot_guodu == 1
[/code] file_name = "Graphics/Pictures/sys_screen.jpg"
[code]
复制代码
$shot_guodu = 0
[/code] end
[code]
复制代码
# make the screenshot.... Attention dont change anything from here on....
[/code] @screen.call(160,120,320,240,file_name,handel,typ)
[code]
复制代码
end
[/code]# find the game window...
[code]
复制代码
def handel
[/code] game_name = "\0" * 256
[code]
复制代码
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
[/code] game_name.delete!("\0")
[code]
复制代码
return @findwindow.call('RGSS Player',game_name)
[/code]end
[code]
复制代码
end
[/code]
[code]
复制代码
class Window_FileCommand < Window_Selectable
[/code] attr_accessor :index
[code]
复制代码
def initialize(index,zzhsavenumber)
[/code] @zzhsavenumber = zzhsavenumber
[code]
复制代码
super(-16,-8,640,430)
[/code] self.windowskin = nil
[code]
复制代码
self.contents = Bitmap.new(640, 480)
[/code] @index = index
[code]
复制代码
@commands = []
[/code] for i in 0..35
[code]
复制代码
@commands.push(i.to_s)
[/code] end
[code]
复制代码
@
[email protected]
[/code] self.opacity = 0
[code]
复制代码
end
[/code] def update
[code]
复制代码
self.top_row=($top_row)
[/code] self.contents.clear
[code]
复制代码
self_update
[/code] if self.active and @item_max > 0
[code]
复制代码
index_var = @index
[/code] tp_index = @index
[code]
复制代码
mouse_x, mouse_y = Mouse.get_mouse_pos
[/code] mouse_not_in_rect = true
[code]
复制代码
$mouse_not_in_rect = true
[/code] $zzhindex=@index
[code]
复制代码
for i in 0...@item_max
[/code] @index = i
[code]
复制代码
@zzhaaa_1=1
[/code] update_cursor_rect
[code]
复制代码
top_x = self.cursor_rect.x + self.x + 16
[/code] top_y = self.cursor_rect.y + self.y + 16
[code]
复制代码
bottom_x = top_x + self.cursor_rect.width
[/code] bottom_y = top_y + self.cursor_rect.height
[code]
复制代码
if (mouse_x > top_x) and (mouse_y > top_y) and
[/code] (mouse_x < bottom_x) and (mouse_y < bottom_y)
[code]
复制代码
mouse_not_in_rect = false
[/code] $mouse_not_in_rect= false
[code]
复制代码
$zzhindex=@index
[/code] if tp_index != @index
[code]
复制代码
tp_index = @index
[/code] $game_system.se_play($data_system.cursor_se)
[code]
复制代码
end
[/code] break
[code]
复制代码
end
[/code] end
[code]
复制代码
if mouse_not_in_rect
[/code] mouse_x, mouse_y = Mouse.get_mouse_pos
[code]
复制代码
# 当前行被显示开头行前面的情况下
[/code] if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT)and (mouse_x>500)and(mouse_x<545)and(mouse_y>383)and(mouse_y<408)
[code]
复制代码
self.top_row +=1
[/code] delay(0.1)
[code]
复制代码
end
[/code] # 当前行被显示末尾行之后的情况下
[code]
复制代码
if self.top_row > 0 and Mouse.press?(Mouse::LEFT)and (mouse_x>500)and(mouse_x<545)and(mouse_y>32)and(mouse_y<58)
[/code] # 从当前行向末尾滚动
[code]
复制代码
self.top_row -=1
[/code] delay(0.1)
[code]
复制代码
end
[/code] @index = index_var
[code]
复制代码
if self.is_a?(Window_Target)
[/code] @index=-3
[code]
复制代码
end
[/code] @zzhaaa_1=2
[code]
复制代码
update_cursor_rect
[/code] Mouse.click_lock
[code]
复制代码
else
[/code] Mouse.click_unlock
[code]
复制代码
end
[/code] end
[code]
复制代码
$top_row = self.top_row
[/code] end
[code]
复制代码
[/code] def update_cursor_rect
[code]
复制代码
# 光标位置不满 0 的情况下
[/code] if @index < 0
[code]
复制代码
self.cursor_rect.empty
[/code] return
[code]
复制代码
end
[/code] # 获取当前的行
[code]
复制代码
row = @index
[/code] # 当前行被显示开头行前面的情况下
[code]
复制代码
if row < self.top_row
[/code] # 从当前行向开头行滚动
[code]
复制代码
self.cursor_rect.empty
[/code] return
[code]
复制代码
end
[/code] # 当前行被显示末尾行之后的情况下
[code]
复制代码
if row > self.top_row + (self.page_row_max - 1)
[/code] # 从当前行向末尾滚动
[code]
复制代码
self.cursor_rect.empty
[/code] return
[code]
复制代码
end
[/code] # 计算光标坐标
[code]
复制代码
x = 8
[/code] y = 26 + @index * 92- self.oy
[code]
复制代码
# 更新国标矩形
[/code] self.cursor_rect.set(x, y, 490, 92)
[code]
复制代码
end
[/code]
[code]
复制代码
def top_row
[/code] # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
[code]
复制代码
return self.oy / 92
[/code] end
[code]
复制代码
#--------------------------------------------------------------------------
[/code] # ● 设置开头行
[code]
复制代码
# row : 显示开头的行
[/code] #--------------------------------------------------------------------------
[code]
复制代码
def top_row=(row)
[/code] # row 未满 0 的场合更正为 0
[code]
复制代码
if row < 0
[/code] row = 0
[code]
复制代码
end
[/code] # row 超过 row_max - 1 的情况下更正为 row_max - 1
[code]
复制代码
if row > row_max - 1
[/code] row = row_max - 1
[code]
复制代码
end
[/code] # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
[code]
复制代码
[/code] self.oy = row * 92
[code]
复制代码
[/code] end
[code]
复制代码
#--------------------------------------------------------------------------
[/code] # ● 获取 1 页可以显示的行数
[code]
复制代码
#--------------------------------------------------------------------------
[/code] def page_row_max
[code]
复制代码
# 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
[/code] return (self.height - 32) / 92
[code]
复制代码
end
[/code]
[code]
复制代码
def delay(seconds)
[/code] for i in 0...(seconds * 1)
[code]
复制代码
sleep 0.01
[/code] Graphics.update
[code]
复制代码
end
[/code] end
[code]
复制代码
[/code]end
[code]
复制代码
[/code]class Window_FilePicture2 < Window_Base
[code]
复制代码
def initialize
[/code] super(-16,-8,640,480)
[code]
复制代码
self.contents = Bitmap.new(640, 480)
[/code] self.opacity = 0
[code]
复制代码
self.contents.clear
[/code] end
[code]
复制代码
def update
[/code] self.contents.clear
[code]
复制代码
if $mouse_not_in_rect == false
[/code] bitmap = Bitmap.new("Graphics/System/menu/sys/存档-2.png")
[code]
复制代码
src_rect = Rect.new(0, 0, bitmap.width+15, bitmap.height+15)
[/code] self.contents.blt(8, 30 + ($zzhindex - $top_row) * 92 , bitmap, src_rect)
[code]
复制代码
end
[/code] end
[code]
复制代码
end
[/code]
[code]
复制代码
class Window_FilePicture < Window_Base
[/code] def initialize(index)
[code]
复制代码
super(-16,-8,640,480)
[/code] self.contents = Bitmap.new(640, 480)
[code]
复制代码
self.opacity = 0
[/code] self.contents.clear
[code]
复制代码
bitmap = Bitmap.new("Graphics/System/menu/sys/存档顶条.png")
[/code] src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
[code]
复制代码
self.contents.blt(5, 12, bitmap, src_rect)
[/code] bitmap = Bitmap.new("Graphics/System/menu/sys/存档底条.png")
[code]
复制代码
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
[/code] self.contents.blt(6, 394, bitmap, src_rect)
[code]
复制代码
if index == 0
[/code] bitmap = Bitmap.new("Graphics/System/menu/sys/存储进度-3.png")
[code]
复制代码
else
[/code] bitmap = Bitmap.new("Graphics/System/menu/sys/读取进度-3.png")
[code]
复制代码
end
[/code]
[code]
复制代码
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
[/code] bitmap1 = Bitmap.new("Graphics/System/menu/sys/存档-1.png")
[code]
复制代码
src_rect1 = Rect.new(0, 0, bitmap1.width+15, bitmap1.height+15)
[/code] for i in 0..3
[code]
复制代码
self.contents.blt(8, 30+i*92, bitmap1, src_rect1)
[/code] self.contents.blt(37, 43+i*92 , bitmap, src_rect)
[code]
复制代码
end
[/code] bitmap = Bitmap.new("Graphics/System/menu/sys/存档滚动条.png")
[code]
复制代码
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
[/code] self.contents.blt(500, 32, bitmap, src_rect)
[code]
复制代码
[/code] if index == 0
[code]
复制代码
bitmap = Bitmap.new("Graphics/System/menu/sys/存储进度-1.png")
[/code] bitmap1 = Bitmap.new("Graphics/System/menu/sys/读取进度-2.png")
[code]
复制代码
else
[/code] bitmap = Bitmap.new("Graphics/System/menu/sys/存储进度-2.png")
[code]
复制代码
bitmap1 = Bitmap.new("Graphics/System/menu/sys/读取进度-1.png")
[/code] end
[code]
复制代码
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
[/code] self.contents.blt(97, 0, bitmap, src_rect)
[code]
复制代码
src_rect = Rect.new(0, 0, bitmap1.width, bitmap1.height)
[/code] self.contents.blt(282, 0, bitmap1, src_rect)
[code]
复制代码
end
[/code]end
[code]
复制代码
[/code]class Window_File < Window_Base
[code]
复制代码
attr_accessor :index
[/code]def initialize(index ,zzhsavenumber )
[code]
复制代码
@zzhsavenumber = zzhsavenumber
[/code] @backsp = Sprite.new
[code]
复制代码
@backsp.z = 99
[/code] super(-8,0,525,480)
[code]
复制代码
self.opacity = 0
[/code] #这行可以不用
[code]
复制代码
self.contents = Bitmap.new(width - 32, height - 32)
[/code] @index = index
[code]
复制代码
#这里我要说明一句,之所以用sprite是为了放缩图片
[/code] @sprite = Sprite.new
[code]
复制代码
@sprite.visible = false
[/code] @sprite.z = 1000
[code]
复制代码
@sp_ch = []
[/code] @sp_ch[0] = Sprite.new
[code]
复制代码
refresh
[/code]end
[code]
复制代码
def refresh
[/code] self.contents.clear
[code]
复制代码
for i in @sp_ch
[/code] i.visible = false
[code]
复制代码
end
[/code] @sprite.visible = false
[code]
复制代码
self.contents.font.size =18
[/code] self.contents.font.name = ["华文行楷","隶书","黑体","楷体","宋体"]
[code]
复制代码
self.contents.font.color.set(0,0,0)
[/code] $zzhok = false
[code]
复制代码
self.contents.draw_text(-3, 55+@zzhsavenumber * 92, 32, 32, @index.to_s , 1)
[/code] $zzhok = true
[code]
复制代码
if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.rxdata")
[/code] @sprite.visible = true
[code]
复制代码
if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.jpg")
[/code] @sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@index}.jpg")
[code]
复制代码
else
[/code] #self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
[code]
复制代码
end
[/code] @sprite.x = 379
[code]
复制代码
@sprite.y = 50 + @zzhsavenumber * 92
[/code] @sprite.zoom_x = 0.292
[code]
复制代码
@sprite.zoom_y = 0.29
[/code] file = File.open(BBS_66RPG_DIR+"Save#{@index}.rxdata", "r")
[code]
复制代码
@time_stamp = file.mtime
[/code] @gold = Marshal.load(file)
[code]
复制代码
@save_map_name = Marshal.load(file)
[/code] @characters = Marshal.load(file)
[code]
复制代码
@frame_count = Marshal.load(file)
[/code] @game_system = Marshal.load(file)
[code]
复制代码
@game_switches = Marshal.load(file)
[/code] @game_variables = Marshal.load(file)
[code]
复制代码
@total_sec = @frame_count / Graphics.frame_rate
[/code] file.close
[code]
复制代码
$game_temp.last_file_index = @index
[/code] for i in [email]
[email protected]
[/email]
[code]
复制代码
@sp_ch
= Sprite.new
[/code] @sp_ch[i].visible = true
[code]
复制代码
@sp_ch
.bitmap = Bitmap.new("Graphics/system/menu/headp/" +@characters
[2].to_s + "_save.png")
[/code] if i==0
[code]
复制代码
@sp_ch
.x = 72
[/code] else
[code]
复制代码
@sp_ch
.x = 77+i*43
[/code] end
[code]
复制代码
@sp_ch
.y = 120 + @zzhsavenumber * 92-@sp_ch
.bitmap.height
[/code] @sp_ch[i].z = 1001
[code]
复制代码
end
[/code] # 描绘游戏时间
[code]
复制代码
hour = @total_sec / 60 / 60
[/code] min = @total_sec / 60 % 60
[code]
复制代码
sec = @total_sec % 60
[/code] time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
[code]
复制代码
self.contents.font.size =18
[/code] self.contents.font.name = ["华文行楷","隶书","黑体","楷体","宋体"]
[code]
复制代码
self.contents.font.color.set(0,0,0)
[/code] $zzhok = false
[code]
复制代码
self.contents.draw_text(210, 40+@zzhsavenumber * 92, 72, 32, "时间" , 2)
[/code] self.contents.draw_text(290, 40+@zzhsavenumber * 92, 72, 32, time_string, 2)
[code]
复制代码
self.contents.draw_text(210, 60+@zzhsavenumber * 92, 72, 32, "金钱", 2)
[/code] self.contents.draw_text(290, 60+@zzhsavenumber * 92, 72, 32, @gold, 2)
[code]
复制代码
self.contents.draw_text(210, 80+@zzhsavenumber * 92, 72, 32, "地点", 2)
[/code] self.contents.draw_text(290, 80+@zzhsavenumber * 92, 72, 32, @save_map_name, 2)
[code]
复制代码
$zzhok = true
[/code] # 描绘时间标记
[code]
复制代码
#self.contents.font.color = normal_color
[/code] #time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
[code]
复制代码
#self.contents.draw_text(4, 420, 420 + 16, 32, time_string, 2)
[/code] #src_rect = Rect.new(0,0,16,16)
[code]
复制代码
#bitmap = Bitmap.new("Graphics/system/menu/back/money.png")
[/code] #self.contents.blt(420 + 16 - @gold.size * 16, 4 + 8, bitmap, src_rect)
[code]
复制代码
#else
[/code] # self.contents.draw_text(32,32,420 + 16,32,"空白记忆")
[code]
复制代码
end
[/code]end
[code]
复制代码
def dispose
[/code] super
[code]
复制代码
@sprite.dispose
[/code] @backsp.dispose
[code]
复制代码
for i in @sp_ch
[/code] i.dispose
[code]
复制代码
end
[/code]end
[code]
复制代码
end
[/code]
[code]
复制代码
[/code]class Scene_Save
[code]
复制代码
def main
[/code] @picture_window = Window_FilePicture_2.new(1)
[code]
复制代码
@picture_window2= Window_FilePicture2_2.new
[/code] @save_command_window = Window_FileCommand_2.new($game_temp.last_file_index,0)
[code]
复制代码
@save_command_window.y = -4
[/code] @save_command_window.index = $game_temp.last_file_index
[code]
复制代码
#@save_command_window.update
[/code] @content_window0 = Window_File_2.new($game_temp.last_file_index,0)
[code]
复制代码
@content_window1 = Window_File_2.new($game_temp.last_file_index+1,1)
[/code] @content_window2 = Window_File_2.new($game_temp.last_file_index+2,2)
[code]
复制代码
@content_window3 = Window_File_2.new($game_temp.last_file_index+3,3)
[/code] @oldtop_row=0
[code]
复制代码
$top_row=0
[/code] if $game_temp.last_file_index <= 33
[code]
复制代码
$top_row=$game_temp.last_file_index
[/code] else
[code]
复制代码
$top_row=33
[/code] end
[code]
复制代码
@save_command_window.active = true
[/code] @save_command_window_update = true
[code]
复制代码
# 执行过渡
[/code] Graphics.transition
[code]
复制代码
# 主循环
[/code] loop do
[code]
复制代码
# 刷新游戏画面
[/code] Graphics.update
[code]
复制代码
# 刷新输入信息
[/code] Input.update
[code]
复制代码
# 刷新画面
[/code] update
[code]
复制代码
# 如果画面被切换的话就中断循环
[/code] if $scene != self
[code]
复制代码
break
[/code] end
[code]
复制代码
end
[/code] # 准备过渡
[code]
复制代码
Graphics.freeze
[/code] @save_command_window.dispose
[code]
复制代码
@content_window0.dispose
[/code] @content_window1.dispose
[code]
复制代码
@content_window2.dispose
[/code] @content_window3.dispose
[code]
复制代码
@picture_window.dispose
[/code] @picture_window2.dispose
[code]
复制代码
end
[/code]def update
[code]
复制代码
@save_command_window.update
[/code] @picture_window2.update
[code]
复制代码
if @oldtop_row != $top_row
[/code] @content_window0.index = $top_row
[code]
复制代码
@content_window0.refresh
[/code] @content_window1.index = $top_row+1
[code]
复制代码
@content_window1.refresh
[/code] @content_window2.index = $top_row+2
[code]
复制代码
@content_window2.refresh
[/code] @content_window3.index = $top_row+3
[code]
复制代码
@content_window3.refresh
[/code] end
[code]
复制代码
@oldtop_row = $top_row
[/code] #——————下面这一部分是原装脚本——————#
[code]
复制代码
if Input.trigger?(Input::B)
[/code] $game_system.se_play($data_system.cancel_se)
[code]
复制代码
if $game_temp.save_calling
[/code] $game_temp.save_calling = false
[code]
复制代码
$scene = Scene_Map.new
[/code] return
[code]
复制代码
end
[/code] #$scene = Scene_Map.new
[code]
复制代码
end
[/code] #———————————————————————#
[code]
复制代码
if Input.trigger?(Input::C)
[/code] # 演奏存档 SE
[code]
复制代码
$game_system.se_play($data_system.save_se)
[/code] # 写入存档数据
[code]
复制代码
file = File.open(BBS_66RPG_DIR+"Save#{@save_command_window.index}.rxdata", "wb")
[/code] write_save_data(file)
[code]
复制代码
if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg")
[/code] File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_DIR+"Save#{@save_command_window.index}.jpg")
[code]
复制代码
end
[/code] file.close
[code]
复制代码
$game_temp.last_file_index = @save_command_window.index
[/code] # 如果被事件调用
[code]
复制代码
if $game_temp.save_calling
[/code] # 清除存档调用标志
[code]
复制代码
$game_temp.save_calling = false
[/code] # 切换到地图画面
[code]
复制代码
$scene = Scene_Map.new
[/code] return
[code]
复制代码
end
[/code] # 切换到菜单画面
[code]
复制代码
$scene = Scene_Map.new
[/code] end
[code]
复制代码
#———————————————————————#
[/code]end
[code]
复制代码
#--------------------------------------------------------------------------
[/code]# ● 写入存档数据
[code]
复制代码
# file : 写入用文件对像 (已经打开)
[/code]#--------------------------------------------------------------------------
[code]
复制代码
def write_save_data(file)
[/code] # 生成描绘存档文件用的角色图形
[code]
复制代码
characters = []
[/code] for i in 0...$game_party.actors.size
[code]
复制代码
actor = $game_party.actors
[/code] characters.push([actor.character_name, actor.character_hue, actor.id, actor.battler_name, actor.battler_hue])
[code]
复制代码
end
[/code] #####################################################################
[code]
复制代码
id = $game_map.map_id
[/code] name = $data_mapinfos[id].name
[code]
复制代码
if name.include?("★")
[/code] @save_map_name = name.split(/★/)[0]
[code]
复制代码
else
[/code] @save_map_name = name
[code]
复制代码
end
[/code] Marshal.dump($game_party.gold.to_s, file)
[code]
复制代码
Marshal.dump(@save_map_name, file)
[/code] #####################################################################
[code]
复制代码
# 写入描绘存档文件用的角色数据
[/code] Marshal.dump(characters, file)
[code]
复制代码
# 写入测量游戏时间用画面计数
[/code] Marshal.dump(Graphics.frame_count, file)
[code]
复制代码
# 增加 1 次存档次数
[/code] $game_system.save_count += 1
[code]
复制代码
# 保存魔法编号
[/code] # (将编辑器保存的值以随机值替换)
[code]
复制代码
$game_system.magic_number = $data_system.magic_number
[/code] # 写入各种游戏对像
[code]
复制代码
Marshal.dump($game_system, file)
[/code] Marshal.dump($game_switches, file)
[code]
复制代码
Marshal.dump($game_variables, file)
[/code] Marshal.dump($game_self_switches, file)
[code]
复制代码
Marshal.dump($game_screen, file)
[/code] Marshal.dump($game_actors, file)
[code]
复制代码
Marshal.dump($game_party, file)
[/code] Marshal.dump($game_troop, file)
[code]
复制代码
Marshal.dump($game_map, file)
[/code] Marshal.dump($game_player, file)
[code]
复制代码
end
[/code]end
[code]
复制代码
[/code]
[code]
复制代码
[/code]
[code]
复制代码
class Scene_Menu
[/code]alias bbs_66rpg_shotsave_main main
[code]
复制代码
def main
[/code] if @menu_index == 0
[code]
复制代码
Screen::shot
[/code] end
[code]
复制代码
bbs_66rpg_shotsave_main
[/code]end
[code]
复制代码
end
[/code]
[code]
复制代码
class Interpreter
[/code]#--------------------------------------------------------------------------
[code]
复制代码
# ● 调用存档画面
[/code]#--------------------------------------------------------------------------
[code]
复制代码
def command_352
[/code] # 设置战斗中断标志
[code]
复制代码
$game_temp.battle_abort = true
[/code] # 设置调用存档标志
[code]
复制代码
$game_temp.save_calling = true
[/code] # 推进索引
[code]
复制代码
@index += 1
[/code] # 结束
[code]
复制代码
Screen::shot
[/code] return false
[code]
复制代码
end
代码
复制
end dsu_plus_rewardpost_czw
作者:
Wind2010
时间:
2012-1-27 18:58
本帖最后由 Wind2010 于 2012-1-27 18:59 编辑
检查下游戏根目录有没有screenshot.dll文件
没有的话点我进入下载页
另外脚本应该这样发
注:以下脚本和LZ的不是同一个脚本,只是一个类似的而已
#==============================================================================
# 本脚本来自www.66RPG.com,转载和使用请保留此信息
#===============================================================================
BBS_66RPG_DIR = "Save/" # 储存文件夹名,请制作游戏时自行建立此文件夹
# 若想使用自定义背景图,脚本62行的井号去掉,并放置一张相应图形。
# 在你的Scene_Title中找到这一段(如果使用其他插件脚本,在插件中找):
# for i in 0..3
# if FileTest.exist?("Save#{i+1}.rxdata")
# 请自行把0..3改为0..最大进度号,比如0..9
# "Save#{i+1}.rxdata" 改为"Save/Save#{i}.rxdata"
# 增加进度的方法:138,258行,继续添加。你也可以改“进度X”为“回忆X”或者“红/绿/蓝笔记本”
#===============================================================================
module Screen
@screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
@readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
@findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
module_function
#-----------------------------------------------------------------------------
# here comes the stuff...
# i add here the stuff for automatic change of the number for the screenshot
# so it wont overrite the old one...
# if you want to change so stuff change them in this line below
# or you can change them in your command line... like
# Screen::shot("screenshot", 2)
# this change the name and the type of the screenshot
# (0 = bmp, 1 = jpg and 2 = png)
# ----------------------------------------------------------------------------
def shot(file = "shot", typ = 1)
# to add the right extension...
if typ == 0
typname = ".bmp"
elsif typ == 1
typname = ".jpg"
elsif typ == 2
typname = ".png"
end
file_index = 0
dir = "Save/"
# make the filename....
file_name = dir + file.to_s + typname.to_s
# make the screenshot.... Attention dont change anything from here on....
@screen.call(0,0,640,480,file_name,handel,typ)
end
# find the game window...
def handel
game_name = "\0" * 256
@readini.call('Game','Title','',game_name,255,".\\Game.ini")
game_name.delete!("\0")
return @findwindow.call('RGSS Player',game_name)
end
end
class Window_File < Window_Base
attr_accessor :index
def initialize(index = 0)
@backsp = Sprite.new
#@backsp.bitmap = Bitmap.new("Graphics/Pictures/存盘背景.jpg")
@backsp.z = 99
super(160,0,480,480)
#这行可以不用
self.contents = Bitmap.new(width - 32, height - 32)
@index = index
#这里我要说明一句,之所以用sprite是为了放缩图片
@sprite = Sprite.new
@sprite.visible = false
@sprite.z = 100
@sp_ch = []
@sp_ch[0] = Sprite.new
refresh
end
def refresh
self.contents.clear
for i in @sp_ch
i.visible = false
end
@sprite.visible = false
if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.rxdata")
@sprite.visible = true
if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.jpg")
@sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@index}.jpg")
else
self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
end
@sprite.x = 176
@sprite.y = 16
@sprite.zoom_x = 0.7
@sprite.zoom_y = 0.7
file = File.open(BBS_66RPG_DIR+"Save#{@index}.rxdata", "r")
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
for i in
[email protected]
@sp_ch[i] = Sprite.new
@sp_ch[i].visible = true
@sp_ch[i].bitmap = RPG::Cache.battler(@characters[i][3], @characters[i][4])
@sp_ch[i].x = 180 + i*100
@sp_ch[i].y = 460 - @sp_ch[i].bitmap.height
@sp_ch[i].z = 101
end
# 描绘游戏时间
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 390, 420, 32, time_string, 2)
# 描绘时间标记
self.contents.font.color = normal_color
time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
self.contents.draw_text(4, 420, 420, 32, time_string, 2)
else
self.contents.draw_text(32,32,420,32,"这个存档是空的")
end
end
def dispose
super
@sprite.dispose
@backsp.dispose
for i in @sp_ch
i.dispose
end
end
end
class Scene_Save
def main
@command_window = Window_Command.new(160,["回忆一","回忆二","回忆三","回忆四","回忆五","回忆六"])
@command_window.y = 96
@command_window.index = $game_temp.last_file_index
@content_window = Window_File.new($game_temp.last_file_index)
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
@command_window.dispose
@content_window.dispose
end
def update
@command_window.update
if @command_window.index != @content_window.index
@content_window.index = @command_window.index
@content_window.refresh
end
#——————下面这一部分是原装脚本——————#
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Map.new
end
#———————————————————————#
if Input.trigger?(Input::C)
# 演奏存档 SE
$game_system.se_play($data_system.save_se)
# 写入存档数据
file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "wb")
write_save_data(file)
if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg")
File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_DIR+"Save#{@command_window.index}.jpg")
end
file.close
$game_temp.last_file_index = @command_window.index
# 如果被事件调用
if $game_temp.save_calling
# 清除存档调用标志
$game_temp.save_calling = false
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 切换到菜单画面
$scene = Scene_Map.new
end
#———————————————————————#
end
#--------------------------------------------------------------------------
# ● 写入存档数据
# file : 写入用文件对像 (已经打开)
#--------------------------------------------------------------------------
def write_save_data(file)
# 生成描绘存档文件用的角色图形
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue, actor.id, actor.battler_name, actor.battler_hue])
end
# 写入描绘存档文件用的角色数据
Marshal.dump(characters, file)
# 写入测量游戏时间用画面计数
Marshal.dump(Graphics.frame_count, file)
# 增加 1 次存档次数
$game_system.save_count += 1
# 保存魔法编号
# (将编辑器保存的值以随机值替换)
$game_system.magic_number = $data_system.magic_number
# 写入各种游戏对像
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
class Scene_Load
def initialize
# 再生成临时对像
$game_temp = Game_Temp.new
# 选择存档时间最新的文件
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..6
filename = BBS_66RPG_DIR+"Save#{i}.rxdata"
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
end
def main
@command_window = Window_Command.new(160,["回忆一","回忆二","回忆三","回忆四","回忆五","回忆六"])
@command_window.y = 96
@command_window.index = $game_temp.last_file_index
@content_window = Window_File.new($game_temp.last_file_index)
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面被切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
@command_window.dispose
@content_window.dispose
end
def update
@command_window.update
if @command_window.index != @content_window.index
@content_window.index = @command_window.index
@content_window.refresh
end
#——————下面这一部分是原装脚本——————#
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到标题画面
$scene = Scene_Title.new
end
#———————————————————————#
if Input.trigger?(Input::C)
# 文件不存在的情况下
unless FileTest.exist?(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata")
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏读档 SE
$game_system.se_play($data_system.load_se)
# 写入存档数据
file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "rb")
read_save_data(file)
file.close
# 还原 BGM、BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# 刷新地图 (执行并行事件)
$game_map.update
# 切换到地图画面
$scene = Scene_Map.new
end
#———————————————————————#
end
#--------------------------------------------------------------------------
# ● 写入存档数据
# file : 写入用文件对像 (已经打开)
#--------------------------------------------------------------------------
def read_save_data(file)
# 读取描绘存档文件用的角色数据
characters = Marshal.load(file)
# 读取测量游戏时间用画面计数
Graphics.frame_count = Marshal.load(file)
# 读取各种游戏对像
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
# 魔法编号与保存时有差异的情况下
# (加入编辑器的编辑过的数据)
if $game_system.magic_number != $data_system.magic_number
# 重新装载地图
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# 刷新同伴成员
$game_party.refresh
end
end
class Scene_Menu
alias bbs_66rpg_shotsave_main main
def main
if @menu_index == 0
Screen::shot
end
bbs_66rpg_shotsave_main
end
end
class Interpreter
#--------------------------------------------------------------------------
# ● 调用存档画面
#--------------------------------------------------------------------------
def command_352
# 设置战斗中断标志
$game_temp.battle_abort = true
# 设置调用存档标志
$game_temp.save_calling = true
# 推进索引
@index += 1
# 结束
Screen::shot
return false
end
end
复制代码
作者:
wymrbwgq
时间:
2012-1-27 19:12
Wind2010 发表于 2012-1-27 18:58
检查下游戏根目录有没有screenshot.dll文件
没有的话点我进入下载页
确实是缺少了screenshot.dll……谢谢哈
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1