Project1

标题: 截图存档,求高手帮忙弄个地图名进去。 [打印本页]

作者: 爆焰    时间: 2012-10-26 20:10
标题: 截图存档,求高手帮忙弄个地图名进去。
这个截图存档我希望能将存档的地图的名字也显示在上面,但是不知道如何设置,请高手帮忙。
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,转载和使用请保留此信息
  3. #===============================================================================

  4. BBS_66RPG_DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹

  5. # 若想使用自定义背景图,脚本62行的井号去掉,并放置一张相应图形。

  6. # 在你的Scene_Title中找到这一段(如果使用其他插件脚本,在插件中找):
  7. #    for i in 0..3
  8. #      if FileTest.exist?("Save#{i+1}.rxdata")
  9. # 请自行把0..3改为0..最大存档号,比如0..9
  10. # "Save#{i+1}.rxdata" 改为"Save/Save#{i}.rxdata"

  11. # 增加存档的方法:138,258行,继续添加。你也可以改“存档X”为“回忆X”或者“红/绿/蓝笔记本”

  12. #===============================================================================
  13. module Screen  
  14.   @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  15.   @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
  16.   @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  17.   module_function
  18.   #-----------------------------------------------------------------------------
  19.   # here comes the stuff...
  20.   # i add here the stuff for automatic change of the number for the screenshot
  21.   # so it wont overrite the old one...
  22.   # if you want to change so stuff change them in this line below
  23.   # or you can change them in your command line... like
  24.   # Screen::shot("screenshot", 2)
  25.   # this change the name and the type of the screenshot
  26.   # (0 = bmp, 1 = jpg and 2 = png)
  27.   # ----------------------------------------------------------------------------
  28.   def shot(file = "shot", typ = 1)
  29.     # to add the right extension...
  30.     if typ == 0
  31.       typname = ".bmp"
  32.     elsif typ == 1
  33.       typname = ".jpg"
  34.     elsif typ == 2
  35.       typname = ".png"
  36.     end   
  37.     file_index = 0   
  38.     dir = "Save/"   
  39.     # make the filename....
  40.     file_name = dir + file.to_s + typname.to_s   
  41.     # make the screenshot.... Attention dont change anything from here on....
  42.     @screen.call(0,0,640,480,file_name,handel,typ)
  43.   end
  44.   # find the game window...
  45.   def handel
  46.     game_name = "\0" * 256
  47.     @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  48.     game_name.delete!("\0")
  49.     return @findwindow.call('RGSS Player',game_name)
  50.   end
  51. end

  52. class Window_File < Window_Base
  53.   attr_accessor :index
  54.   def initialize(index = 0)
  55.     @backsp = Sprite.new
  56.     #@backsp.bitmap = Bitmap.new("Graphics/Pictures/存盘背景.jpg")
  57.     @backsp.z = 99
  58.     super(160,0,480,480)
  59.     #这行可以不用
  60.     self.contents = Bitmap.new(width - 32, height - 32)
  61.     @index = index
  62.     #这里我要说明一句,之所以用sprite是为了放缩图片
  63.     @sprite = Sprite.new
  64.     @sprite.visible = false
  65.     @sprite.z = 100
  66.     @sp_ch = []
  67.     @sp_ch[0] = Sprite.new
  68.     refresh
  69.   end
  70.   def refresh
  71.     self.contents.clear
  72.     for i in @sp_ch
  73.       i.visible = false
  74.     end
  75.     @sprite.visible = false
  76.     if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.rxdata")
  77.       @sprite.visible = true
  78.       if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.jpg")
  79.         @sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@index}.jpg")
  80.       else
  81.         self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  82.       end
  83.       @sprite.x = 176
  84.       @sprite.y = 16
  85.       @sprite.zoom_x = 0.7
  86.       @sprite.zoom_y = 0.7
  87.       file = File.open(BBS_66RPG_DIR+"Save#{@index}.rxdata", "r")
  88.       @time_stamp = file.mtime
  89.       @characters = Marshal.load(file)
  90.       @frame_count = Marshal.load(file)
  91.       @game_system = Marshal.load(file)
  92.       @game_switches = Marshal.load(file)
  93.       @game_variables = Marshal.load(file)
  94.       @total_sec = @frame_count / Graphics.frame_rate
  95.       file.close
  96.       for i in [email protected]
  97.         @sp_ch[i] = Sprite.new
  98.         @sp_ch[i].visible = true
  99.         @sp_ch[i].bitmap = RPG::Cache.battler(@characters[i][3], @characters[i][4])
  100.         @sp_ch[i].x = 180 + i*100      
  101.         @sp_ch[i].y = 460 - @sp_ch[i].bitmap.height
  102.         @sp_ch[i].z = 101
  103.       end
  104.       # 描绘游戏时间
  105.       hour = @total_sec / 60 / 60
  106.       min = @total_sec / 60 % 60
  107.       sec = @total_sec % 60
  108.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  109.       self.contents.font.color = normal_color
  110.       self.contents.draw_text(4, 390, 420, 32, time_string, 2)
  111.       # 描绘时间标记
  112.       self.contents.font.color = normal_color
  113.       time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  114.       self.contents.draw_text(4, 420, 420, 32, time_string, 2)
  115.     else
  116.       self.contents.draw_text(32,32,420,32,"这个存档是空的")
  117.     end
  118.   end
  119.   def dispose
  120.     super
  121.     @sprite.dispose
  122.     @backsp.dispose
  123.     for i in @sp_ch
  124.       i.dispose
  125.     end
  126.   end
  127. end


  128. class Scene_Save
  129.   def main
  130.     @command_window = Window_Command.new(160,["存档一","存档二","存档三","存档四","存档五","存档六","存档七","存档八","存档九","存档十","存档十一","存档十二","存档十三","存档十四"])
  131.     @command_window.y = 0
  132.     @command_window.index = $game_temp.last_file_index
  133.     @content_window = Window_File.new($game_temp.last_file_index)
  134.     # 执行过渡
  135.     Graphics.transition
  136.     # 主循环
  137.     loop do
  138.       # 刷新游戏画面
  139.       Graphics.update
  140.       # 刷新输入信息
  141.       Input.update
  142.       # 刷新画面
  143.       update
  144.       # 如果画面被切换的话就中断循环
  145.       if $scene != self
  146.         break
  147.       end
  148.     end
  149.     # 准备过渡
  150.     Graphics.freeze
  151.     @command_window.dispose
  152.     @content_window.dispose
  153.   end
  154.   def update
  155.     @command_window.update   
  156.     if @command_window.index != @content_window.index
  157.       @content_window.index = @command_window.index
  158.       @content_window.refresh
  159.     end   
  160.     #——————下面这一部分是原装脚本——————#
  161.     if Input.trigger?(Input::B)  
  162.       $game_system.se_play($data_system.cancel_se)
  163.       if $game_temp.save_calling
  164.         $game_temp.save_calling = false
  165.         $scene = Scene_Map.new
  166.         return
  167.       end
  168.       $scene = Scene_Menu.new(3)
  169.     end   
  170.     #———————————————————————#   
  171.     if Input.trigger?(Input::C)
  172.       # 演奏存档 SE
  173.       $game_system.se_play($data_system.save_se)
  174.       # 写入存档数据
  175.       file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "wb")
  176.       write_save_data(file)
  177.       if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg")
  178.         File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_DIR+"Save#{@command_window.index}.jpg")
  179.       end
  180.       file.close
  181.       $game_temp.last_file_index = @command_window.index
  182.       # 如果被事件调用
  183.       if $game_temp.save_calling
  184.         # 清除存档调用标志
  185.         $game_temp.save_calling = false
  186.         # 切换到地图画面
  187.         $scene = Scene_Map.new
  188.         return
  189.       end
  190.       # 切换到菜单画面
  191.       $scene = Scene_Map.new
  192.     end
  193.     #———————————————————————#
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● 写入存档数据
  197.   #     file : 写入用文件对像 (已经打开)
  198.   #--------------------------------------------------------------------------
  199.   def write_save_data(file)
  200.     # 生成描绘存档文件用的角色图形
  201.     characters = []
  202.     for i in 0...$game_party.actors.size
  203.       actor = $game_party.actors[i]
  204.       characters.push([actor.character_name, actor.character_hue, actor.id, actor.battler_name, actor.battler_hue])
  205.     end
  206.     # 写入描绘存档文件用的角色数据
  207.     Marshal.dump(characters, file)
  208.     # 写入测量游戏时间用画面计数
  209.     Marshal.dump(Graphics.frame_count, file)
  210.     # 增加 1 次存档次数
  211.     $game_system.save_count += 1
  212.     # 保存魔法编号
  213.     # (将编辑器保存的值以随机值替换)
  214.     $game_system.magic_number = $data_system.magic_number
  215.     # 写入各种游戏对像
  216.     Marshal.dump($game_system, file)
  217.     Marshal.dump($game_switches, file)
  218.     Marshal.dump($game_variables, file)
  219.     Marshal.dump($game_self_switches, file)
  220.     Marshal.dump($game_screen, file)
  221.     Marshal.dump($game_actors, file)
  222.     Marshal.dump($game_party, file)
  223.     Marshal.dump($game_troop, file)
  224.     Marshal.dump($game_map, file)
  225.     Marshal.dump($game_player, file)
  226.   end
  227. end


  228. class Scene_Load
  229.   def initialize
  230.     # 再生成临时对像
  231.     $game_temp = Game_Temp.new
  232.     # 选择存档时间最新的文件
  233.     $game_temp.last_file_index = 0
  234.     latest_time = Time.at(0)
  235.     for i in 0..6
  236.       filename = BBS_66RPG_DIR+"Save#{i}.rxdata"
  237.       if FileTest.exist?(filename)
  238.         file = File.open(filename, "r")
  239.         if file.mtime > latest_time
  240.           latest_time = file.mtime
  241.           $game_temp.last_file_index = i
  242.         end
  243.         file.close
  244.       end
  245.     end
  246.   end  
  247.   def main
  248.     @command_window = Window_Command.new(160,["存档一","存档二","存档三","存档四","存档五","存档六","存档七","存档八","存档九","存档十","存档十一","存档十二","存档十三","存档十四"])
  249.     @command_window.y = 0
  250.     @command_window.index = $game_temp.last_file_index
  251.     @content_window = Window_File.new($game_temp.last_file_index)
  252.     # 执行过渡
  253.     Graphics.transition
  254.     # 主循环
  255.     loop do
  256.       # 刷新游戏画面
  257.       Graphics.update
  258.       # 刷新输入信息
  259.       Input.update
  260.       # 刷新画面
  261.       update
  262.       # 如果画面被切换的话就中断循环
  263.       if $scene != self
  264.         break
  265.       end
  266.     end
  267.     # 准备过渡
  268.     Graphics.freeze
  269.     @command_window.dispose
  270.     @content_window.dispose
  271.   end
  272.   def update
  273.     @command_window.update   
  274.     if @command_window.index != @content_window.index
  275.       @content_window.index = @command_window.index
  276.       @content_window.refresh
  277.     end   
  278.     #——————下面这一部分是原装脚本——————#
  279.     if Input.trigger?(Input::B)  
  280.     # 演奏取消 SE
  281.     $game_system.se_play($data_system.cancel_se)
  282.     # 切换到标题画面
  283.     $scene = Scene_Title.new
  284.   end   

  285.    #——————下面这一部分是原装脚本——————#
  286.     if Input.trigger?(Input::B)  
  287.     # 演奏取消 SE
  288.     $game_system.se_play($data_system.cancel_se)
  289.     # 切换到标题画面
  290.     $scene = Scene_Map.new
  291.   end  
  292.     #———————————————————————#   
  293.     if Input.trigger?(Input::C)
  294.       # 文件不存在的情况下
  295.       unless FileTest.exist?(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata")
  296.         # 演奏冻结 SE
  297.         $game_system.se_play($data_system.buzzer_se)
  298.         return
  299.       end
  300.       # 演奏读档 SE
  301.       $game_system.se_play($data_system.load_se)
  302.       # 写入存档数据
  303.       file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "rb")
  304.       read_save_data(file)
  305.       file.close
  306.       # 还原 BGM、BGS
  307.       $game_system.bgm_play($game_system.playing_bgm)
  308.       $game_system.bgs_play($game_system.playing_bgs)
  309.       # 刷新地图 (执行并行事件)
  310.       $game_map.update
  311.       # 切换到地图画面
  312.       $scene = Scene_Map.new
  313.     end
  314.     #———————————————————————#
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 写入存档数据
  318.   #     file : 写入用文件对像 (已经打开)
  319.   #--------------------------------------------------------------------------
  320.   def read_save_data(file)
  321.     # 读取描绘存档文件用的角色数据
  322.     characters = Marshal.load(file)
  323.     # 读取测量游戏时间用画面计数
  324.     Graphics.frame_count = Marshal.load(file)
  325.     # 读取各种游戏对像
  326.     $game_system        = Marshal.load(file)
  327.     $game_switches      = Marshal.load(file)
  328.     $game_variables     = Marshal.load(file)
  329.     $game_self_switches = Marshal.load(file)
  330.     $game_screen        = Marshal.load(file)
  331.     $game_actors        = Marshal.load(file)
  332.     $game_party         = Marshal.load(file)
  333.     $game_troop         = Marshal.load(file)
  334.     $game_map           = Marshal.load(file)
  335.     $game_player        = Marshal.load(file)
  336.     # 魔法编号与保存时有差异的情况下
  337.     # (加入编辑器的编辑过的数据)
  338.     if $game_system.magic_number != $data_system.magic_number
  339.       # 重新装载地图
  340.       $game_map.setup($game_map.map_id)
  341.       $game_player.center($game_player.x, $game_player.y)
  342.     end
  343.     # 刷新同伴成员
  344.     $game_party.refresh
  345.   end
  346. end

  347. class Scene_Menu
  348.   alias bbs_66rpg_shotsave_main main
  349.   def main
  350.     if @menu_index == 0
  351.       Screen::shot
  352.     end   
  353.     bbs_66rpg_shotsave_main
  354.   end
  355. end
  356. class Interpreter
  357.   #--------------------------------------------------------------------------
  358.   # ● 调用存档画面
  359.   #--------------------------------------------------------------------------
  360.   def command_352
  361.     # 设置战斗中断标志
  362.     $game_temp.battle_abort = true
  363.     # 设置调用存档标志
  364.     $game_temp.save_calling = true
  365.     # 推进索引
  366.     @index += 1
  367.     # 结束
  368.     Screen::shot
  369.     return false
  370.   end
  371. end
