Finding data

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
There are several effective ways to find data in the Civ 5 files. It is often faster to use these search methods instead of hunting through the Civ V file structure. These search methods are also faster and more powerful than Windows Search. The examples below search the game files for leader <traits>.

ModBuddy
Press Ctrl+Shift+F to bring up the find in files tool. You can specify types of files to search, and save preferred search locations.





Notepad++
If you are using Notepad++ for its better lua editor (from notepad-plus-plus.org), it has a very similar find-in-files tool. Press Ctrl+Shift+F to bring it up.


 

Attachments

  • FindInFiles-ModBuddy.JPG
    FindInFiles-ModBuddy.JPG
    122.7 KB · Views: 1,288
  • FindInFiles-Notepad++.JPG
    FindInFiles-Notepad++.JPG
    71.6 KB · Views: 1,298
  • FindInFiles-ModBuddy Results.PNG
    FindInFiles-ModBuddy Results.PNG
    10.3 KB · Views: 1,181
  • FindInFiles-Notepad++ Results.PNG
    FindInFiles-Notepad++ Results.PNG
    14 KB · Views: 1,194
Agent Ransack is another option

 

Attachments

  • CivVAgentRansack.jpg
    CivVAgentRansack.jpg
    283.7 KB · Views: 1,182
Windows Grep is another product that does a slightly more powerful search similar to ModBuddy

 
Is there a way to view the content of the game's Virtual File System? I ask because there seems to be files there that don't appear after extracting all the .fpk files...
 
still looking for one that can show, as example, the line 347 of all lua files from a folder...
 
Gee, I wonder why you would want to do that... :rolleyes:

(I keep thinking about moving my MODS directory to C:/MODS to get around this issue. Not sure how much headache is involved with that.)
 
still looking for one that can show, as example, the line 347 of all lua files from a folder...

If you're using Notepad++, open any file, goto the line of interest + 1 (for reasons unknown!) - so line 348 - press F5 (to open the Run dialog) and enter this

Code:
cmd /q /s /c "for /r "$(CURRENT_DIRECTORY)" %X in (*.lua) do ("$(NPP_DIRECTORY)\notepad++.exe" -n$(CURRENT_LINE) "%X")"

Then save it for the next time ;-)
 
wow, nice tip, thanks ! :)
 
Off topic a bit, but for those of you using Notepad++ as an editor, can you describe your general workflow for this? Do you edit files directly in the Modbuddy solution? (Is this safe?) Or do you do edit files elsewhere and then drop into Modbuddy? (Isn't this a pain?) Or are you adding files to the mod outside of Modbuddy?
 
I use ModBuddy for my mod's files and I use notepad++ for the games files. So I just have one windows explorer opened on the civ5 folder. I right-click files and then hit "edit in notepad++".
 
If ModBuddy is not open (or open with a different mod active) it's safe to edit the files in "C:\Users\{username}\Documents\Firaxis ModBuddy\{modname}" directly (including the .civ5sln and .civ5proj files)

If ModBuddy is open with the mod active don't edit the .civ2sln and .civ5proj files!

If ModBuddy is open with the mod active but the file not open, it's safe to edit the file as ModBuddy will read the file from disk as necessary

If ModBuddy is open with the mod active and the file open, it is still safe to edit the file directly as ModBuddy will detect the file has changed and prompt you if you want to reload it.

Your external editor may also detect that the file you have open has been changed by ModBuddy - but basically you shouldn't be editing a file in two places at the same time ;-)
 
I set the ModBuddy default editor for lua files to notepad++, so I can just double-click the files to load them up. I then save my edits in notepad++, and compile the project in ModBuddy. I also have the Explorer plugin for notepad++ so I can view my project folders.
 
I have just recently come across Sublime Text after using Notepad++ for many years.

When it comes to finding data in various sources I believe there is nothing faster or easier than Sublime Text.
It is also extensible and a plugin (Find++) further aids the process.

I have setup some 'projects' that look at the Core XML files, the C++ files in the SDK and the files in the mods I am editing.

With the Find++ plugin I can search for something, whether it is opened, in multiple folders or even on other drives, and it almost instantaneously is presented in a results page which then allows me to double click on the result and I am inside the specified file at the line highlighted.

Makes tracking down needed information for new units/buildings etc. very easy.

Another area where it excels, suppose you are looking for a specific TXT_KEY reference but you only want to see the English results, how would you limit your search considering there are currently 5 DLC folders that have that information.
In Sublime Text you simply edit your project settings to exclude certain folders like this:
*DE_DE* -- no German text from ANY directory within the project's scope will be displayed.

Add in all the other languages to the exclusion settings and everytime you look for something ONLY the English results show.
Not bad hey. Did I mention it is FAST!!

Even if you don't think it is needed just have a look at it.
Pretty damn good.
 
Top Bottom