| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 30 |
| 经验 | |
| 最后登录 | 2026-6-15 |
| 在线时间 | 398 小时 |
- 梦石
- 0
- 星屑
- 2957
- 在线时间
- 398 小时
- 注册时间
- 2013-6-13
- 回帖
- 24

|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 水母书亚 于 2019-1-13 16:05 编辑
前年发过一次提问
后来有大佬帮忙修过一遍,现在难道是会和别的脚本冲突?
现在发现了一个新的问题。
如果先打开物品界面然后在存档会截图截到物品栏……
甚至截到存档界面【按确定进入存档界面不存档直接退出来,再进入存档存一次就会变成这样】
以上反复刷会变成
存档相关的脚本有这些:
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],转载和使用请保留此信息
- #===============================================================================
-
- 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 = 2)
- # 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)
- # 角色在不同的位置,选取不同的截图框
- x = (($game_player.x > $game_map.width - 6)? 1:0) + (($game_player.x < 5)? 0:1)
- y = (($game_player.y > $game_map.height - 4)? 1:0) + (($game_player.y < 4)? 0:1)
- @screen.call(112*x,112*y,416,256,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
- # 全图截图
- def shot_fast
- dir = "ScreenShot/"
- # make the filename....
- file = Time.now.strftime("%Y%m%d_%H%M%S")
- file_name = dir + file + '.png'
- # make the screenshot.... Attention dont change anything from here on....
- @screen.call(0,0,640,480,file_name,handel,2)
- 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,64,480,416)
- #这行可以不用
- self.contents = Bitmap.new(width - 32, height - 32)
- @index = index
- #这里我要说明一句,之所以用sprite是为了放缩图片
- @sprite = Sprite.new
- @sprite.visible = false
- @sprite.z = 100
- @sp_ch = []
- for i in 0..4
- @sp_ch[i] = Sprite.new
- @sp_ch[i].z = 101
- end
- # 刷新
- 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}.png")
- @sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@index}.png")
- else
- self.contents.draw_text(32,64,400,32,"截图似乎有点问题……")
- end
- @sprite.x = 192
- @sprite.y = 96
- #@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)
- Marshal.load(file)
- Marshal.load(file)
- Marshal.load(file)
- @game_party = Marshal.load(file)
- Marshal.load(file)
- @game_map = Marshal.load(file)
- Marshal.load(file)
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- # 描绘角色
- i = 0
- @characters.each do |ch_ary|
- character_name, character_hue = ch_ary[0], ch_ary[1]
- bitmap = RPG::Cache.character(character_name, character_hue)
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- @sp_ch[i].bitmap = bitmap
- @sp_ch[i].src_rect = Rect.new(0, 0, cw, ch)
- @sp_ch[i].x = 192 + 40 * i
- @sp_ch[i].y = 456 - ch
- @sp_ch[i].visible = true
- i = i + 1
- end
- # 设置文字颜色
- self.contents.font.color = normal_color
- # 描绘游戏时间
- 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.draw_text(4, 318, 420, 32, time_string, 2)
- # 描绘时间标记
- time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
- self.contents.draw_text(4, 348, 420, 32, time_string, 2)
- else
- self.contents.draw_text(32,32,420,32,"No data")
- end
- end
- def dispose
- super
- @sprite.dispose
- @backsp.dispose
- for i in @sp_ch
- i.dispose
- end
- end
- end
-
-
- class Scene_Save
- def main
- # 档案文件名数组
- ary = ["★SAVE★"]
- for i in 1..70
- ary.push sprintf("%s %02d", "SAVE", i)
- end
- # 创建档案窗口
- @command_window = Window_Command.new(160,ary)
- @command_window.y = 64
- @command_window.height = 416
- @command_window.index = $game_temp.last_file_index
- @content_window = Window_File.new($game_temp.last_file_index)
- # 添加帮助窗口
- @help_window = Window_Help.new
- @help_window.set_text("请选择要存入的SAVE")
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面被切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- @command_window.dispose
- @content_window.dispose
- # 释放帮助窗口
- @help_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_Menu.new(0)
- end
- #———————————————————————#
- if Input.trigger?(Input::C)
- # 演奏存档 SE
- $game_system.se_play($data_system.decision_se)
- # 写入存档数据
- file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "wb")
- write_save_data(file)
- if FileTest.exist?(BBS_66RPG_DIR+"shot.png")
- File.rename(BBS_66RPG_DIR+"shot.png", BBS_66RPG_DIR+"Save#{@command_window.index}.png")
- end
- file.close
- #----------------------------------------------
- # 将存档数据 Hash 写入 SaveHash
- #----------------------------------------------
- f = Game_Global.new("Save/SaveHash")
- f.set "hash-#{@command_window.index}", File.open("Save/Save#{@command_window.index}.rxdata").read.hash
- #----------------------------------------------
- $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..70
- 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
- # 档案文件名数组
- ary = ["★SAVE★"]
- for i in 1..70
- ary.push sprintf("%s %02d", "SAVE", i)
- end
- # 创建档案窗口
- @command_window = Window_Command.new(160,ary)
- @command_window.y = 64
- @command_window.height = 416
- @command_window.index = $game_temp.last_file_index
- @content_window = Window_File.new($game_temp.last_file_index)
- # 添加帮助窗口
- @help_window = Window_Help.new
- @help_window.set_text("请选择要读取的SAVE")
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面被切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- @command_window.dispose
- @content_window.dispose
- # 释放帮助窗口
- @help_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
- #----------------------------------------------------------
- # 验证存档是否被篡改
- #----------------------------------------------------------
- f = Game_Global.new("Save/SaveHash")
- if f.data["hash-#{@command_window.index}"] != File.open("Save/Save#{@command_window.index}.rxdata").read.hash
- p '存档验证失败!无法读取此存档!'
- return
- end
- #----------------------------------------------------------
- # 演奏读档 SE
- $game_system.se_play($data_system.decision_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
- # 自动存档
- def command_autosave
- Screen::shot("Save0")
- file = File.open(BBS_66RPG_DIR+"Save0.rxdata", "wb")
- Scene_Save.new.write_save_data(file)
- file.close
- #--------------------------------------------
- # 将存档数据 Hash 写入 SaveHash
- #--------------------------------------------
- f = Game_Global.new("Save/SaveHash")
- f.set "hash-0", File.open('Save/Save0.rxdata').read.hash
- #----------------------------------------------
- end
- end
复制代码
- #==============================================================================
- # ■ 二周目类 v2
- #------------------------------------------------------------------------------
- # 简单的保存与读取二周目数据的类,其中仅包含了key-value对
- #
- # 使用方法:
- # 0. 在根目录下创建 Global 文件夹,将脚本插到 main 前
- # 1. 创建实例 $game_save = Game_Global.new(filename,init_hash)
- # 注:filename 参数是存档文件名,init_hash 参数是初始的hash值
- # 2. 实例调用 $game_save.set(key, value) 设置key-value对
- # 3. 实例调用 $game_save.key 即可获取对应的value值
- #
- # 对key的值要求是字符串,不是Symbol对象
- # 对value的值没有任何限制,任意对象都可以
- #
- # 特点:
- # 创造不同的Global文件分别保存数据,避免对所有的Global内容进行频繁读写
- #==============================================================================
- class Game_Global
- def initialize(name,init_hash={})
- @filename = name + '.rxdata'
- # 初始化 Hash 的各默认值
- @data = init_hash
- # 存档文件存在时则读取
- if exist?
- read
- end
- end
-
- def write
- file = File.open(@filename, "wb")
- Marshal.dump(Graphics.frame_count, file) # 总帧数
- Marshal.dump(@data, file)
- file.close
- end
-
- def read
- file = File.open(@filename, "rb")
- Marshal.load(file) # 总帧数
- @data = Marshal.load(file)
- file.close
- end
-
- def exist?
- return FileTest.exist?(@filename)
- end
-
- def set(key,value)
- @data[key] = value
- write
- end
-
- def method_missing(name)
- return @data[name.to_s]
- end
-
- def data
- return @data
- end
- end
- #==============================================================================
- # 本脚本由guoxiaomi制作,使用和转载请保留此信息
- #==============================================================================
复制代码
- #=============================================================================
- # Global_Save
- #-----------------------------------------------------------------------------
- # 管理全局存档的模块
- #=============================================================================
- module Global_Save
- # 接受全局存档数据的变量 ID
- Global_Save_Var = 59
- #---------------------------------------------------------------------------
- # 将一个对象写入全局存档
- # object : 要写入的对象
- #---------------------------------------------------------------------------
- def self.write_save_data(object)
- # 全局存档的文件名
- filename = "GSave.rxdata"
- # 打开文件(写入模式)
- file = File.open(filename, "wb")
- # 将 object 写入该文件
- Marshal.dump(object, file)
- # 写入完成,关闭文件
- file.close
- end
- #---------------------------------------------------------------------------
- # 读取全局存档的数据
- #---------------------------------------------------------------------------
- def self.load_save_data
- # 全局存档的文件名
- filename = "GSave.rxdata"
- # 如果存在全局存档,则读取,否则什么也不做
- if FileTest.exist?(filename)
- # 打开文件(读取模式)
- file = File.open(filename, "rb")
- # 读取文件中的数据,并把它放在指定 ID 的变量当中
- $game_variables[Global_Save_Var] = Marshal.load(file)
- # 读取完成,关闭文件
- file.close
- end
- end
- end
复制代码
没有脚本编辑能力,我寻思改动脚本,让它退出其它界面时停两帧?(事件脑
|
|