查看: 3050|回复: 13

[已经解决] 求一个能把使用了的RTP素材自动找出来复制到工程里的脚本

[复制链接]
梦石
0
星屑
544
在线时间
59 小时
注册时间
2017-11-19
回帖
62
发表于 2017-12-31 23:24:11 | 显示全部楼层 |阅读模式
悬赏10星屑已解决
求一个能把使用了的RTP素材自动找出来复制到工程里的脚本
原先我找到一个脚本,链接:http://himeworks.com/2013/05/resource-checker/
可是怎么用都有问题,不知道怎么回事,如果能把那个弄好也可以,问题链接:https://rpg.blue/thread-404840-1-1.html

最佳答案

查看完整内容

[pre lang="ruby"]# 复制游戏所需RTP资源的脚本 请插到最前面 # 请自行修改下面第 9 行RTP目录 # 以及第 18 行非RTP素材的后缀名 # 原理是用到的时候检查文件是否存在 不存在则拷贝 # 所以不能一次性拷贝 需要过一遍游戏才行 # 假如错过一些细节就喜剧了 # 游戏正式发布的时候删掉这个脚本就好 # 复制文件方法 RGSS_RTP = "E:/RPGVXAce/" class File def self.copy(dest, source) open(source, "rb") do |file| ...
梦石
0
星屑
13562
在线时间
2753 小时
注册时间
2014-10-4
回帖
705

R考场第七期纪念奖

发表于 2017-12-31 23:24:12 | 显示全部楼层
本帖最后由 SixRC 于 2018-1-1 13:49 编辑
  1. # 复制游戏所需RTP资源的脚本 请插到最前面
  2. #   请自行修改下面第 9 行RTP目录
  3. #     以及第 18 行非RTP素材的后缀名
  4. # 原理是用到的时候检查文件是否存在 不存在则拷贝
  5. #   所以不能一次性拷贝 需要过一遍游戏才行
  6. # 假如错过一些细节就喜剧了
  7. #   游戏正式发布的时候删掉这个脚本就好
  8. # 复制文件方法
  9. RGSS_RTP = "E:/RPGVXAce/"
  10. class File
  11.   def self.copy(dest, source)
  12.     open(source, "rb") do |file|
  13.       open(dest, "wb") do |f|
  14.         f.syswrite(file.sysread(size(source)))
  15.       end
  16.     end
  17.   end
  18.   CRTP_Suffix = [".png", ".jpg", ".bmp", ".ogg", ".wav", ".mp3"]
  19.   def self.CRTP_exist?(filename)
  20.     for i in CRTP_Suffix
  21.       return true if File.exist?(filename + i)
  22.     end
  23.     false
  24.   end
  25. end
  26. # 实例化位图时检查文件是否存在在游戏目录 不存在则从RTP拷贝
  27. #   File类的文件查找并不会找RTP目录 so
  28. class Bitmap
  29.   alias CRTP_initialize initialize
  30.   def initialize(x, y = nil)
  31.     if x.class == String
  32.       File.copy(x + ".png", RGSS_RTP + x + ".png") unless File.CRTP_exist?(x)
  33.       CRTP_initialize(x)
  34.     else
  35.       CRTP_initialize(x, y)
  36.     end
  37.   end
  38. end
  39. # 检查音频文件 有 bgm bgs se me
  40. class << Audio
  41.   # bgm
  42.   alias CRTP_bgm_play bgm_play
  43.   def bgm_play(*args)
  44.     File.copy(args[0] + ".ogg", RGSS_RTP + args[0] + ".ogg") unless File.CRTP_exist?(args[0])
  45.     CRTP_bgm_play(*args)
  46.   end
  47.   # bgs
  48.   alias CRTP_bgs_play bgs_play
  49.   def bgs_play(*args)
  50.     File.copy(args[0] + ".ogg", RGSS_RTP + args[0] + ".ogg") unless File.CRTP_exist?(args[0])
  51.     CRTP_bgs_play(*args)
  52.   end
  53.   # me
  54.   alias CRTP_me_play me_play
  55.   def me_play(*args)
  56.     File.copy(args[0] + ".ogg", RGSS_RTP + args[0] + ".ogg") unless File.CRTP_exist?(args[0])
  57.     CRTP_me_play(*args)
  58.   end
  59.   # se
  60.   alias CRTP_se_play se_play
  61.   def se_play(*args)
  62.     File.copy(args[0] + ".ogg", RGSS_RTP + args[0] + ".ogg") unless File.CRTP_exist?(args[0])
  63.     CRTP_se_play(*args)
  64.   end
  65. end