复制代码
dsu_plus_rewardpost_czw
作者: 沙漠点灰    时间: 2012-10-26 22:04
本帖最后由 沙漠点灰 于 2012-10-27 20:06 编辑

RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],转载和使用请保留此信息
  3. #===============================================================================
  4. BBS_66RPG_DIR = "Save/"  # 储存文件夹名,请制作游戏时自行建立此文件夹
  5. $data_mapinfo ||= load_data("Data/MapInfos.rxdata")
  6.  
  7. # 若想使用自定义背景图,脚本62行的井号去掉,并放置一张相应图形。
  8.  
  9. # 在你的Scene_Title中找到这一段(如果使用其他插件脚本,在插件中找):
  10. #    for i in 0..3
  11. #      if FileTest.exist?("Save#{i+1}.rxdata")
  12. # 请自行把0..3改为0..最大存档号,比如0..9
  13. # "Save#{i+1}.rxdata" 改为"Save/Save#{i}.rxdata"
  14.  
  15. # 增加存档的方法:138,258行,继续添加。你也可以改“存档X”为“回忆X”或者“红/绿/蓝笔记本”
  16.  
  17. #===============================================================================
  18. module Screen  
  19.   @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  20.   @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
  21.   @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  22.   module_function
  23.   #-----------------------------------------------------------------------------
  24.   # here comes the stuff...
  25.   # i add here the stuff for automatic change of the number for the screenshot
  26.   # so it wont overrite the old one...
  27.   # if you want to change so stuff change them in this line below
  28.   # or you can change them in your command line... like
  29.   # Screen::shot("screenshot", 2)
  30.   # this change the name and the type of the screenshot
  31.   # (0 = bmp, 1 = jpg and 2 = png)
  32.   # ----------------------------------------------------------------------------
  33.   def shot(file = "shot", typ = 1)
  34.     # to add the right extension...
  35.     if typ == 0
  36.       typname = ".bmp"
  37.     elsif typ == 1
  38.       typname = ".jpg"
  39.     elsif typ == 2
  40.       typname = ".png"
  41.     end   
  42.     file_index = 0   
  43.     dir = "Save/"   
  44.     # make the filename....
  45.     file_name = dir + file.to_s + typname.to_s   
  46.     # make the screenshot.... Attention dont change anything from here on....
  47.     @screen.call(0,0,640,480,file_name,handel,typ)
  48.   end
  49.   # find the game window...
  50.   def handel
  51.     game_name = "\0" * 256
  52.     @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  53.     game_name.delete!("\0")
  54.     return @findwindow.call('RGSS Player',game_name)
  55.   end
  56. end
  57.  
  58. class Window_File < Window_Base
  59.   attr_accessor :index
  60.   def initialize(index = 0)
  61.     @backsp = Sprite.new
  62.     #@backsp.bitmap = Bitmap.new("Graphics/Pictures/存盘背景.jpg")
  63.     @backsp.z = 99
  64.     super(160,0,480,480)
  65.     #这行可以不用
  66.     self.contents = Bitmap.new(width - 32, height - 32)
  67.     @index = index
  68.     #这里我要说明一句,之所以用sprite是为了放缩图片
  69.     @sprite = Sprite.new
  70.     @sprite.visible = false
  71.     @sprite.z = 100
  72.     @sp_ch = []
  73.     @sp_ch[0] = Sprite.new
  74.     refresh
  75.   end
  76.   def refresh
  77.     self.contents.clear
  78.     for i in @sp_ch
  79.       i.visible = false
  80.     end
  81.     @sprite.visible = false
  82.     if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.rxdata")
  83.       @sprite.visible = true
  84.       if FileTest.exist?(BBS_66RPG_DIR+"Save#{@index}.jpg")
  85.         @sprite.bitmap = Bitmap.new(BBS_66RPG_DIR+"Save#{@index}.jpg")
  86.       else
  87.         self.contents.draw_text(32,64,400,32,"截图似乎有点问题……您搞什么了您?")
  88.       end
  89.       @sprite.x = 176
  90.       @sprite.y = 16
  91.       @sprite.zoom_x = 0.7
  92.       @sprite.zoom_y = 0.7
  93.       file = File.open(BBS_66RPG_DIR+"Save#{@index}.rxdata", "r")
  94.       @time_stamp = file.mtime
  95.       @characters = Marshal.load(file)
  96.       @frame_count = Marshal.load(file)
  97.       @game_system = Marshal.load(file)
  98.       @game_switches = Marshal.load(file)
  99.       @game_variables = Marshal.load(file)
  100.       @game_self_switches = Marshal.load(file)
  101.       @game_screen        = Marshal.load(file)
  102.       @game_actors        = Marshal.load(file)
  103.       @game_party         = Marshal.load(file)
  104.       @game_troop         = Marshal.load(file)
  105.       @game_map           = Marshal.load(file)
  106.       map_name = $data_mapinfo[@game_map.map_id].name
  107.       @total_sec = @frame_count / Graphics.frame_rate
  108.       file.close
  109.       for i in [email]0...@characters.size[/email]
  110.         @sp_ch[i] = Sprite.new
  111.         @sp_ch[i].visible = true
  112.         @sp_ch[i].bitmap = RPG::Cache.battler(@characters[i][3], @characters[i][4])
  113.         @sp_ch[i].x = 180 + i*100      
  114.         @sp_ch[i].y = 460 - @sp_ch[i].bitmap.height
  115.         @sp_ch[i].z = 101
  116.       end
  117.       # 描绘游戏时间
  118.       hour = @total_sec / 60 / 60
  119.       min = @total_sec / 60 % 60
  120.       sec = @total_sec % 60
  121.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  122.       self.contents.font.color = normal_color
  123.       self.contents.draw_text(4, 390, 420, 32, time_string, 2)
  124.       # 描绘时间标记
  125.       self.contents.font.color = normal_color
  126.       time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  127.       self.contents.draw_text(4,420-64,420,32,map_name,2)
  128.       self.contents.draw_text(4, 420, 420, 32, time_string, 2)
  129.     else
  130.       self.contents.draw_text(32,32,420,32,"这个存档是空的")
  131.     end
  132.   end
  133.   def dispose
  134.     super
  135.     @sprite.dispose
  136.     @backsp.dispose
  137.     for i in @sp_ch
  138.       i.dispose
  139.     end
  140.   end
  141. end
  142.  
  143.  
  144. class Scene_Save
  145.   def main
  146.     @command_window = Window_Command.new(160,["存档一","存档二","存档三","存档四","存档五","存档六","存档七","存档八","存档九","存档十","存档十一","存档十二","存档十三","存档十四"])
  147.     @command_window.y = 0
  148.     @command_window.index = $game_temp.last_file_index
  149.     @content_window = Window_File.new($game_temp.last_file_index)
  150.     # 执行过渡
  151.     Graphics.transition
  152.     # 主循环
  153.     loop do
  154.       # 刷新游戏画面
  155.       Graphics.update
  156.       # 刷新输入信息
  157.       Input.update
  158.       # 刷新画面
  159.       update
  160.       # 如果画面被切换的话就中断循环
  161.       if $scene != self
  162.         break
  163.       end
  164.     end
  165.     # 准备过渡
  166.     Graphics.freeze
  167.     @command_window.dispose
  168.     @content_window.dispose
  169.   end
  170.   def update
  171.     @command_window.update   
  172.     if @command_window.index != @content_window.index
  173.       @content_window.index = @command_window.index
  174.       @content_window.refresh
  175.     end   
  176.     #——————下面这一部分是原装脚本——————#
  177.     if Input.trigger?(Input::B)  
  178.       $game_system.se_play($data_system.cancel_se)
  179.       if $game_temp.save_calling
  180.         $game_temp.save_calling = false
  181.         $scene = Scene_Map.new
  182.         return
  183.       end
  184.       $scene = Scene_Menu.new(3)
  185.     end   
  186.     #———————————————————————#   
  187.     if Input.trigger?(Input::C)
  188.       # 演奏存档 SE
  189.       $game_system.se_play($data_system.save_se)
  190.       # 写入存档数据
  191.       file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "wb")
  192.       write_save_data(file)
  193.       if FileTest.exist?(BBS_66RPG_DIR+"shot.jpg")
  194.         File.rename(BBS_66RPG_DIR+"shot.jpg", BBS_66RPG_DIR+"Save#{@command_window.index}.jpg")
  195.       end
  196.       file.close
  197.       $game_temp.last_file_index = @command_window.index
  198.       # 如果被事件调用
  199.       if $game_temp.save_calling
  200.         # 清除存档调用标志
  201.         $game_temp.save_calling = false
  202.         # 切换到地图画面
  203.         $scene = Scene_Map.new
  204.         return
  205.       end
  206.       # 切换到菜单画面
  207.       $scene = Scene_Map.new
  208.     end
  209.     #———————————————————————#
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 写入存档数据
  213.   #     file : 写入用文件对像 (已经打开)
  214.   #--------------------------------------------------------------------------
  215.   def write_save_data(file)
  216.     # 生成描绘存档文件用的角色图形
  217.     characters = []
  218.     for i in 0...$game_party.actors.size
  219.       actor = $game_party.actors[i]
  220.       characters.push([actor.character_name, actor.character_hue, actor.id, actor.battler_name, actor.battler_hue])
  221.     end
  222.     # 写入描绘存档文件用的角色数据
  223.     Marshal.dump(characters, file)
  224.     # 写入测量游戏时间用画面计数
  225.     Marshal.dump(Graphics.frame_count, file)
  226.     # 增加 1 次存档次数
  227.     $game_system.save_count += 1
  228.     # 保存魔法编号
  229.     # (将编辑器保存的值以随机值替换)
  230.     $game_system.magic_number = $data_system.magic_number
  231.     # 写入各种游戏对像
  232.     Marshal.dump($game_system, file)
  233.     Marshal.dump($game_switches, file)
  234.     Marshal.dump($game_variables, file)
  235.     Marshal.dump($game_self_switches, file)
  236.     Marshal.dump($game_screen, file)
  237.     Marshal.dump($game_actors, file)
  238.     Marshal.dump($game_party, file)
  239.     Marshal.dump($game_troop, file)
  240.     Marshal.dump($game_map, file)
  241.     Marshal.dump($game_player, file)
  242.   end
  243. end
  244.  
  245.  
  246. class Scene_Load
  247.   def initialize
  248.     # 再生成临时对像
  249.     $game_temp = Game_Temp.new
  250.     # 选择存档时间最新的文件
  251.     $game_temp.last_file_index = 0
  252.     latest_time = Time.at(0)
  253.     for i in 0..6
  254.       filename = BBS_66RPG_DIR+"Save#{i}.rxdata"
  255.       if FileTest.exist?(filename)
  256.         file = File.open(filename, "r")
  257.         if file.mtime > latest_time
  258.           latest_time = file.mtime
  259.           $game_temp.last_file_index = i
  260.         end
  261.         file.close
  262.       end
  263.     end
  264.   end  
  265.   def main
  266.     @command_window = Window_Command.new(160,["存档一","存档二","存档三","存档四","存档五","存档六","存档七","存档八","存档九","存档十","存档十一","存档十二","存档十三","存档十四"])
  267.     @command_window.y = 0
  268.     @command_window.index = $game_temp.last_file_index
  269.     @content_window = Window_File.new($game_temp.last_file_index)
  270.     # 执行过渡
  271.     Graphics.transition
  272.     # 主循环
  273.     loop do
  274.       # 刷新游戏画面
  275.       Graphics.update
  276.       # 刷新输入信息
  277.       Input.update
  278.       # 刷新画面
  279.       update
  280.       # 如果画面被切换的话就中断循环
  281.       if $scene != self
  282.         break
  283.       end
  284.     end
  285.     # 准备过渡
  286.     Graphics.freeze
  287.     @command_window.dispose
  288.     @content_window.dispose
  289.   end
  290.   def update
  291.     @command_window.update   
  292.     if @command_window.index != @content_window.index
  293.       @content_window.index = @command_window.index
  294.       @content_window.refresh
  295.     end   
  296.     #——————下面这一部分是原装脚本——————#
  297.     if Input.trigger?(Input::B)  
  298.     # 演奏取消 SE
  299.     $game_system.se_play($data_system.cancel_se)
  300.     # 切换到标题画面
  301.     $scene = Scene_Title.new
  302.   end   
  303.  
  304.    #——————下面这一部分是原装脚本——————#
  305.     if Input.trigger?(Input::B)  
  306.     # 演奏取消 SE
  307.     $game_system.se_play($data_system.cancel_se)
  308.     # 切换到标题画面
  309.     $scene = Scene_Map.new
  310.   end  
  311.     #———————————————————————#   
  312.     if Input.trigger?(Input::C)
  313.       # 文件不存在的情况下
  314.       unless FileTest.exist?(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata")
  315.         # 演奏冻结 SE
  316.         $game_system.se_play($data_system.buzzer_se)
  317.         return
  318.       end
  319.       # 演奏读档 SE
  320.       $game_system.se_play($data_system.load_se)
  321.       # 写入存档数据
  322.       file = File.open(BBS_66RPG_DIR+"Save#{@command_window.index}.rxdata", "rb")
  323.       read_save_data(file)
  324.       file.close
  325.       # 还原 BGM、BGS
  326.       $game_system.bgm_play($game_system.playing_bgm)
  327.       $game_system.bgs_play($game_system.playing_bgs)
  328.       # 刷新地图 (执行并行事件)
  329.       $game_map.update
  330.       # 切换到地图画面
  331.       $scene = Scene_Map.new
  332.     end
  333.     #———————————————————————#
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● 写入存档数据
  337.   #     file : 写入用文件对像 (已经打开)
  338.   #--------------------------------------------------------------------------
  339.   def read_save_data(file)
  340.     # 读取描绘存档文件用的角色数据
  341.     characters = Marshal.load(file)
  342.     # 读取测量游戏时间用画面计数
  343.     Graphics.frame_count = Marshal.load(file)
  344.     # 读取各种游戏对像
  345.     $game_system        = Marshal.load(file)
  346.     $game_switches      = Marshal.load(file)
  347.     $game_variables     = Marshal.load(file)
  348.     $game_self_switches = Marshal.load(file)
  349.     $game_screen        = Marshal.load(file)
  350.     $game_actors        = Marshal.load(file)
  351.     $game_party         = Marshal.load(file)
  352.     $game_troop         = Marshal.load(file)
  353.     $game_map           = Marshal.load(file)
  354.     $game_player        = Marshal.load(file)
  355.     # 魔法编号与保存时有差异的情况下
  356.     # (加入编辑器的编辑过的数据)
  357.     if $game_system.magic_number != $data_system.magic_number
  358.       # 重新装载地图
  359.       $game_map.setup($game_map.map_id)
  360.       $game_player.center($game_player.x, $game_player.y)
  361.     end
  362.     # 刷新同伴成员
  363.     $game_party.refresh
  364.   end
  365. end
  366.  
  367. class Scene_Menu
  368.   alias bbs_66rpg_shotsave_main main
  369.   def main
  370.     if @menu_index == 0
  371.       Screen::shot
  372.     end   
  373.     bbs_66rpg_shotsave_main
  374.   end
  375. end
  376. class Interpreter
  377.   #--------------------------------------------------------------------------
  378.   # ● 调用存档画面
  379.   #--------------------------------------------------------------------------
  380.   def command_352
  381.     # 设置战斗中断标志
  382.     $game_temp.battle_abort = true
  383.     # 设置调用存档标志
  384.     $game_temp.save_calling = true
  385.     # 推进索引
  386.     @index += 1
  387.     # 结束
  388.     Screen::shot
  389.     return false
  390.   end
  391. end

作者: 爆焰    时间: 2012-10-26 22:32
沙漠点灰 发表于 2012-10-26 22:04
没有screenshot.dll文件,无法测试,若出现bug,请附上该文件。

screenshot.zip (53.11 KB, 下载次数: 20)

107出错,少个@,不过加上去还是出错。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1