#=============================================================================== # Integrity Checker # By Jet10985 (Jet) # Tested by: Kalez238 #=============================================================================== # This script will check commonly used event commands to ensure that the # integrity of the used parameters are good. Basically it makes sure they are # possible. # This script has: 1 customization option. #=============================================================================== # Overwritten Methods: # None #------------------------------------------------------------------------------- # Aliased methods: # Scene_Title: start, post_start, terminate, post_terminate, update #=============================================================================== =begin Checked event commands: Show Picture Add Actor Change Item, Weapon, Armor Transfer Player Play BGM, BGS, SE, ME Change Battle BGM, Battle End ME The script will generate a text file in the game's folder with all the details on failed event commands. =end module JetIntegChecker # Set to false to run the game normally. RUN_INTEG_CHECKER = true end #=============================================================================== # DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO. #=============================================================================== class Integrity_Checker < Scene_Base attr_accessor :maps def start super @file = File.new("IntegrityLog.txt", "w+") create_map_event_hash check_picture_integ check_transfer_integ check_music_integ check_item_integ check_actor_integ @file.close p "Integrity Check Finished." exit end def create_map_event_hash @maps = {} temp = Dir.entries("Data") temp[0] = nil temp[1] = nil for item in temp next if item.nil? temp[temp.index(item)] = nil if item[/MAP(\d)/i].nil? end temp[temp.size-1] = nil temp.compact! i = 1 for item in temp f = load_data("Data/#{item}") e = f.events @maps[i] = e i += 1 end end def check_picture_integ @file.puts "------[PICTURE INTEGRITY]------" for event in load_data("Data/CommonEvents.rvdata").compact! for command in event.list if command.code == 231 begin Cache.picture(command.parameters[1]) rescue @file.puts "Common Event #{event.id}: Picture '#{command.parameters[1]}' does not exist." end end end end for map in @maps.keys for event in @maps[map].values for page in event.pages for command in page.list if command.code == 231 begin Cache.picture(command.parameters[1]) rescue @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) Picture '#{command.parameters[1]}' does not exist." end end end end end end end def check_transfer_integ @file.puts "\r\n------[TRANSFER INTEGRITY]------" for event in load_data("Data/CommonEvents.rvdata").compact! for command in event.list if command.code == 201 begin load_data(sprintf("Data/Map%03d.rvdata", command.parameters[1])) rescue @file.puts "Common Event #{event.id}: Transfer to map ID: #{command.parameters[1]} failed." end end end end for map in @maps.keys for event in @maps[map].values for page in event.pages for command in page.list if command.code == 201 begin load_data(sprintf("Data/Map%03d.rvdata", command.parameters[1])) rescue @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) Transfer to map ID: #{command.parameters[1]} failed." end end end end end end end def check_music_integ @file.puts "\r\n------[MUSIC INTEGRITY]------" for event in load_data("Data/CommonEvents.rvdata").compact! for command in event.list case command.code when 132 begin RPG::BGM.new(command.parameters[0].name, 0, 0).play rescue @file.puts "Common Event #{event.id}: BGM '#{command.parameters[0].name}' does not exist." end when 133 begin RPG::ME.new(command.parameters[0].name, 0, 0).play rescue @file.puts "Common Event #{event.id}: ME '#{command.parameters[0].name}' does not exist." end when 241 begin RPG::BGM.new(command.parameters[0].name, 0, 0).play rescue @file.puts "Common Event #{event.id}: BGM '#{command.parameters[0].name}' does not exist." end when 245 begin RPG::BGS.new(command.parameters[0].name, 0, 0).play rescue @file.puts "Common Event #{event.id}: BGS '#{command.parameters[0].name}' does not exist." end when 249 begin RPG::ME.new(command.parameters[0].name, 0, 0).play rescue @file.puts "Common Event #{event.id}: ME '#{command.parameters[0].name}' does not exist." end when 250 begin RPG::SE.new(command.parameters[0].name, 0, 0).play rescue @file.puts "Common Event #{event.id}: SE '#{command.parameters[0].name}' does not exist." end end end end for map in @maps.keys for event in @maps[map].values for page in event.pages for command in page.list case command.code when 132 begin RPG::BGM.new(command.parameters[0].name, 0, 0).play rescue @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) BGM '#{command.parameters[0].name}' does not exist." end when 133 begin RPG::ME.new(command.parameters[0].name, 0, 0).play rescue @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) ME '#{command.parameters[0].name}' does not exist." end when 241 begin RPG::BGM.new(command.parameters[0].name, 0, 0).play rescue @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) BGM '#{command.parameters[0].name}' does not exist." end when 245 begin RPG::BGS.new(command.parameters[0].name, 0, 0).play rescue @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) BGS '#{command.parameters[0].name}' does not exist." end when 249 begin RPG::ME.new(command.parameters[0].name, 0, 0).play rescue @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) ME '#{command.parameters[0].name}' does not exist." end when 250 begin RPG::SE.new(command.parameters[0].name, 0, 0).play rescue @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) SE '#{command.parameters[0].name}' does not exist." end end end end end end end def check_actor_integ @file.puts "\r\n------[ACTOR INTEGRITY]------" for event in load_data("Data/CommonEvents.rvdata").compact! for command in event.list case command.code when 129 if load_data("Data/Actors.rvdata")[command.parameters[0]].nil? @file.puts "Common Event #{event.id}: Actor ID #{command.parameters[0]} does not exist." end end end end for map in @maps.keys for event in @maps[map].values for page in event.pages for command in page.list case command.code when 129 if load_data("Data/Actors.rvdata")[command.parameters[0]].nil? @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) Actor ID #{command.parameters[0]} does not exist." end end end end end end end def check_item_integ @file.puts "\r\n------[ITEM INTEGRITY]------" for event in load_data("Data/CommonEvents.rvdata").compact! for command in event.list case command.code when 126 if load_data("Data/Items.rvdata")[command.parameters[0]].nil? @file.puts "Common Event #{event.id}: Item ID #{command.parameters[0]} does not exist." end when 127 if load_data("Data/Weapons.rvdata")[command.parameters[0]].nil? @file.puts "Common Event #{event.id}: Weapon ID #{command.parameters[0]} does not exist." end when 128 if load_data("Data/Armors.rvdata")[command.parameters[0]].nil? @file.puts "Common Event #{event.id}: Armor ID #{command.parameters[0]} does not exist." end end end end for map in @maps.keys for event in @maps[map].values for page in event.pages for command in page.list case command.code when 126 if load_data("Data/Items.rvdata")[command.parameters[0]].nil? @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) Item ID #{command.parameters[0]} does not exist." end when 127 if load_data("Data/Weapons.rvdata")[command.parameters[0]].nil? @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) Weapon ID #{command.parameters[0]} does not exist." end when 128 if load_data("Data/Armors.rvdata")[command.parameters[0]].nil? @file.puts "MAP ID #{map}: #{event.name} (ID: #{event.id.to_s}) Armor ID #{command.parameters[0]} does not exist." end end end end end end end end class Scene_Title alias jet5921_update update unless $@ def update jet5921_update unless JetIntegChecker::RUN_INTEG_CHECKER end alias jet5921_terminate terminate unless $@ def terminate jet5921_terminate unless JetIntegChecker::RUN_INTEG_CHECKER end alias jet5822_start start unless $@ def start if JetIntegChecker::RUN_INTEG_CHECKER $scene = Integrity_Checker.new else jet5822_start end end alias jet5821_post_start post_start unless $@ def post_start jet5821_post_start unless JetIntegChecker::RUN_INTEG_CHECKER end alias jet5821_pre_terminate pre_terminate unless $@ def pre_terminate jet5821_pre_terminate unless JetIntegChecker::RUN_INTEG_CHECKER end end