复制代码

介绍及使用在脚本里面了
插入就好
你测试游戏的时候会自动把需要的资源拷贝过去
但是你必须玩到一次用到资源的地方 不然无法触发拷贝机制
外挂脚本用到的RTP资源也可以拷贝的
有问题请提
回复

使用道具 举报

梦石
0
星屑
544
在线时间
59 小时
注册时间
2017-11-19
回帖
62
 楼主| 发表于 2017-12-31 23:28:43 | 显示全部楼层
抱歉,上面的那个脚本好像并不能复制

点评

但是网站上说的好像可以  发表于 2017-12-31 23:30
回复

使用道具 举报

梦石
0
星屑
7230
在线时间
1685 小时
注册时间
2017-4-28
回帖
84

开拓者

发表于 2018-1-1 11:21:49 | 显示全部楼层
点击展开/收起
  1. =begin
  2. #==============================================================================
  3. ** Resource Checker
  4. Author: Hime
  5. Date: May 5, 2013
  6. ------------------------------------------------------------------------------
  7. ** Change log
  8. Feb 11, 2015
  9.    - added support for listing unused resources
  10. May 5, 2013
  11.    - added move routes
  12. Aug 2, 2012
  13.    - added support for VX
  14. Jul 27, 2012
  15.    - initial release
  16. ------------------------------------------------------------------------------   
  17. ** Description

  18. This script goes through all of the data files in the data folder and
  19. displays a list of graphics and audio used.

  20. It performs a very simple resource check and copy: if it's defined in your
  21. database or in any event, it is assumed you are using it.

  22. Additionally, it also prints out a list of files that exist in your project
  23. resource folders, but are not being used in the game

  24. This script also does not support custom scripts that reference RTP
  25. resources; if you have custom scripts and you know they use RTP materials,
  26. you should consider copying everything related to that script over manually.
  27. --------------------------------------------------------------------------------
  28. ** Installation

  29. Place this script below Materials and above Main

  30. --------------------------------------------------------------------------------
  31. ** Usage

  32. Press F5 to run the resource checker. You can change this key in the
  33. configuration section.

  34. After the resource checker finishes, a file called "used_resources.txt" will be
  35. created in your project folder.

  36. It will also create a file called "unused_resources.txt" which lists
  37. all of the files that aren't in use currently

  38. You can also choose to copy files over from the RTP folder directly.
  39. In the configuration section, type in the absolute path to the RTP, and
  40. enable file copying.

  41. #==============================================================================
  42. =end
  43. $imported = {} if $imported.nil?
  44. $imported["Tsuki_Resource_Checker"] = true
  45. #==============================================================================
  46. # ** Configuration
  47. #==============================================================================
  48. module Tsuki
  49.   module Resource_Checker
  50.    
  51.     # Copy your RTP path here.
  52.     # Don't forget the trailing slash (I don't check it)
  53.     RTP_Directory = "C:/Program Files (x86)/Common Files/Enterbrain/RGSS3/RPGVXAce/"
  54.    
  55.     # Set it to false if you only want a list of resources you use
  56.     Copy_Files_Over = true
  57.    
  58.     # change this if you need to
  59.     Check_Key = :C
  60. #==============================================================================
  61. # ** Rest of the script
  62. #==============================================================================
  63.     Graphics_Dirs = [:Animations, :Battlebacks1, :Battlebacks2, :Battlers,
  64.                      :Characters, :Faces, :Parallaxes, :Pictures, :System,
  65.                      :Tilesets, :Titles1, :Titles2]
  66.     Audio_Dirs = [:BGM, :BGS, :ME, :SE]
  67.     Font_Dirs = [:Fonts]
  68.    
  69.     # this is supposed to add some path checking...
  70.     def self.rtp_directory
  71.       RTP_Directory
  72.     end
  73.   
  74.     def self.rpgvxace?
  75.       defined? BasicObject
  76.     end
  77.    
  78.     def self.rpgvx?
  79.       defined? Graphics.resize_screen
  80.     end
  81.    
  82.     def self.show_message(message)
  83.       if rpgvxace?
  84.         $game_message.add(message)
  85.       elsif rpgvx?
  86.         $game_message.texts.push(message)
  87.       end
  88.     end
  89.    
  90.     def self.init_resource_finder
  91.       return Resource_Finder_Ace.new if rpgvxace?
  92.       return Resource_Finder_VX.new if rpgvx?
  93.     end
  94.   end
  95. end

  96. # just add it somewhere

  97. class Game_Player
  98.   
  99.   alias tsuki_Resource_Checker_update update
  100.   def update
  101.     tsuki_Resource_Checker_update
  102.     if Input.trigger?(Tsuki::Resource_Checker::Check_Key)
  103.       r = Tsuki::Resource_Checker.init_resource_finder
  104.       r.run
  105.     end
  106.   end
  107. end
  108. #~  
  109. # generic parser class. Subclasses should implement the methods if needed
  110. class Data_Parser
  111.   
  112.   def initialize
  113.     @data_animations = load_data_file("Animations")
  114.   end
  115.   
  116.   def make_data_path(filename)
  117.   end
  118.   
  119.   def load_data_file(filename)
  120.     path = make_data_path(filename)
  121.     return load_data(path)
  122.   end
  123.   
  124.   def parse_actors
  125.   end
  126.   
  127.   def parse_classes
  128.   end
  129.   
  130.   def parse_skills
  131.   end
  132.   
  133.   def parse_items
  134.   end
  135.   
  136.   def parse_weapons
  137.   end
  138.   
  139.   def parse_armors
  140.   end
  141.   
  142.   def parse_states
  143.   end
  144.   
  145.   def parse_enemies
  146.   end
  147.   
  148.   def parse_troops
  149.   end
  150.   
  151.   def parse_animations
  152.   end
  153.   
  154.   def parse_tilesets
  155.   end
  156.   
  157.   def parse_system
  158.   end
  159.   
  160.   def parse_fonts
  161.   end
  162.   
  163.   # takes a vehicle object stored in System.rvdata2
  164.   def parse_vehicle(vehicle)
  165.   end
  166.   
  167.   def parse_terms
  168.   end
  169.   
  170.   # map parsing
  171.   
  172.   def parse_datamaps
  173.   end
  174.   
  175.   # pass in a map ID
  176.   def parse_map(map_id)
  177.   end
  178.   
  179.   # takes an RPG::Map::Encounter object
  180.   def parse_encounters(encounters)
  181.   end
  182.   
  183.   # event parsers
  184.   
  185.   def parse_event_commands(list)
  186.   end
  187.   
  188.   def parse_event_page(page)
  189.   end
  190.   
  191.   def parse_event(event)
  192.   end
  193.   
  194.   def parse_map_events(events)
  195.   end
  196.   
  197.   def parse_common_events
  198.   end
  199.   
  200.   def parse_data_files
  201.     parse_actors
  202.     parse_classes
  203.     parse_skills
  204.     parse_items
  205.     parse_weapons
  206.     parse_armors
  207.     parse_enemies
  208.     parse_troops
  209.     parse_states
  210.     parse_animations
  211.     parse_tilesets
  212.     parse_common_events
  213.     parse_system
  214.     parse_terms
  215.     parse_datamaps
  216.     parse_fonts
  217.   end
  218. end

  219. class Resource_Finder_Ace < Data_Parser
  220.   
  221.   attr_reader :resources

  222.   def initialize
  223.     super
  224.     @resources = {}
  225.   end
  226.   
  227.   def make_data_path(filename)
  228.     "Data/#{filename}.rvdata2"
  229.   end
  230.   
  231.   def init_category(category)
  232.     @resources[category] = []
  233.   end
  234.   
  235.   def add_resource(category, name)
  236.     init_category(category) if @resources[category].nil?
  237.     return unless name && !name.empty?
  238.     @resources[category] |= [name]
  239.   end
  240.   
  241.   def parse_actors
  242.     actors = load_data_file("Actors")
  243.     actors.each {|actor|
  244.       next unless actor
  245.       add_resource(:Characters, actor.character_name)
  246.       add_resource(:Faces, actor.face_name)
  247.     }
  248.   end   
  249.   
  250.   def parse_enemies
  251.     enemies = load_data_file("Enemies")
  252.     enemies.each {|enemy|
  253.       next unless enemy
  254.       add_resource(:Battlers, enemy.battler_name)
  255.     }
  256.   end
  257.   
  258.   def parse_troops
  259.     troops = load_data_file("Troops")
  260.   end
  261.   
  262.   def parse_animations
  263.     anims = load_data_file("Animations")
  264.     anims.each {|anim|
  265.       next unless anim
  266.       add_resource(:Animations, anim.animation1_name)
  267.       add_resource(:Animations, anim.animation2_name)
  268.     }
  269.   end
  270.   
  271.   def parse_tilesets
  272.     tilesets = load_data_file("Tilesets")
  273.     tilesets.each {|tileset|
  274.       next unless tileset
  275.       tileset.tileset_names.each {|name|
  276.         add_resource(:Tilesets, name)
  277.       }
  278.     }
  279.   end
  280.   
  281.   def parse_common_events
  282.     events = load_data_file("CommonEvents")
  283.     events.each {|evt|
  284.       next unless evt
  285.       parse_command_list(evt.list)
  286.     }
  287.   end
  288.   
  289.   def parse_system
  290.     system = load_data_file("System")
  291.     add_resource(:BGM, system.title_bgm.name)
  292.     add_resource(:BGM, system.battle_bgm.name)
  293.     add_resource(:ME, system.battle_end_me.name)
  294.     add_resource(:ME, system.gameover_me.name)
  295.    
  296.     # add system sounds
  297.     system.sounds.each {|sound|
  298.       add_resource(:SE, sound.name)
  299.     }
  300.    
  301.     # test battle and editor related
  302.     add_resource(:Battlebacks1, system.battleback1_name)
  303.     add_resource(:Battlebacks2, system.battleback2_name)
  304.     add_resource(:Battlers, system.battler_name)   
  305.    
  306.     # vehicles
  307.     parse_vehicle(system.boat)
  308.     parse_vehicle(system.ship)
  309.     parse_vehicle(system.airship)
  310.    
  311.     # titles
  312.     add_resource(:Titles1, system.title1_name)
  313.     add_resource(:Titles2, system.title2_name)
  314.    
  315.     # some default stuff
  316.     add_resource(:System, "BattleStart")
  317.     add_resource(:System, "GameOver")
  318.     add_resource(:System, "IconSet")
  319.     add_resource(:System, "Shadow")
  320.     add_resource(:System, "Window")
  321.   end
  322.   
  323.   def parse_vehicle(vehicle)
  324.     add_resource(:Characters, vehicle.character_name)
  325.     add_resource(:BGM, vehicle.bgm.name)
  326.   end
  327.   
  328.   # just hardcoded...
  329.   def parse_fonts
  330.     add_resource(:Fonts, "VL-Gothic-Regular")
  331.     add_resource(:Fonts, "VL-PGothic-Regular")
  332.   end
  333.   
  334.   # map parser
  335.   
  336.   def parse_datamaps
  337.    
  338.     infos = load_data_file("MapInfos")
  339.     infos.each {|id, map|
  340.       next unless map
  341.       parse_map(id)
  342.     }
  343.   end
  344.   
  345.   def parse_map(map_id)
  346.     map = load_data_file(sprintf("Map%03d", map_id))
  347.     add_resource(:Parallaxes, map.parallax_name)
  348.     add_resource(:BGM, map.bgm.name)
  349.     add_resource(:BGS, map.bgs.name)
  350.     parse_map_events(map.events)
  351.   end
  352.   
  353.   # event parsing
  354.   
  355.   def check_event_resources(cmd)
  356.     code, params = cmd.code, cmd.parameters
  357.     case code
  358.     when 101 # show text
  359.       add_resource(:Faces, params[0]) # face name
  360.     when 205 # move route
  361.       check_move_route(params[1])
  362.     when 212 # show animation
  363.     when 213 # show balloon
  364.       add_resource(:System, "Balloon")
  365.     when 231 # show picture
  366.       add_resource(:Pictures, params[1])
  367.     when 241 # play BGM
  368.       add_resource(:BGM, params[0].name)
  369.     when 245 # play BGS
  370.       add_resource(:BGS, params[0].name)
  371.     when 249 # play ME
  372.       add_resource(:ME, params[0].name)
  373.     when 250 # play SE
  374.       add_resource(:SE, params[0].name)
  375.     when 261 # play movie
  376.     when 282 # change tileset
  377.       tset_id = params[0]
  378.     when 283 # change battleback
  379.       add_resource(:Battlebacks1, params[0])
  380.       add_resource(:Battlebacks2, params[1])
  381.     when 284 # change parallax
  382.       add_resource(:Parallaxes, params[0])
  383.     when 322 # Change Actor Graphic
  384.       add_resource(:Characters, params[1])
  385.       add_resource(:Faces, params[3])
  386.     when 323 # Change Vehicle Graphic
  387.       add_resource(:Characters, params[1])
  388.     when 335 # Enemy appear
  389.     when 336 # Enemy transform
  390.     when 337 # Show battle animation
  391.       add_resource(:Animations, @data_animations[params[1]].name)
  392.     end
  393.   end
  394.   
  395.   def check_move_route(route)
  396.     route.list.each do |cmd|
  397.       case cmd.code
  398.       when 41 # change character graphic
  399.         add_resource(:Characters, cmd.parameters[0])
  400.       when 44 # play SE
  401.         add_resource(:SE, cmd.parameters[0].name)
  402.       end
  403.     end
  404.   end
  405.   
  406.   def parse_command_list(list)
  407.     list.each {|cmd|
  408.       check_event_resources(cmd)
  409.     }
  410.   end
  411.   
  412.   def parse_event_page(page)
  413.    
  414.     add_resource(:Characters, page.graphic.character_name)
  415.     parse_command_list(page.list)
  416.   end
  417.   
  418.   def parse_event(event)
  419.     event.pages.each {|page|
  420.       parse_event_page(page)
  421.     }
  422.   end
  423.   
  424.   def parse_map_events(events)
  425.     events.each {|id, evt|
  426.       parse_event(evt)
  427.     }
  428.   end
  429.   
  430.   def run
  431.     parse_data_files
  432.     export
  433.   end
  434.   
  435.   def export
  436.     r = Resource_Exporter.new(@resources)
  437.     r.run
  438.   end
  439. end

  440. # basically the same thing, except no tilesets and different system
  441. class Resource_Finder_VX < Resource_Finder_Ace
  442.   
  443.   def make_data_path(filename)
  444.     "Data/#{filename}.rvdata"
  445.   end
  446.   
  447.   def parse_tilesets
  448.     system = load_data_file("System")
  449.     add_resource(:System, "TileA1")
  450.     add_resource(:System, "TileA2")
  451.     add_resource(:System, "TileA3")
  452.     add_resource(:System, "TileA4")
  453.     add_resource(:System, "TileA5")
  454.     add_resource(:System, "TileB")
  455.     add_resource(:System, "TileC")
  456.     add_resource(:System, "TileD")
  457.     add_resource(:System, "TileE")
  458.   end
  459.   
  460.   def parse_system
  461.     system = load_data_file("System")
  462.     add_resource(:BGM, system.title_bgm.name)
  463.     add_resource(:BGM, system.battle_bgm.name)
  464.     add_resource(:ME, system.battle_end_me.name)
  465.     add_resource(:ME, system.gameover_me.name)
  466.    
  467.     # add system sounds
  468.     system.sounds.each {|sound|
  469.       add_resource(:SE, sound.name)
  470.     }
  471.    
  472.     # test battle and editor related
  473.     add_resource(:Battlers, system.battler_name)   
  474.    
  475.     # vehicles
  476.     parse_vehicle(system.boat)
  477.     parse_vehicle(system.ship)
  478.     parse_vehicle(system.airship)
  479.    
  480.     # titles
  481.     add_resource(:System, "Title")
  482.    
  483.     # some default stuff
  484.     add_resource(:System, "BattleStart")
  485.     add_resource(:System, "BattleFloor")
  486.     add_resource(:System, "MessageBack")
  487.     add_resource(:System, "GameOver")
  488.     add_resource(:System, "IconSet")
  489.     add_resource(:System, "Shadow")
  490.     add_resource(:System, "Window")
  491.   end
  492.   
  493.   def parse_fonts
  494.     add_resource(:Fonts, "umeplus-gothic")
  495.   end
  496. end

  497. class Resource_Exporter
  498.   
  499.   def initialize(data)
  500.     @data = data
  501.     @outfile = nil
  502.   end
  503.   
  504.   def rtp_directory
  505.     Tsuki::Resource_Checker.rtp_directory
  506.   end
  507.   
  508.   def rtp_directory_valid?
  509.     return false unless File.directory?(rtp_directory)
  510.     return false unless File.directory?(rtp_directory + "Graphics")
  511.     return false unless File.directory?(rtp_directory + "Audio")
  512.     return false unless File.directory?(rtp_directory + "Fonts")
  513.     return true
  514.   end
  515.   
  516.   def create_outfile(name)
  517.     File.open(name, "w")
  518.   end
  519.   
  520.   def make_category_folder(category)
  521.     if Tsuki::Resource_Checker::Graphics_Dirs.include?(category)
  522.       name = "Graphics%s%s" %[File::Separator, category]
  523.     elsif Tsuki::Resource_Checker::Audio_Dirs.include?(category)
  524.       name = "Audio%s%s" %[File::Separator, category]
  525.     elsif Tsuki::Resource_Checker::Font_Dirs.include?(category)
  526.       return
  527.     end
  528.     Dir.mkdir(name) unless File.directory?(name)
  529.     return name
  530.   end
  531.   
  532.   def make_out_name(folder, category, name)
  533.     matches = Dir::glob("#{rtp_directory}#{folder}/#{category}/#{name}.*")
  534.     unless matches.empty?
  535.       ext = matches[0].split("/")[-1].split(".")[-1]
  536.     else
  537.       #Tsuki::Resource_Checker.show_message("%s was not found" %name)
  538.     end
  539.     return name + ".#{ext}"
  540.   end
  541.   
  542.   def make_path(category, name)   
  543.     outName = ""
  544.     if Tsuki::Resource_Checker::Graphics_Dirs.include?(category)
  545.       name = make_out_name("Graphics", category, name)
  546.       outName << sprintf("Graphics%s%s%s", File::Separator, category, File::Separator)
  547.     elsif Tsuki::Resource_Checker::Audio_Dirs.include?(category)
  548.       name = make_out_name("Audio", category, name)
  549.       outName << sprintf("Audio%s%s%s", File::Separator, category, File::Separator)
  550.     elsif Tsuki::Resource_Checker::Font_Dirs.include?(category)
  551.       name = make_out_name("", category, name)
  552.       outName << sprintf("Fonts%s", File::Separator)
  553.     end
  554.     return outName << name
  555.   end
  556.   
  557.   # just read/write
  558.   def copy_file(srcPath, destPath)
  559.     File.open(srcPath, 'rb') {|src_file|
  560.       File.open(destPath, 'wb') {|dest_file|
  561.         dest_file.write(src_file.read)
  562.       }
  563.     }
  564.   end
  565.   
  566.   def make_file(path)
  567.     begin
  568.       if FileTest.exist?(path)
  569.         # nothing. Don't clutter the console
  570.       elsif !FileTest.exist?(rtp_directory + path)
  571.         p "%s isn't an RTP file" %path
  572.       else
  573.         copy_file(rtp_directory + path, path)
  574.         p "%s - copied successfully" %path
  575.       end
  576.     rescue
  577.       Tsuki::Resource_Checker.show_message("Something went wrong! Just be careful")
  578.     end
  579.   end
  580.   
  581.   def write_heading(name)
  582.     @outfile.puts("== %s == " %name)
  583.   end
  584.   
  585.   def write_data(category, list)
  586.     list.sort.each {|name|
  587.       path = make_path(category, name)
  588.       @outfile.puts(sprintf("%s", path))
  589.     }
  590.     @outfile.puts("\n")
  591.   end
  592.   
  593.   # write the log out
  594.   def export_log
  595.     Tsuki::Resource_Checker.show_message("Scanning for resources")   
  596.     @outfile = create_outfile("used_resources.txt")
  597.    
  598.     @outfile.puts("The follow resources are used in the game:\n")
  599.     @data.each {|category, list|
  600.       write_heading(category)
  601.       write_data(category, list)
  602.     }
  603.     @outfile.close
  604.    
  605.     @outfile = create_outfile("unused_resources.txt")
  606.     write_unused_resources
  607.     @outfile.close
  608.    
  609.     Tsuki::Resource_Checker.show_message("Finished scanning resources")
  610.   end
  611.   
  612.   def write_unused_resources
  613.     @outfile.puts("=========================================\n")
  614.     @outfile.puts("The follow resources are unused\n")
  615.     @outfile.puts("=========================================\n")
  616.     @data.each do |category, list|
  617.       dirName = make_category_folder(category)
  618.       next unless dirName
  619.       
  620.       # Grab all of the files in the folder, without extensions
  621.       filenames = Dir.glob(dirName << "/*").collect {|path| File.basename(path, ".*") }
  622.       
  623.       # Remove the ones that we found in the game
  624.       filenames -= list
  625.       
  626.       # These are all unused      
  627.       write_heading(category)
  628.       write_data(category, filenames)
  629.     end
  630.   end
  631.   
  632.   # lol inefficient but I like it separated
  633.   def copy_files
  634.     Tsuki::Resource_Checker.show_message("Begin file copying")
  635.     t1 = Time.now
  636.     # check RTP folder exists
  637.     unless rtp_directory_valid?
  638.       Tsuki::Resource_Checker.show_message("Your RTP directory is invalid or inaccessible")
  639.       return
  640.     end
  641.     # basic folders
  642.     Dir.mkdir("Graphics") unless File.directory?("Graphics")
  643.     Dir.mkdir("Audio") unless File.directory?("Audio")
  644.     Dir.mkdir("Fonts") unless File.directory?("Fonts")
  645.     Dir.mkdir("Movies") unless File.directory?("Movies")
  646.     Dir.mkdir("System") unless File.directory?("System")
  647.    
  648.     @data.each {|category, list|
  649.       make_category_folder(category)
  650.       list.each { |name|
  651.         path = make_path(category, name)
  652.         make_file(path)
  653.       }
  654.     }
  655.     t2 = Time.now
  656.     Tsuki::Resource_Checker.show_message("File copy complete in %f seconds." %(t2 - t1))
  657.   end
  658.   
  659.   def run
  660.     export_log
  661.     copy_files if Tsuki::Resource_Checker::Copy_Files_Over
  662.   end
  663. end

  664. class Game_Interpreter
  665.   
  666.   def build_resource_list
  667.     r = Tsuki::Resource_Checker.init_resource_finder
  668.     r.run
  669.   end
  670. end
