Way to search the database?

This may sound silly, but I spend probably a majority of my time in RPG Maker just looking for that skill, common event, state, animation, troop, ect. in the database, scrolling up and down until I remember where I put it. I build large games, and when you've got a couple thousand skills to sift through, that takes up a lot of time.


Is there any way available to search the database in the editor? I don't know what the legal state of modding the editor itself is, but do any such external tools exist? (Perhaps one could be made by reading the database files? Has one been made already? What would it take to make a tool that would just list the name of entries with their ID's by searching?). I also really wish it always showed the ID number of things within every menu instead of only some of them...


Are ID's for database content somehow shown in the database files themselves? Browsing through them, I can't find any IDs.

Any help would be appreciated! I've had this problem for ages, but figured I ought to ask it in case I haven't been needing to waste my time looking for things for ages!
No, not within the editor, and mods to the editor break the EULA.  


Here is a little script you can add that will extract the names into a text file for you - just paste into a new slot in the appropriate location, run the game.  As soon as the title screen appears, you can close it again and disable the script.  The files will be in the project's main folder, and you can delete them when they're no longer required.

Code:
DataManager.load_normal_database

f = File.open("Items.txt", "w")
$data_items.each do |item|
  next if item.nil?
  f.puts(sprintf('%5d  %s', item.id, item.name))
end
f.close



You can repeat the lower block for each tab of the database that you're interested in - check DataManager.load_normal_database for the names of the variables that contain the lists (starts line 36 on an unmodified project).  $data_system will not be useful to you, and maybe $data_tilesets also.  


If you want switches and variables, you'll find them in $data_system.switches and $data_system.variables but the syntax will be a bit different because they are just array elements:

Code:
f = File.open("Switches.txt", "w")
$data_system.switches.each_index do |i|
  f.puts(sprintf('%5d  %s', i, $data_system.switches[i]))
end
f.close
Thank you, this is great! I thought modding the editor was against the EULA, and this was all I needed anyway! 


If anyone else is needing this solution or finds this on Google, here's the script I just threw together from Shaz's assistance. It'll snag the IDs for everything and put them into their own files (conveniently grouped together in the folder) and also make a compiled database file for easy searching across the entire database. Pretty useful aid for development of larger projects!

Spoiler
Code:
DataManager.load_normal_database
###########################
#####Compiled Database#####
##########################
f = File.open("Data - All.txt", "w")
f.puts(sprintf('###Items Database###'))
$data_items.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end

f.puts(sprintf('###Actor Database###'))
$data_actors.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end

f.puts(sprintf('###Class Database###'))
$data_classes.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end

f.puts(sprintf('###Skills Database###'))
$data_skills.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end

f.puts(sprintf('###Enemy Database###'))
$data_enemies.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
f.puts(sprintf('###Troop Database###'))
$data_troops.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
f.puts(sprintf('###States Database###'))
$data_states.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
f.puts(sprintf('###Animation Database###'))
$data_animations.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
f.puts(sprintf('###Common Event Database###'))
$data_common_events.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
f.puts(sprintf('###Switches Database###'))
$data_system.switches.each_index do |i|
  f.puts(sprintf('%5d  %s', i, $data_system.switches[i]))
end
f.puts(sprintf('###Variables Database###'))
$data_system.variables.each_index do |i|
  f.puts(sprintf('%5d  %s', i, $data_system.switches[i]))
end

f.close

#############################
####Individual Data Files####
#############################
#$data_items
f = File.open("Data - Items.txt", "w")
$data_items.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
f.close

#$data_actors 
f = File.open("Data - Actors.txt", "w")
$data_actors.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
f.close
#$data_classes   
   f = File.open("Data - Classes.txt", "w")
$data_classes.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
#$data_skills     
   f = File.open("Data - Skills.txt", "w")
$data_skills.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
#$data_weapons    
   f = File.open("Data - Weapons.txt", "w")
$data_weapons.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
#$data_armors    
   f = File.open("Data - Armors.txt", "w")
$data_armors.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
#$data_enemies   
   f = File.open("Data - Enemies.txt", "w")
$data_enemies.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
#$data_troops   
   f = File.open("Data - Troops.txt", "w")
$data_troops.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
#$data_states    
   f = File.open("Data - States.txt", "w")
$data_states.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
#$data_animations    
   f = File.open("Data - Animations.txt", "w")
$data_animations.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end
#$data_common_events 
 f = File.open("Data - Common Events.txt", "w")
$data_common_events.each do |skills|
  next if skills.nil?
  f.puts(sprintf('%5d  %s', skills.id, skills.name))
end

#$data_system.switches
f = File.open("Data - Switches.txt", "w")
$data_system.switches.each_index do |i|
  f.puts(sprintf('%5d  %s', i, $data_system.switches[i]))
end

#$data_system.variables
f = File.open("Data - Variables.txt", "w")
$data_system.variables.each_index do |i|
  f.puts(sprintf('%5d  %s', i, $data_system.switches[i]))
end
nice.  Except variables is wrong, in both sections.  It should reference $data_system.variables, not $data_system.switches 😉

Original thread: https://forums.rpgmakerweb.com/threads/way-to-search-the-database.63859/