赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 165 |
最后登录 | 2012-3-6 |
在线时间 | 7 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 7 小时
- 注册时间
- 2010-8-18
- 帖子
- 6
|
本帖最后由 wymrbwgq 于 2012-1-27 19:06 编辑
这是我的截图存档脚本
求帮助……- [/code]#===============================================================================[code]
复制代码 BBS_66RPG_DIR = "Save/" # 储存文件夹名,请制作游戏时自行建立此文件夹# 若想使用自定义背景图,脚本62行的井号去掉,并放置一张相应图形。# 在你的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"# 增加进度的方法:138,258行,继续添加。你也可以改“进度X”为“回忆X”或者“红/绿/蓝笔记本”# 注意:这个脚本是兼容亿万星辰的“轩辕剑菜单”的版本,不过用在其他场合貌似也不会出错- [/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"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# 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)endclass 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)@[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]
复制代码 endendif 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)end- [/code] @zzhaaa_1=2
- [code]
复制代码 update_cursor_rect- [/code] Mouse.click_lock
- [code]
复制代码 else- [/code] Mouse.click_unlock
- [code]
复制代码 end$top_row = self.top_row- [/code] def update_cursor_rect
- [code]
复制代码 # 光标位置不满 0 的情况下- [/code] if @index < 0
- [code]
复制代码 self.cursor_rect.emptyendrow = @index- [/code] # 当前行被显示开头行前面的情况下
- [code]
复制代码 if row < self.top_row- [/code] # 从当前行向开头行滚动
- [code]
复制代码 self.cursor_rect.emptyend- [/code] # 当前行被显示末尾行之后的情况下
- [code]
复制代码 if row > self.top_row + (self.page_row_max - 1)- [/code] # 从当前行向末尾滚动
- [code]
复制代码 self.cursor_rect.emptyendx = 8- [/code] y = 26 + @index * 92- self.oy
- [code]
复制代码 # 更新国标矩形- [/code] self.cursor_rect.set(x, y, 490, 92)
- [code]
复制代码 enddef top_row- [/code] # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
- [code]
复制代码 return self.oy / 92#--------------------------------------------------------------------------# row : 显示开头的行- [/code] #--------------------------------------------------------------------------
- [code]
复制代码 def top_row=(row)- [/code] # row 未满 0 的场合更正为 0
- [code]
复制代码 if row < 0end- [/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] # ● 获取 1 页可以显示的行数
- [code]
复制代码 #--------------------------------------------------------------------------- [/code] def page_row_max
- [code]
复制代码 # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32- [/code] return (self.height - 32) / 92
- [code]
复制代码 enddef delay(seconds)- [/code] for i in 0...(seconds * 1)
- [code]
复制代码 sleep 0.01- [/code] Graphics.update
- [code]
复制代码 end- [/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.cleardef 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]
复制代码 endendclass 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]
复制代码 endsrc_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")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]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 = 0self.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]
复制代码 refreshdef 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@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")@sp_ch.x = 72@sp_ch.x = 77+i*43@sp_ch.y = 120 + @zzhsavenumber * 92-@sp_ch.bitmap.height- [/code] @sp_ch[i].z = 1001
- [code]
复制代码 endhour = @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#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]
复制代码 enddef dispose@sprite.dispose- [/code] @backsp.dispose
- [code]
复制代码 for i in @sp_chendend- [/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$top_row=33@save_command_window.active = true- [/code] @save_command_window_update = true
- [code]
复制代码 # 执行过渡- [/code] Graphics.transition
- [code]
复制代码 # 主循环# 刷新游戏画面- [/code] Graphics.update
- [code]
复制代码 # 刷新输入信息- [/code] Input.update
- [code]
复制代码 # 刷新画面# 如果画面被切换的话就中断循环- [/code] if $scene != self
- [code]
复制代码 breakendGraphics.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@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@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.newend- [/code] #$scene = Scene_Map.new
- [code]
复制代码 end- [/code] #———————————————————————#
- [code]
复制代码 if Input.trigger?(Input::C)$game_system.se_play($data_system.save_se)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.indexif $game_temp.save_calling- [/code] # 清除存档调用标志
- [code]
复制代码 $game_temp.save_calling = false$scene = Scene_Map.newend$scene = Scene_Map.new#———————————————————————##--------------------------------------------------------------------------# 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]
复制代码 endclass Scene_Menu- [/code]alias bbs_66rpg_shotsave_main main
- [code]
复制代码 def main- [/code] if @menu_index == 0
- [code]
复制代码 Screen::shotbbs_66rpg_shotsave_mainendclass Interpreter- [/code]#--------------------------------------------------------------------------
- [code]
复制代码 # ● 调用存档画面- [/code]#--------------------------------------------------------------------------
- [code]
复制代码 def command_352- [/code] # 设置战斗中断标志
- [code]
复制代码 $game_temp.battle_abort = true- [/code] # 设置调用存档标志
- [code]
复制代码 $game_temp.save_calling = true@index += 1Screen::shot- [/code] return false
- [code]
复制代码 end
end |
|