复制代码


你找到的腳本的確有這個功能,作者寫在使用方法(usage),而不是簡介(Description)上面,我一開始也沒注意到。

路徑使用了我的電腦上面的,跟你的可能不一樣。

啟用按鍵改為Enter, 因為我沒找到input module

復原了一句被作者本人注釋的代碼,第556行
  1. return name + ".#{ext}"
复制代码
,應該為閱讀文件格式之用,被注釋原因不明。

不支援額外腳本中引用的RTP文件

無法觸發你在另一個帖碰上的BUG,也就無法除錯,不過在我的電腦上是運行成功。
可能還有其他BUG,而我其實並不熟悉這種特殊科技,星屑你先留著。

点评

嗯,我的就是不能复制,而且出来的两个文本文档,一个是已使用的文件,没有一个。。。 另一个是使用的,全部都有,这不可能,估计我用不了  发表于 2018-1-1 13:40
回复

使用道具 举报

梦石
0
星屑
544
在线时间
59 小时
注册时间
2017-11-19
回帖
62
 楼主| 发表于 2018-1-1 13:09:30 | 显示全部楼层
SixRC 发表于 2018-1-1 12:24
# 复制游戏所需RTP资源的脚本 请插到最前面
#   请自行修改下面第 8 行RTP目录
# 原理是用到的时候检查文件 ...

