设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 89|回复: 0

[转载发布] Resource Sifter

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58751
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68660

    灌水之王

    发表于 2026-7-26 09:47:21 | 显示全部楼层 |阅读模式
    Resource Sifter
    Version: 1.0



    Introduction

    This script is a resource management utility tool designed to search your product  and list any audio or graphic resoures no longer in use,  or not being used by the base RPGMaker database and map system to be specific.

    It does not have the capability  to compare resources to content defined within custom scripts.  Only that of the based/default systems and database are recognized.



    Screenshots




    There.... It's shot....



    Demo

    Nope.



    Script

    Spoiler: Here ya go
                    Code:       
    1. #==============================================================================
    2. # ** Resource Sifter (XP)
    3. #------------------------------------------------------------------------------
    4. #    by DerVVulfman
    5. #    version 1.0
    6. #    08-07-2024 (MM-DD-YYYY)
    7. #    RGSS / RPGMaker XP
    8. #==============================================================================
    9. #
    10. #  INTRODUCTION
    11. #  ============
    12. #
    13. #    This script is a resource management utility tool designed to search your
    14. #    product  and list any audio or graphic resoures no longer in use,  or not
    15. #    being used by the base RPGMaker database and map system to be specific.
    16. #
    17. #    It does not have the capability  to compare resources to content defined
    18. #    within custom scripts.  Only that of the based/default systems and data-
    19. #    base are recognized.
    20. #
    21. #
    22. #    -------------------------------------------------------------------------
    23. #
    24. #  INSTRUCTIONS
    25. #  ============
    26. #
    27. #    Place below Scene_Debug and above Main.  If necessary,  the configuration
    28. #    section is available to alter titles and headings if language differences
    29. #    exit. After that, just execute/run your project.
    30. #
    31. #    There will be a temporary pause as the script gathers all your resources
    32. #    and stores them in memory. After that, it will go through your project's
    33. #    database and maps  and erase from the memorized resource lists any files
    34. #    that match.
    35. #
    36. #    When all searching hase been completed, a report will appear within your
    37. #    project's root folder, typically "Sifted Resources.txt" by default. This
    38. #    report will list all of the files that could not be found,  and thus not
    39. #    used by your project.
    40. #
    41. #
    42. #    -------------------------------------------------------------------------
    43. #
    44. #  WARNING
    45. #  =======
    46. #
    47. #    Some filenames may contain characters of which this script cannot account
    48. #    and will be unable to test.  If any such files are encountered, they will
    49. #    be separated and may be found on the bottom of the report. The header for
    50. #    these files is "Cannot be used" by the configuration's default.
    51. #
    52. #    The script will gather all your game's resources and store them in memo-
    53. #    ry before comparing them  to resources defined/referenced  in your game.
    54. #
    55. #    Any resources in your project that are not defined in your game will be
    56. #    project folder for "Audio" not used in your game. That is to say, it will
    57. #    find if you have any extra/unnecessary audio files.
    58. #
    59. #
    60. #    -------------------------------------------------------------------------
    61. #
    62. #  COMPATABILITY
    63. #  =============
    64. #
    65. #    Designed for RPGMaker XP and its default system/database layout.  Custom
    66. #    scripts and systems other than RPGMaker XP are not taken into account.
    67. #
    68. #
    69. #==============================================================================
    70. #
    71. #  CREDITS AND TERMS:
    72. #  ==================
    73. #
    74. #    This is a free-for-use design tool. However, due credit for its use would
    75. #    be appreciated.
    76. #
    77. #    If ported to any other system by a scripter other than myself, I only ask
    78. #    for credit of the original concept,  and a link be provides to this topic
    79. #    of origin:  https://www.save-point.org/thread-8991.html
    80. #
    81. #
    82. #==============================================================================
    83. #==============================================================================
    84. # ** Resource_Sifter
    85. #------------------------------------------------------------------------------
    86. #  This portion of the Resource Sifter module holds the words/dialogue used
    87. #  within the generated report.
    88. #==============================================================================
    89. module Resource_Sifter
    90.   # FILENAME
    91.   # ========
    92.   # This is the name of the file generated and saved in your project's folder.
    93.   # --------------------------------------------------------------------------
    94.   #
    95.     FILENAME  = "Sifted Resources.txt"
    96.   # NO CONTENT FOUND TEXT
    97.   # =====================
    98.   # This is a single line of text that will appear in the report if the script
    99.   # cannot find any resources unused by your project.
    100.   # --------------------------------------------------------------------------
    101.   #
    102.     WORDS_NO_CONTENT  = "No content to report"      # Text if all checks out
    103.   # MAIN DOCUMENT HEADINGS
    104.   # ======================
    105.   # This is where you define the title of the report  as it will appear at the
    106.   # top, and the smaller headings for the Audio and Graphic resources found.
    107.   # --------------------------------------------------------------------------
    108.   #
    109.     WORDS_TITLE       = "SIFTED RESOURCES REPORT"   # Report title/header
    110.     WORDS_AUDIO       = "Audio"                     # Audio resources header
    111.     WORDS_GRAPHICS    = "Graphics"                  # Graphic resources header
    112.   # EDITABLE HEADINGS: AUDIO
    113.   # ========================
    114.   # This is where  you define the headings  for the individual audio resources
    115.   # that may still exist within your project,  but are unused.  These headings
    116.   # should basically conform to the subfolders in the project's Audio folder.
    117.   # --------------------------------------------------------------------------
    118.   #
    119.     WORDS_BGM         = "Background Music"
    120.     WORDS_BGS         = "Background/Ambient Sound"
    121.     WORDS_ME          = "Music Effects"
    122.     WORDS_SE          = "Sound Effects"
    123.   # EDITABLE HEADINGS: GRAPHICS
    124.   # ===========================
    125.   # This is where you define the headings for the individual graphic resources
    126.   # that may still exist within your project,  but are unused.  These headings
    127.   # should basically conform to the subfolders in the project's Graphic folder.
    128.   # --------------------------------------------------------------------------
    129.   #
    130.     WORDS_ANIMATIONS  = "Animation(s)"
    131.     WORDS_AUTOTILES   = "Map Auto-Tile(s)"
    132.     WORDS_BATTLEBACKS = "Battleback(s)"
    133.     WORDS_BATTLERS    = "Battler(s)"
    134.     WORDS_CHARACTERS  = "Character Set(s)"
    135.     WORDS_FOGS        = "Fog(s)"
    136.     WORDS_GAMEOVERS   = "Gameover screen(s)"
    137.     WORDS_ICONS       = "Icon(s)"
    138.     WORDS_PANORAMAS   = "Panorama(s)"
    139.     WORDS_PICTURES    = "Picture(s)"
    140.     WORDS_TILESETS    = "Map Tileset(s)"
    141.     WORDS_TITLES      = "Title Screen(s)"
    142.     WORDS_TRANSITIONS = "Transition(s)"
    143.     WORDS_WINDOWSKINS = "Windowskin(s)"
    144.   # EDITABLE HEADINGS: INVALID
    145.   # ==========================
    146.   # This is where  you define the headings  for the individual resources whose
    147.   # filename may contain illegal characters that this script is unable to test.
    148.   # --------------------------------------------------------------------------
    149.   #
    150.     WORDS_INVALID     = "Cannot be used"
    151. end
    152. #==============================================================================
    153. #                            DO NOT PROCEED FURTHER
    154. #==============================================================================
    155. #==============================================================================
    156. # ** Resource_Sifter
    157. #------------------------------------------------------------------------------
    158. #  This portion of the Resource Sifter module is the executable code. It is not
    159. #  to be altered or edited.  All editing takes place in the above section.
    160. #==============================================================================
    161. module Resource_Sifter
    162.   #--------------------------------------------------------------------------
    163.   # * Invariables
    164.   #--------------------------------------------------------------------------  
    165.   GFX = ['@system_l.gameover_name',          '@system_l.title_name',
    166.          '@system_l.battle_transition',      '@system_l.windowskin_name',
    167.          '@system_l.title_bgm.name',         '@system_l.battle_bgm.name',
    168.          '@system_l.battle_end_me.name',     '@system_l.gameover_me.name']
    169.          
    170.   SFX = ['@system_l.cursor_se.name',         '@system_l.decision_se.name',
    171.          '@system_l.cancel_se.name',         '@system_l.buzzer_se.name',
    172.          '@system_l.equip_se.name',          '@system_l.shop_se.name',
    173.          '@system_l.save_se.name',           '@system_l.load_se.name',
    174.          '@system_l.battle_start_se.name',   '@system_l.escape_se.name',   
    175.          '@system_l.actor_collapse_se.name', '@system_l.enemy_collapse_se.name']
    176.   #--------------------------------------------------------------------------
    177.   # * Main Processing
    178.   #--------------------------------------------------------------------------
    179.   def self.main
    180.     #
    181.     setup                                     # Setup data
    182.     update                                    # Update/Process tests
    183.     output                                    # Output result(s)
    184.     #
    185.   end
    186.   #--------------------------------------------------------------------------
    187.   # * Main Proccing Commands
    188.   #--------------------------------------------------------------------------
    189.   
    190.   #--------------------------------------------------------------------------
    191.   # * Setup
    192.   #--------------------------------------------------------------------------
    193.   def self.setup
    194.     #
    195.     setup_database                            # Load editor database
    196.     setup_arrays                              # Create resource arrays
    197.     setup_files                               # Load resources
    198.     #
    199.   end
    200.   #--------------------------------------------------------------------------
    201.   # * Update and perform searches
    202.   #--------------------------------------------------------------------------
    203.   def self.update
    204.     #
    205.     search_actors                             # Search actor database
    206.     search_animations                         # Search animations database
    207.     search_common                             # Search common events
    208.     search_enemy                              # Search enemy database
    209.     search_icons                              # Search databases for Icons
    210.     search_map                                # Search map content
    211.     search_se                                 # Search databased for SE
    212.     search_system                             # Search system database
    213.     search_tiles                              # Search tileset database
    214.     #
    215.   end
    216.   #--------------------------------------------------------------------------
    217.   # * Output Content
    218.   #--------------------------------------------------------------------------
    219.   def self.output
    220.     #
    221.     # Open the file with the defined filename
    222.     filename  = Resource_Sifter::FILENAME
    223.     f         = File.new(filename,  "w+")            
    224.     #
    225.     # Generate Title Header
    226.     output_header(f, Resource_Sifter::WORDS_TITLE, true )
    227.     #
    228.     #
    229.     # Empty report if no viable content
    230.     unless output_test
    231.       output_text(f, "")
    232.       output_text(f, Resource_Sifter::WORDS_NO_CONTENT)
    233.       return
    234.     end
    235.     #
    236.     #
    237.     output_body(f)
    238.     #
    239.     f.close
    240.     #
    241.   end
    242.   #--------------------------------------------------------------------------
    243.   # * Setup Commands
    244.   #--------------------------------------------------------------------------
    245.   
    246.   #--------------------------------------------------------------------------
    247.   # * Setup (when gaining access to the RMXP database)
    248.   #--------------------------------------------------------------------------
    249.   def self.setup_database
    250.     #
    251.     @actor_l    = load_data("Data/Actors.rxdata")
    252.     @anim_l     = load_data("Data/Animations.rxdata")
    253.     @armor_l    = load_data("Data/Armors.rxdata")
    254.     @common_l   = load_data("Data/CommonEvents.rxdata")
    255.     @enemy_l    = load_data("Data/Enemies.rxdata")
    256.     @item_l     = load_data("Data/Items.rxdata")
    257.     @skill_l    = load_data("Data/Skills.rxdata")
    258.     @tiles_l    = load_data("Data/Tilesets.rxdata")
    259.     @troop_l    = load_data("Data/Troops.rxdata")
    260.     @map_l      = load_data("Data/MapInfos.rxdata")
    261.     @system_l   = load_data("Data/System.rxdata")
    262.     @weapon_l   = load_data("Data/Weapons.rxdata")
    263.     #
    264.   end
    265.   #--------------------------------------------------------------------------
    266.   # * Setup (when creating the empty resource arrays)
    267.   #--------------------------------------------------------------------------
    268.   def self.setup_arrays
    269.     #
    270.     # Audio
    271.     @root_bgm       = []    # Background music
    272.     @root_bgs       = []    # Ambient background sound
    273.     @root_me        = []    # Music effects
    274.     @root_se        = []    # Sound effects
    275.     #
    276.     # Graphics
    277.     @root_anims     = []   # Animations
    278.     @root_auto      = []   # Autotiles
    279.     @root_backs     = []   # Battlebacks
    280.     @root_batt      = []   # Battlers
    281.     @root_chars     = []   # Characters
    282.     @root_fogs      = []   # Fogs
    283.     @root_g_over    = []   # Game Over
    284.     @root_icons     = []   # Icons
    285.     @root_pan       = []   # Panoramas
    286.     @root_pics      = []   # Pictures
    287.     @root_tiles     = []   # Tilesets
    288.     @root_title     = []   # Title
    289.     @root_trans     = []   # Transition
    290.     @root_w_skin    = []   # Windowskin
    291.     #
    292.     @invalid        = []   # Cannot be validated
    293.     #
    294.   end
    295.   #--------------------------------------------------------------------------
    296.   # * Setup (when loading all resource content)
    297.   #--------------------------------------------------------------------------
    298.   def self.setup_files
    299.     #
    300.     # Audio
    301.     setup_file_load(@root_bgm,      "Audio/BGM/*")
    302.     setup_file_load(@root_bgs,      "Audio/BGS/*")
    303.     setup_file_load(@root_me,       "Audio/ME/*")
    304.     setup_file_load(@root_se,       "Audio/SE/*")
    305.     #
    306.     # Graphics
    307.     setup_file_load(@root_anims,    "Graphics/Animations/*")
    308.     setup_file_load(@root_auto,     "Graphics/Autotiles/*")
    309.     setup_file_load(@root_backs,    "Graphics/Battlebacks/*")
    310.     setup_file_load(@root_batt,     "Graphics/Battlers/*")
    311.     setup_file_load(@root_chars,    "Graphics/Characters/*")
    312.     setup_file_load(@root_fogs,     "Graphics/Fogs/*")
    313.     setup_file_load(@root_g_over,   "Graphics/Gameovers/*")
    314.     setup_file_load(@root_icons,    "Graphics/Icons/*")
    315.     setup_file_load(@root_pan,      "Graphics/Panoramas/*")
    316.     setup_file_load(@root_pics,     "Graphics/Pictures/*")
    317.     setup_file_load(@root_tiles,    "Graphics/Tilesets/*")
    318.     setup_file_load(@root_title,    "Graphics/Titles/*")
    319.     setup_file_load(@root_trans,    "Graphics/Transitions/*")
    320.     setup_file_load(@root_w_skin,   "Graphics/Windowskins/*")
    321.     #
    322.   end
    323.   #--------------------------------------------------------------------------
    324.   # * Setup (when acquiring files from a game resource folder)
    325.   #     pathway_list : pathway specific resource array
    326.   #     path_test    : the folder path for a resource
    327.   #--------------------------------------------------------------------------
    328.   def self.setup_file_load(pathway_list, path_test)
    329.     #
    330.     path_len  = (path_test.length) -1         # Get pathway length (minus *)
    331.     #
    332.     for name in Dir[path_test]                # Cycle through root folder
    333.       #
    334.       unless FileTest.exist?(name)            # If cannot be tested
    335.         @invalid.push(name)                   # Push into untestable array
    336.         next                                  # And skip to next
    337.       end
    338.       #
    339.       next if File.stat(name).directory?      # If NOT a subfolder
    340.       name_len = name.length                  # Get filename's length
    341.       name_len -= path_len                    # Shorten length by path length
    342.       name = name.slice(path_len, name_len)   # Trim the audio name
    343.       pathway_list.push(name)                 # Push into the root path list
    344.     end
    345.     #
    346.   end
    347.   #--------------------------------------------------------------------------
    348.   # * Update Search Commands
    349.   #--------------------------------------------------------------------------
    350.   #--------------------------------------------------------------------------
    351.   # * Actor Database Search
    352.   #--------------------------------------------------------------------------  
    353.   def self.search_actors
    354.     #
    355.     for actor in @actor_l                     # Cycle through actors
    356.       #
    357.       next if actor.nil?                      # Skip invalid actor
    358.       test_char(actor.character_name)         # Test Character
    359.       test_battler(actor.battler_name)        # Test Battler      
    360.       #
    361.     end
    362.     #
    363.   end
    364.   #--------------------------------------------------------------------------
    365.   # * Animation Database Search
    366.   #--------------------------------------------------------------------------
    367.   def self.search_animations
    368.     #
    369.     for anim in @anim_l                       # Cycle through animations
    370.       #
    371.       next if anim.nil?                       # Skip invalid animation
    372.       test_anim(anim.animation_name)          # Test animation
    373.       #
    374.       times = anim.timings                    # Acquire timing for animation
    375.       for timed in times                      # Cycle through timing
    376.         next if timed.nil?                    # Skip invalid timing
    377.         test_se(timed.se.name)                # Test SE
    378.       end
    379.       #
    380.     end
    381.     #
    382.   end
    383.   #--------------------------------------------------------------------------
    384.   # * Common Events Database Search
    385.   #--------------------------------------------------------------------------
    386.   def self.search_common
    387.     #
    388.     for event in @common_l                    # Cycle through all common events
    389.       next if event.nil?                      # Skip invalid event
    390.       list = event.list                       # Get list of commands
    391.       search_events(list)                     #`Search every item in the event
    392.     end
    393.     #
    394.   end
    395.   #--------------------------------------------------------------------------
    396.   # * Enemy Database Search
    397.   #--------------------------------------------------------------------------
    398.   def self.search_enemy
    399.     #
    400.     for enemy in @enemy_l                     # Cycle through enemies
    401.       #
    402.       next if enemy.nil?                      # Skip invalid enemy
    403.       test_battler(enemy.battler_name)        # Test Battler      
    404.       #
    405.     end
    406.     #
    407.   end
    408.   #--------------------------------------------------------------------------
    409.   # * Icons Search (Multiple Databases)
    410.   #--------------------------------------------------------------------------
    411.   def self.search_icons
    412.     #
    413.     sift_icons(@armor_l)                      # Armor database
    414.     sift_icons(@item_l)                       # Item database
    415.     sift_icons(@skill_l)                      # Skill database
    416.     sift_icons(@weapon_l)                     # Weapon database
    417.     #
    418.   end
    419.   #--------------------------------------------------------------------------
    420.   # * Map Database Search
    421.   #--------------------------------------------------------------------------
    422.   def self.search_map
    423.     #
    424.     for map in @map_l                         # Cycle through all maps
    425.       #
    426.       id        = map[0]                      # Get the map ID
    427.       text      = "Data/Map%03d.rxdata"       # Define the Map file structure
    428.       filename  = sprintf(text, id)           # Get the formatted map filename
    429.       map_data  = load_data(filename)         # Get the map data
    430.       #
    431.       sift_map_params(map_data)               # Search through map parameters
    432.       sift_map_events(map_data)               # Search through map events
    433.       #
    434.     end
    435.     #
    436.   end
    437.   #--------------------------------------------------------------------------
    438.   # * SE Search (Multiple Databases)
    439.   #--------------------------------------------------------------------------
    440.   def self.search_se
    441.     #
    442.     sift_se(@item_l)                          # Item Database
    443.     sift_se(@skill_l)                         # Skill Database
    444.     #
    445.   end
    446.   #--------------------------------------------------------------------------
    447.   # * System Database Search
    448.   #--------------------------------------------------------------------------
    449.   def self.search_system
    450.     #
    451.     test_gameover(eval(GFX[0]))               # Test Gameover screen
    452.     test_title(eval(GFX[1]))                  # Test Title screen
    453.     test_trans(eval(GFX[2]))                  # Test Transitions
    454.     test_windowskin(eval(GFX[3]))             # Test Windowskin
    455.     #
    456.     test_bgm(eval(GFX[4]))                    # Test Title Screen BGM
    457.     test_bgm(eval(GFX[5]))                    # Test Battle BGM
    458.     test_me(eval(GFX[6]))                     # Test Battle End ME
    459.     test_me(eval(GFX[7]))                     # Test Gameover ME
    460.     #
    461.     for item in SFX                           # Cycle through all System Sfx
    462.       test_se(eval(item))                     # Test each Sound Effect
    463.     end
    464.     #
    465.   end
    466.   #--------------------------------------------------------------------------
    467.   # * Tileset Database Search
    468.   #--------------------------------------------------------------------------
    469.   def self.search_tiles
    470.     #
    471.     for tile in @tiles_l                      # Cycle through all tilesets
    472.       #
    473.       next if tile.nil?                       # Skip if no tile data
    474.       autotiles = tile.autotile_names         # Grab autotile names
    475.       for auto in autotiles                   # Cycle through all autotiles
    476.         test_auto(auto)                       # Test autotile
    477.       end
    478.       test_panoramas(tile.panorama_name)      # Test Panorama
    479.       test_fogs(tile.fog_name)                # Test Fogs
    480.       test_battlebacks(tile.battleback_name)  # Test Battlebacks
    481.       test_tiles(tile.tileset_name)           # Test Tileset
    482.       #
    483.     end
    484.     #
    485.   end
    486.   #--------------------------------------------------------------------------
    487.   # * Update Sift Commands (executed by searches)
    488.   #--------------------------------------------------------------------------
    489.   #--------------------------------------------------------------------------
    490.   # * Sift through database Icons
    491.   #     list : list of database objects
    492.   #--------------------------------------------------------------------------
    493.   def self.sift_icons(list)
    494.     #
    495.     for list_item in list                     # Cycle through all items in list
    496.       next if list_item.nil?                  # Skip if item invalid
    497.       test_icons(list_item.icon_name)         # Test Icon
    498.     end
    499.     #
    500.   end
    501.   #--------------------------------------------------------------------------
    502.   # * Sift through map events
    503.   #     map_data : data acquired from a single map
    504.   #--------------------------------------------------------------------------
    505.   def self.sift_map_events(map_data)
    506.     #
    507.     events = {}                               # Create the Event hash array
    508.     for i in map_data.events.keys             # Sort through map events
    509.       events[i] = map_data.events[i]          # Fill testable Event hash array
    510.     end
    511.     #
    512.     for event in events                       # Sort through the Event array
    513.       for page in event[1].pages.reverse      # Sort through Event Pages
    514.         char = page.graphic.character_name    # Get character
    515.         test_char(char)                       # Test Character
    516.         list = page.list                      # Get the list of commands  
    517.         search_events(list)                   # Execute resource item search
    518.       end
    519.     end
    520.     #
    521.   end
    522.   #--------------------------------------------------------------------------
    523.   # * Sift through map parameters
    524.   #     map_data : data acquired from a single map
    525.   #--------------------------------------------------------------------------
    526.   def self.sift_map_params(map_data)
    527.     #
    528.     test_bgm(map_data.bgm.name)               # Test the map's auto-run BGM
    529.     test_bgs(map_data.bgs.name)               # Test the map's auto-run BGS
    530.     #
    531.   end
    532.   #--------------------------------------------------------------------------
    533.   # * Sift through database SEs
    534.   #     list : list of database objects
    535.   #--------------------------------------------------------------------------
    536.   def self.sift_se(list)
    537.     #
    538.     for list_item in list                     # Cycle through all items in list
    539.       next if list_item.nil?                  # Skip if item invalid
    540.       test_se(list_item.menu_se.name)         # Test SE
    541.     end
    542.     #
    543.   end
    544.   #--------------------------------------------------------------------------
    545.   # * Update Map Event Search
    546.   #--------------------------------------------------------------------------
    547.   #--------------------------------------------------------------------------
    548.   # * Map Database Search (when sifting through each event command)
    549.   #--------------------------------------------------------------------------
    550.   def self.search_events(list)
    551.     #
    552.     for list_item in list                     # Cycle through all items in list
    553.       item_0 = list_item.parameters[0]        # Get the item
    554.       item_1 = list_item.parameters[1]        # Get the item
    555.       case list_item.code                     # Branch by item's event code
    556.         #
    557.         when 131 ; test_windowskin(item_0)    # Test Windowskin
    558.         when 132 ; test_bgm(item_0.name)      # Test Battle BGM
    559.         when 133 ; test_me(item_0.name)       # Test Battle End ME
    560.         when 204 ; search_ev_204(list_item)   # Test Map Settings
    561.         when 209 ; search_ev_209(list_item)   # Test Move Route
    562.         when 222 ; test_trans(item_0)         # Test Transition
    563.         when 231 ; test_pictures(item_1)      # Test Picture
    564.         when 241 ; test_bgm(item_0.name)      # Test BGM
    565.         when 245 ; test_bgs(item_0.name)      # Test BGS
    566.         when 249 ; test_me(item_0.name)       # Test ME
    567.         when 250 ; test_se(item_0.name)       # Test SE
    568.         when 322 ; search_ev_322(list_item)   # Test Actor Graphic
    569.         #
    570.       end
    571.     end
    572.   end
    573.   #--------------------------------------------------------------------------
    574.   # * Map Database Search (when changing the map settings)
    575.   #--------------------------------------------------------------------------
    576.   def self.search_ev_204(list_item)
    577.     #
    578.     item_0 = list_item.parameters[0]        # Get the item
    579.     item_1 = list_item.parameters[1]        # Get the item
    580.     #   
    581.     case item_0
    582.       when 0  ; test_panoramas(item_1)      # Test Panoramas
    583.       when 1  ; test_fogs(item_1)           # Test Fogs
    584.       when 2  ; test_battlebacks(item_1)    # Test Battlebacks
    585.     end
    586.     #
    587.   end
    588.   #--------------------------------------------------------------------------
    589.   # * Map Database Search (when sifting through the move route command)
    590.   #--------------------------------------------------------------------------
    591.   def self.search_ev_209(list_item)
    592.     #
    593.     move_l = list_item.parameters[1].list     # Get the move route command list
    594.     for move_item in move_l                   # Cycle through
    595.       item_0 = move_item.parameters[0]        # Get the item
    596.       case move_item.code                     # Branch by item's event code
    597.         when 41 ; test_char(item_0)           # Test Characterset
    598.         when 44 ; test_se(item_0.name)        # Test SE
    599.       end
    600.     end
    601.     #
    602.   end
    603.   #--------------------------------------------------------------------------
    604.   # * Map Database Search (when sifting through the change actor command)
    605.   #--------------------------------------------------------------------------
    606.   def self.search_ev_322(list_item)
    607.     #
    608.     move_l = list_item.parameters[1].list     # Get the character
    609.     move_3 = list_item.parameters[1].list     # Get the battler
    610.     #
    611.     test_char(item_1)                         # Test Character
    612.     test_battler(item_3)                      # Test Battler
    613.     #
    614.   end
    615.   #--------------------------------------------------------------------------
    616.   # * Tests : Audio
    617.   #--------------------------------------------------------------------------
    618.   #--------------------------------------------------------------------------
    619.   # * Test BGM Audio resource and remove from list
    620.   #     filename     : name of the resource to test
    621.   #--------------------------------------------------------------------------
    622.   def self.test_bgm(filename)
    623.     #
    624.     return if filename.nil?                   # Exit if no file
    625.     return if filename. == ''                 # Exit if empty filename
    626.     test_resource(@root_bgm, filename)        # Perform resource test
    627.     #
    628.   end
    629.   #--------------------------------------------------------------------------
    630.   # * Test BGS Audio resource and remove from list
    631.   #     filename     : name of the resource to test
    632.   #--------------------------------------------------------------------------
    633.   def self.test_bgs(filename)
    634.     #
    635.     return if filename.nil?                   # Exit if no file
    636.     return if filename. == ''                 # Exit if empty filename
    637.     test_resource(@root_bgs, filename)        # Perform resource test
    638.     #
    639.   end
    640.   #--------------------------------------------------------------------------
    641.   # * Test ME Audio resource and remove from list
    642.   #     filename     : name of the resource to test
    643.   #--------------------------------------------------------------------------
    644.   def self.test_me(filename)
    645.     #
    646.     return if filename.nil?                   # Exit if no file
    647.     return if filename. == ''                 # Exit if empty filename
    648.     test_resource(@root_me, filename)         # Perform resource test
    649.     #
    650.   end
    651.   #--------------------------------------------------------------------------
    652.   # * Test SE Audio resource and remove from list
    653.   #     filename     : name of the resource to test
    654.   #--------------------------------------------------------------------------
    655.   def self.test_se(filename)
    656.     #
    657.     return if filename.nil?                   # Exit if no file
    658.     return if filename. == ''                 # Exit if empty filename
    659.     test_resource(@root_se, filename)         # Perform resource test
    660.     #
    661.   end
    662.   #--------------------------------------------------------------------------
    663.   # * Tests : Graphic
    664.   #--------------------------------------------------------------------------
    665.   #--------------------------------------------------------------------------
    666.   # * Test Animation Graphic resource and remove from list
    667.   #     filename     : name of the resource to test
    668.   #--------------------------------------------------------------------------
    669.   def self.test_anim(filename)
    670.     #
    671.     return if filename.nil?                   # Exit if no file
    672.     return if filename. == ''                 # Exit if empty filename
    673.     test_resource(@root_anims, filename)      # Perform resource test
    674.     #
    675.   end
    676.   #--------------------------------------------------------------------------
    677.   # * Test Pictures Graphic resource and remove from list
    678.   #     filename     : name of the resource to test
    679.   #--------------------------------------------------------------------------
    680.   def self.test_auto(filename)
    681.     #
    682.     return if filename.nil?                   # Exit if no file
    683.     return if filename. == ''                 # Exit if empty filename
    684.     test_resource(@root_auto, filename)       # Perform resource test
    685.     #
    686.   end
    687.   #--------------------------------------------------------------------------
    688.   # * Test Pictures Graphic resource and remove from list
    689.   #     filename     : name of the resource to test
    690.   #--------------------------------------------------------------------------
    691.   def self.test_battlebacks(filename)
    692.     #
    693.     return if filename.nil?                   # Exit if no file
    694.     return if filename. == ''                 # Exit if empty filename
    695.     test_resource(@root_backs, filename)      # Perform resource test
    696.     #
    697.   end
    698.   #--------------------------------------------------------------------------
    699.   # * Test Battler Graphic resource and remove from list
    700.   #     filename     : name of the resource to test
    701.   #--------------------------------------------------------------------------
    702.   def self.test_battler(filename)
    703.     #
    704.     return if filename.nil?                   # Exit if no file
    705.     return if filename. == ''                 # Exit if empty filename
    706.     test_resource(@root_batt, filename)       # Perform resource test
    707.     #
    708.   end
    709.   #--------------------------------------------------------------------------
    710.   # * Test Character Graphic resource and remove from list
    711.   #     filename     : name of the resource to test
    712.   #--------------------------------------------------------------------------
    713.   def self.test_char(filename)
    714.     #
    715.     return if filename.nil?                   # Exit if no file
    716.     return if filename. == ''                 # Exit if empty filename
    717.     test_resource(@root_chars, filename)      # Perform resource test
    718.     #
    719.   end
    720.   #--------------------------------------------------------------------------
    721.   # * Test Fog Graphic resource and remove from list
    722.   #     filename     : name of the resource to test
    723.   #--------------------------------------------------------------------------
    724.   def self.test_fogs(filename)
    725.     #
    726.     return if filename.nil?                   # Exit if no file
    727.     return if filename. == ''                 # Exit if empty filename
    728.     test_resource(@root_fogs, filename)       # Perform resource test
    729.     #
    730.   end
    731.   #--------------------------------------------------------------------------
    732.   # * Test GameOver Graphic resource and remove from list
    733.   #     filename     : name of the resource to test
    734.   #--------------------------------------------------------------------------
    735.   def self.test_gameover(filename)
    736.     #
    737.     return if filename.nil?                   # Exit if no file
    738.     return if filename. == ''                 # Exit if empty filename
    739.     test_resource(@root_g_over, filename)     # Perform resource test
    740.     #
    741.   end
    742.   #--------------------------------------------------------------------------
    743.   # * Test Icon Graphic resource and remove from list
    744.   #     filename     : name of the resource to test
    745.   #--------------------------------------------------------------------------
    746.   def self.test_icons(filename)
    747.     #
    748.     return if filename.nil?                   # Exit if no file
    749.     return if filename. == ''                 # Exit if empty filename
    750.     test_resource(@root_icons, filename)      # Perform resource test
    751.     #
    752.   end
    753.   #--------------------------------------------------------------------------
    754.   # * Test Panorama Graphic resource and remove from list
    755.   #     filename     : name of the resource to test
    756.   #--------------------------------------------------------------------------
    757.   def self.test_panoramas(filename)
    758.     #
    759.     return if filename.nil?                   # Exit if no file
    760.     return if filename. == ''                 # Exit if empty filename
    761.     test_resource(@root_pan, filename)        # Perform resource test
    762.     #
    763.   end
    764.   #--------------------------------------------------------------------------
    765.   # * Test Pictures Graphic resource and remove from list
    766.   #     filename     : name of the resource to test
    767.   #--------------------------------------------------------------------------
    768.   def self.test_pictures(filename)
    769.     #
    770.     return if filename.nil?                   # Exit if no file
    771.     return if filename. == ''                 # Exit if empty filename
    772.     test_resource(@root_pics, filename)       # Perform resource test
    773.     #
    774.   end
    775.   #--------------------------------------------------------------------------
    776.   # * Test Pictures Graphic resource and remove from list
    777.   #     filename     : name of the resource to test
    778.   #--------------------------------------------------------------------------
    779.   def self.test_tiles(filename)
    780.     #
    781.     return if filename.nil?                   # Exit if no file
    782.     return if filename. == ''                 # Exit if empty filename
    783.     test_resource(@root_tiles, filename)      # Perform resource test
    784.     #
    785.   end
    786.   #--------------------------------------------------------------------------
    787.   # * Test Title Graphic resource and remove from list
    788.   #     filename     : name of the resource to test
    789.   #--------------------------------------------------------------------------
    790.   def self.test_title(filename)
    791.     #
    792.     return if filename.nil?                   # Exit if no file
    793.     return if filename. == ''                 # Exit if empty filename
    794.     test_resource(@root_title, filename)      # Perform resource test
    795.     #
    796.   end
    797.   #--------------------------------------------------------------------------
    798.   # * Test Transition Graphic resource and remove from list
    799.   #     filename     : name of the resource to test
    800.   #--------------------------------------------------------------------------
    801.   def self.test_trans(filename)
    802.     #
    803.     return if filename.nil?                   # Exit if no file
    804.     return if filename. == ''                 # Exit if empty filename
    805.     test_resource(@root_trans, filename)      # Perform resource test
    806.     #
    807.   end
    808.   #--------------------------------------------------------------------------
    809.   # * Test Windowskin Graphic resource and remove from list
    810.   #     filename     : name of the resource to test
    811.   #--------------------------------------------------------------------------
    812.   def self.test_windowskin(filename)
    813.     #
    814.     return if filename.nil?                   # Exit if no file
    815.     return if filename. == ''                 # Exit if empty filename
    816.     test_resource(@root_w_skin, filename)     # Perform resource test
    817.     #
    818.   end
    819.   #--------------------------------------------------------------------------
    820.   # * Tests : Resource Test
    821.   #--------------------------------------------------------------------------
    822.   #--------------------------------------------------------------------------
    823.   # * Test resource and remove from list
    824.   #     pathway_list : pathway specific resource array
    825.   #     filename     : name of the resource to test
    826.   #--------------------------------------------------------------------------
    827.   def self.test_resource(pathway_list, filename)
    828.     #
    829.     temp_list = pathway_list                  # Create copy of pathway list
    830.     new_list  = []                            # Create a new list array
    831.     for item in temp_list                     # Cycle through entire list
    832.       item = test_resource_strip(item)        # Strip file extenions for test
    833.       new_list.push(item)                     # Push the stripped file
    834.     end
    835.     #
    836.     unless new_list.include?(filename)        # If file isn't in the new list
    837.       return pathway_list                     # Exit method with pathway list
    838.     end
    839.     #
    840.     idx = new_list.index(filename)            # Get index position
    841.     pathway_list.delete_at(idx)               # Delete at index position
    842.     return pathway_list                       # Exit with updated pathway list
    843.     #
    844.   end
    845.   #--------------------------------------------------------------------------
    846.   # * Strip extension from filename for testing purposes
    847.   #     filename     : name of the resource to test
    848.   #--------------------------------------------------------------------------
    849.   def self.test_resource_strip(filename)
    850.     #
    851.     return filename if filename.nil?          # Exit if not valid
    852.     return filename if filename == ""         # Exit if empty name
    853.     #
    854.     idx = filename.rindex('.')                # Find extension
    855.     return filename if idx.nil?               # Exit if no extension
    856.     #
    857.     filename = filename.slice(0,idx)          # Strip extension
    858.     return filename                           # Exit with updated filename
    859.     #
    860.   end
    861.   #--------------------------------------------------------------------------
    862.   # * Output text to a file
    863.   #     file_id      : ID of file which to write
    864.   #     text         : text to output
    865.   #     center_just  : if text is center justified (in 80 column output)
    866.   #--------------------------------------------------------------------------
    867.   def self.output_header(file_id, text, center_just=false)
    868.     #
    869.     header      = text
    870.     len         = header.length
    871.     margin      = (80-len)/2
    872.     margin      = 0 unless center_just
    873.     output_txt  = (" " * margin) + header
    874.     #
    875.     output_text(file_id, output_txt)
    876.     #
    877.     header      = "=" * len
    878.     margin      = 0 unless center_just
    879.     output_txt  = (" " * margin) + header
    880.     #
    881.     output_text(file_id, output_txt)
    882.     #
    883.   end
    884.   #--------------------------------------------------------------------------
    885.   # * Determine if text present to output
    886.   #--------------------------------------------------------------------------
    887.   def self.output_test
    888.     #
    889.     effective  = false
    890.     #
    891.     effective   = true if @root_anims  != []
    892.     effective   = true if @root_auto   != []
    893.     effective   = true if @root_backs  != []
    894.     effective   = true if @root_batt   != []
    895.     effective   = true if @root_chars  != []
    896.     effective   = true if @root_fogs   != []
    897.     effective   = true if @root_g_over != []
    898.     effective   = true if @root_icons  != []
    899.     effective   = true if @root_pan    != []
    900.     effective   = true if @root_pics   != []
    901.     effective   = true if @root_tiles  != []
    902.     effective   = true if @root_title  != []
    903.     effective   = true if @root_trans  != []
    904.     effective   = true if @root_w_skin != []
    905.     effective   = true if @root_bgm    != []
    906.     effective   = true if @root_bgs    != []
    907.     effective   = true if @root_me     != []
    908.     effective   = true if @root_se     != []
    909.     effective   = true if @invalid     != []
    910.     #
    911.     return effective
    912.     #
    913.   end
    914.   #--------------------------------------------------------------------------
    915.   # * Output main body report to the file
    916.   #     file_id      : ID of file which to write
    917.   #--------------------------------------------------------------------------
    918.   def self.output_body(file_id)
    919.     #
    920.     # Generate Audio Header
    921.     output_text(file_id, "")
    922.     output_header(file_id, Resource_Sifter::WORDS_AUDIO)
    923.     output_text(file_id, "")
    924.     #
    925.     output_to_file(file_id, @root_bgm,   Resource_Sifter::WORDS_BGM)
    926.     output_to_file(file_id, @root_bgs,   Resource_Sifter::WORDS_BGS)
    927.     output_to_file(file_id, @root_me,    Resource_Sifter::WORDS_ME)
    928.     output_to_file(file_id, @root_se,    Resource_Sifter::WORDS_SE)
    929.     #
    930.     # Generate Graphic Header
    931.     output_text(file_id, "")
    932.     output_header(file_id, Resource_Sifter::WORDS_GRAPHICS)
    933.     output_text(file_id, "")
    934.     #
    935.     output_to_file(file_id, @root_anims,  Resource_Sifter::WORDS_ANIMATIONS)
    936.     output_to_file(file_id, @root_auto,   Resource_Sifter::WORDS_AUTOTILES)
    937.     output_to_file(file_id, @root_backs,  Resource_Sifter::WORDS_BATTLEBACKS)
    938.     output_to_file(file_id, @root_batt,   Resource_Sifter::WORDS_BATTLERS)
    939.     output_to_file(file_id, @root_chars,  Resource_Sifter::WORDS_CHARACTERS)
    940.     output_to_file(file_id, @root_fogs,   Resource_Sifter::WORDS_FOGS)
    941.     output_to_file(file_id, @root_g_over, Resource_Sifter::WORDS_GAMEOVERS)
    942.     output_to_file(file_id, @root_icons,  Resource_Sifter::WORDS_ICONS)
    943.     output_to_file(file_id, @root_pan,    Resource_Sifter::WORDS_PANORAMAS)
    944.     output_to_file(file_id, @root_pics,   Resource_Sifter::WORDS_PICTURES)
    945.     output_to_file(file_id, @root_tiles,  Resource_Sifter::WORDS_TILESETS)
    946.     output_to_file(file_id, @root_title,  Resource_Sifter::WORDS_TITLES)
    947.     output_to_file(file_id, @root_trans,  Resource_Sifter::WORDS_TRANSITIONS)
    948.     output_to_file(file_id, @root_w_skin, Resource_Sifter::WORDS_WINDOWSKINS)
    949.     #
    950.     output_text(file_id, "")
    951.     output_text(file_id, "")
    952.     output_to_file(file_id, @invalid,     Resource_Sifter::WORDS_INVALID)
    953.     #
    954.   end
    955.   #--------------------------------------------------------------------------
    956.   # * Output specific line of text to a file
    957.   #     file_id      : ID of file which to write
    958.   #     text         : text to output
    959.   #--------------------------------------------------------------------------
    960.   def self.output_text(file_id, text)
    961.     #
    962.     file_id.puts text                         # Print text to file
    963.     #
    964.   end
    965.   #--------------------------------------------------------------------------
    966.   # * Output generated content to a file
    967.   #     file_id      : ID of file which to write
    968.   #     pathway_list : pathway specific resource array
    969.   #     text         : text to output
    970.   #--------------------------------------------------------------------------
    971.   def self.output_to_file(file_id, pathway_list, text="")
    972.     #
    973.     return if pathway_list.nil?               # Exit if no list
    974.     return if pathway_list == []              # Exit if empty list
    975.     #
    976.     file_id.puts text                         # Print text to file
    977.     #
    978.     text = "-" * 80                           # Create horizontal dash line
    979.     file_id.puts text                         # Print text to file
    980.     #
    981.     for resource_name in pathway_list         # Cycle through all resources
    982.       file_id.puts resource_name              # Print resource name to file
    983.     end
    984.     file_id.puts " "                          # Print Spacer
    985.     #
    986.   end
    987. end
    988. #----------------------------------------------------------------------------
    989. # * Execution Command
    990. #----------------------------------------------------------------------------
    991.   Resource_Sifter.main
    复制代码




    Instructions

    Place below Scene_Debug and above Main.  If necessary,  the configuration section is available to alter titles and headings if language differences exit. After that, just execute/run your project.



    Compatibility

    Designed for RPGMaker XP and its default system/database layout.  Custom scripts and systems other than RPGMaker XP are not taken into account.



    Terms and Conditions

    This is a free-for-use design tool. However, due credit for its use would be appreciated.

    If ported to any other system by a scripter other than myself, I only ask for credit of the original concept,  and a link be provides to this topic of origin:  https://www.save-point.org/thread-8991.html



    NOTE:
    If any do create ports of this script, I would indeed provide links to those ports right here.


    本贴来自国际rpgmaker官方论坛作者:DerVVulfman处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/resource-sifter.170937/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-4 12:52 , Processed in 0.109180 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表