Project1

标题: 求此脚本存档部分出错解决方法 [打印本页]

作者: chenchuan1    时间: 2011-7-28 16:10
标题: 求此脚本存档部分出错解决方法
本帖最后由 fux2 于 2011-7-28 16:45 编辑

此脚本出现了错误,报错的地方在红色字体处。
  1. #_______________________________________________________________________________
  2. # MOG Scene File Ayumi V1.2           
  3. #_______________________________________________________________________________
  4. # By Moghunter  
  5. # [url]http://www.atelier-rgss.com[/url]
  6. #_______________________________________________________________________________
  7. module MOG
  8. #Transition Time.
  9. MSVT = 30
  10. #Transition Type.
  11. MSVTT = "006-Stripe02"
  12. end
  13. $mogscript = {} if $mogscript == nil
  14. $mogscript["menu_ayumi"] = true
  15. ###############
  16. # Window_Base #
  17. ###############
  18. class Window_Base < Window
  19. def drw_win_file(x,y)
  20. dwf = RPG::Cache.picture("Win_File")
  21. cw = dwf.width
  22. ch = dwf.height
  23. src_rect = Rect.new(0, 0, cw, ch)
  24. self.contents.blt(x , y - ch, dwf, src_rect)   
  25. end   
  26. def nada
  27. face = RPG::Cache.picture("")
  28. end  
  29. def draw_heroface3(actor,x,y)
  30. face = RPG::Cache.picture(actor.name + "_fc3") rescue nada
  31. cw = face.width
  32. ch = face.height
  33. src_rect = Rect.new(0, 0, cw, ch)
  34. self.contents.blt(x , y - ch, face, src_rect)   
  35. end  
  36. def draw_actor_level6(actor, x, y)
  37. self.contents.font.color = Color.new(0,0,0,255)
  38. self.contents.draw_text(x + 1, y + 1, 32, 32, "Lv")  
  39. self.contents.font.color = system_color
  40. self.contents.draw_text(x, y, 32, 32, "Lv")
  41. self.contents.font.color = Color.new(0,0,0,255)
  42. self.contents.draw_text(x + 17, y + 1, 24, 32, actor.level.to_s, 2)
  43. self.contents.font.color = Color.new(255,255,255,255)
  44. self.contents.draw_text(x + 16, y, 24, 32, actor.level.to_s, 2)
  45. end
  46. def draw_actor_name6(actor, x, y)
  47. self.contents.font.color = Color.new(0,0,0,255)
  48. self.contents.draw_text(x + 1, y + 1, 100, 32, actor.name,1)  
  49. self.contents.font.color = normal_color
  50. self.contents.draw_text(x, y, 100, 32, actor.name,1)
  51. end
  52. end
  53. ############
  54. # Game_Map #
  55. ############
  56. class Game_Map
  57. def map_name
  58. @mapinfo = load_data("Data/MapInfos.rxdata") if @mapinfo == nil
  59. return @mapinfo[@map_id].name
  60. end
  61. end
  62. ###################
  63. # Window_SaveFile #
  64. ###################
  65. class Window_SaveFile < Window_Base
  66.   attr_reader   :filename               
  67.   attr_reader   :selected               
  68.   def initialize(file_index, filename)
  69.     super(0, 64 + file_index * 138, 640, 240)   
  70.     self.contents = Bitmap.new(width - 32, height - 32)  
  71.     self.opacity = 0
  72.     @file_index = file_index
  73.     @filename = "Save#{@file_index + 1}.rxdata"
  74.     @time_stamp = Time.at(0)
  75.     @file_exist = FileTest.exist?(@filename)
  76. [color=Red]    if @file_exist
  77.       file = File.open(@filename, "r")
  78.       @time_stamp = file.mtime
  79.       @characters = Marshal.load(file)
  80.       @frame_count = Marshal.load(file)
  81.       @game_system = Marshal.load(file)
  82.       @game_switches = Marshal.load(file)
  83.       @game_variables = Marshal.load(file)
  84.       @game_self_switches = Marshal.load(file)
  85.       @game_screen = Marshal.load(file)
  86. @game_actors = Marshal.load(file)
  87.       @game_party = Marshal.load(file)
  88.       @game_troop = Marshal.load(file)
  89.      @game_map = Marshal.load(file)
  90.      @total_sec = @frame_count / Graphics.frame_rate
  91.       file.close [/color]
  92.     end
  93.     @wiref = 0
  94.     refresh
  95.     @selected = false
  96.   end  
  97.   def refresh
  98.     self.contents.clear
  99.     #self.contents.font.name = "Georgia"
  100.     drw_win_file(0,190)
  101.     name = "#{@file_index + 1}"
  102.     self.contents.font.color = Color.new(0,0,0,255)
  103.     self.contents.draw_text(161, 41, 600, 32, name)
  104.     self.contents.font.color = Color.new(255,255,255,255)
  105.     self.contents.draw_text(160, 40, 600, 32, name)   
  106.     @name_width = contents.text_size(name).width
  107.     if @file_exist
  108.       for i in [email][email protected][/email]
  109.         bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  110.         cw = bitmap.rect.width / 4
  111.         ch = bitmap.rect.height / 4
  112.         src_rect = Rect.new(cw * @wiref + 1 , 0, cw, ch)
  113.         x = 300 - @characters.size + i * 64 - cw / 4
  114.         self.contents.blt(x - 10, 150 - ch, bitmap, src_rect)
  115.         x = 116
  116.         actors = @game_party.actors
  117.         for i in 0...[actors.size, 4].min
  118.         x     = i * 60
  119.         actor = actors[i]        
  120.         self.contents.font.size = 20
  121.         draw_actor_level6(actor, x + 280, 140)
  122.         actor = actors[0]     
  123.         draw_heroface3(actor,160,180)   
  124.         draw_actor_name6(actor, 160, 155)
  125.         self.contents.font.size = 22
  126.         end         
  127.       end      
  128.       hour = @total_sec / 60 / 60
  129.       min = @total_sec / 60 % 60
  130.       sec = @total_sec % 60
  131.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  132.       self.contents.font.color = Color.new(0,0,0,255)
  133.       self.contents.draw_text(5, 41, 450, 32, time_string, 2)
  134.       self.contents.draw_text(41 , 141, 120 , 32, @game_map.map_name.to_s)
  135.       self.contents.font.color = Color.new(255,255,255,255)
  136.       self.contents.draw_text(40 , 140, 120 , 32, @game_map.map_name.to_s)  
  137.       self.contents.draw_text(4, 40, 450, 32, time_string, 2)   
  138.    end
  139.   end
  140.   def selected=(selected)
  141.     @selected = selected
  142.   end
  143. end
  144. ##############
  145. # Scene_File #
  146. ##############
  147. class Scene_File
  148.   def initialize(help_text)
  149.     @help_text = help_text
  150.   end
  151.   def main
  152.     @mnback = Plane.new
  153.     @mnback.bitmap = RPG::Cache.picture("MN_BK")
  154.     @mnback.z = 1
  155.     @mnlay = Sprite.new
  156.     @mnlay.bitmap = RPG::Cache.picture("Lay_File.PNG")
  157.     @mnlay.z = 2
  158.     @help_window = Window_Help.new
  159.     @help_window.set_text(@help_text)
  160.     @help_window.opacity = 0
  161.     @savefile_windows = []
  162.     for i in 0..2
  163.       @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
  164.     end
  165.     @savefile_windows[0]
  166.     @file_index = $game_temp.last_file_index
  167.     @savefile_windows[@file_index].selected = true
  168.     @savefile_windows[0].y = 40   
  169.     @savefile_windows[1].y= 140
  170.     @savefile_windows[2].y= 240   
  171.     @win_move_time = 0
  172.     @win_move = 0
  173.     @win_dire = 0
  174.     @win_opac = 255
  175.     @win1_y = 0
  176.     @win2_y = 0
  177.     @win3_y = 0
  178.     Graphics.transition(MOG::MSVT, "Graphics/Transitions/" + MOG::MSVTT)
  179.     loop do
  180.       Graphics.update
  181.       Input.update
  182.       update
  183.       if $scene != self
  184.         break
  185.       end
  186.     end
  187.     for i in 0..50
  188.     @mnback.ox += 1
  189.     @savefile_windows[0].x += 10   
  190.     @savefile_windows[1].x -= 10
  191.     @savefile_windows[2].x += 10
  192.     for i in @savefile_windows
  193.     i.contents_opacity -= 5
  194.     end  
  195.     Graphics.update  
  196.     end      
  197.     Graphics.freeze
  198.     @help_window.dispose
  199.     @mnback.dispose
  200.     @mnlay.dispose
  201.     for i in @savefile_windows
  202.       i.dispose
  203.     end
  204.   end
  205.   def update
  206.     @mnback.ox += 1
  207.     @win_opac += 3
  208.     @win_move_time += 1   
  209.     if @win_opac > 254
  210.        @win_opac = 150
  211.     end         
  212.     if @win_move_time > 60
  213.     @win_dire += 1
  214.     @win_move_time = 0   
  215.     end
  216.     if @win_dire > 1
  217.        @win_dire = 0
  218.     end
  219.     if @win_dire == 0
  220.        @win_move += 1
  221.     else   
  222.        @win_move -= 1
  223.     end         
  224.     if @file_index == 0
  225.     @savefile_windows[0].z = 2  
  226.     @savefile_windows[1].z = 1
  227.     @savefile_windows[2].z = 0   
  228.     @savefile_windows[0].x = @win_move
  229.     @savefile_windows[1].x = 0
  230.     @savefile_windows[1].x= 0
  231.     @savefile_windows[2].x = 0   
  232.     @savefile_windows[0].contents_opacity = @win_opac
  233.     @savefile_windows[1].contents_opacity = 130
  234.     @savefile_windows[2].contents_opacity =  130   
  235.     elsif @file_index == 1
  236.     @savefile_windows[0].z = 1  
  237.     @savefile_windows[1].z = 2
  238.     @savefile_windows[2].z = 1   
  239.     @savefile_windows[0].x = 0
  240.     @savefile_windows[1].x = @win_move
  241.     @savefile_windows[2].x = 0     
  242.     @savefile_windows[0].contents_opacity =  130
  243.     @savefile_windows[1].contents_opacity = @win_opac
  244.     @savefile_windows[2].contents_opacity =  130
  245.     else
  246.     @savefile_windows[0].z = 0  
  247.     @savefile_windows[1].z = 1
  248.     @savefile_windows[2].z = 2      
  249.     @savefile_windows[0].x = 0
  250.     @savefile_windows[1].x = 0
  251.     @savefile_windows[2].x = @win_move  
  252.     @savefile_windows[0].contents_opacity = 130
  253.     @savefile_windows[1].contents_opacity = 130
  254.     @savefile_windows[2].contents_opacity = @win_opac   
  255.     end   
  256.     @help_window.update   
  257.     for i in @savefile_windows
  258.       i.update
  259.     end
  260.     if Input.trigger?(Input::C)
  261.       on_decision(make_filename(@file_index))
  262.       $game_temp.last_file_index = @file_index
  263.       return
  264.     end
  265.     if Input.trigger?(Input::B)
  266.       on_cancel
  267.       return
  268.     end
  269.     if Input.repeat?(Input::DOWN)
  270.       if Input.trigger?(Input::DOWN) or @file_index < 3
  271.         $game_system.se_play($data_system.cursor_se)
  272.         @savefile_windows[@file_index].selected = false
  273.         @file_index = (@file_index + 1) % 3
  274.         @savefile_windows[@file_index].selected = true
  275.         return
  276.       end
  277.     end
  278.     if Input.repeat?(Input::UP)
  279.       if Input.trigger?(Input::UP) or @file_index > 0
  280.         $game_system.se_play($data_system.cursor_se)
  281.         @savefile_windows[@file_index].selected = false
  282.         @file_index = (@file_index - 1) % 3
  283.         @savefile_windows[@file_index].selected = true
  284.         return
  285.       end
  286.     end
  287.   end
  288.   def make_filename(file_index)
  289.     return "Save#{file_index + 1}.rxdata"
  290.   end
  291. end
复制代码
dsu_plus_rewardpost_czw
作者: 秋庭里香    时间: 2011-7-28 16:34
有可能是因为在使用这个脚本前,事先有了一个存档,而这个以前存档的内容不适合现在的脚本导致。
所以也许只需要把你以前的那个存档给删除掉,就可以解决问题了。
作者: chenchuan1    时间: 2011-7-28 16:37
秋庭里香 发表于 2011-7-28 16:34
有可能是因为在使用这个脚本前,事先有了一个存档,而这个以前存档的内容不适合现在的脚本导致。
所以也许 ...

那请问在哪里可以删除以前的存档呢?
作者: 秋庭里香    时间: 2011-7-28 16:41
按 Alt + G,点击 打开游戏文件夹,然后把save1.rxdata这些删掉就行了。
作者: coolman00    时间: 2011-7-28 16:43
chenchuan1 发表于 2011-7-28 16:37
那请问在哪里可以删除以前的存档呢?

去你的文件放的地方
有一个文件是 Save1.rvdata
作者: 精灵使者    时间: 2011-7-28 17:42
使用了新的存档脚本以后,请一定要删除以前的存档。by精灵




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