嗯,感谢回答,脚本可用
回复

使用道具 举报

梦石
0
星屑
544
在线时间
59 小时
注册时间
2017-11-19
回帖
62
 楼主| 发表于 2018-1-1 13:36:24 | 显示全部楼层
SixRC 发表于 2017-12-31 23:24
# 复制游戏所需RTP资源的脚本 请插到最前面
#   请自行修改下面第 8 行RTP目录
# 原理是用到的时候检查文件 ...

一个问题:我导入一个WAV格式的音频文件,然后出现以下提示,需要变成OGG的,而且导入的文件都需要在导入到RTP目录里,而且工程文件里面已经有啦,不需要了,这个怎么破。如图 捕.PNG 获.PNG 捕获.PNG

点评

好了 假如有新的后缀请自己在18行添加一下  发表于 2018-1-1 13:50
修正中  发表于 2018-1-1 13:40
回复

使用道具 举报

梦石
0
星屑
544
在线时间
59 小时
注册时间
2017-11-19
回帖
62
 楼主| 发表于 2018-1-1 13:53:48 | 显示全部楼层
SixRC 发表于 2017-12-31 23:24
# 复制游戏所需RTP资源的脚本 请插到最前面
#   请自行修改下面第 9 行RTP目录
#     以及第 18 行非RTP素 ...

18行? 捕获.PNG
不是,可不可以自己跳过导入的,因为工程文件已经有了
回复

使用道具 举报

梦石
0
星屑
544
在线时间
59 小时
注册时间
2017-11-19
回帖
62
 楼主| 发表于 2018-1-1 13:56:14 | 显示全部楼层
SixRC 发表于 2017-12-31 23:24
# 复制游戏所需RTP资源的脚本 请插到最前面
#   请自行修改下面第 9 行RTP目录
#     以及第 18 行非RTP素 ...

抱歉,是我弄错了

点评

嗯,谢谢了,加个好友吧,QQ:2995680634(嘿嘿,有点小私心,以后有什么不懂问你啦(*^▽^*))  发表于 2018-1-1 14:00
嗯 ok啦  发表于 2018-1-1 13:57
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部