1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Finding data

Discussion in 'Civ5 - Modding Tutorials & Reference' started by Thalassicus, Sep 10, 2012.

  1. Thalassicus

    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.


     

    Attached Files:

  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,341
    Location:
    Near Portsmouth, UK
    Agent Ransack is another option

     

    Attached Files:

  3. DonQuiche

    DonQuiche Chieftain

    Joined:
    May 23, 2011
    Messages:
    1,122
    @Thalassicus
    This post is a very good idea. Can I suggest you to include pictures of the search results though?
     
  4. ww2commander

    ww2commander Chieftain

    Joined:
    Aug 23, 2003
    Messages:
    1,243
    Location:
    Australia
    Windows Grep is another product that does a slightly more powerful search similar to ModBuddy

     
  5. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,803
    Location:
    Poland
    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...
     
  6. Thalassicus

    Thalassicus Bytes and Nibblers

    Joined:
    Nov 9, 2005
    Messages:
    11,057
    Location:
    Texas
    @DonQuiche
    Done :)
     
  7. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,642
    Location:
    France
    still looking for one that can show, as example, the line 347 of all lua files from a folder...
     
  8. Pazyryk

    Pazyryk Chieftain

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    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.)
     
  9. DonQuiche

    DonQuiche Chieftain

    Joined:
    May 23, 2011
    Messages:
    1,122
    Thank you very much. :goodjob:
     
  10. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,341
    Location:
    Near Portsmouth, UK
    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 ;-)
     
  11. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    8,642
    Location:
    France
    wow, nice tip, thanks ! :)
     
  12. Pazyryk

    Pazyryk Chieftain

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    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?
     
  13. DonQuiche

    DonQuiche Chieftain

    Joined:
    May 23, 2011
    Messages:
    1,122
    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++".
     
  14. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,341
    Location:
    Near Portsmouth, UK
    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 ;-)
     
  15. Thalassicus

    Thalassicus Bytes and Nibblers

    Joined:
    Nov 9, 2005
    Messages:
    11,057
    Location:
    Texas
    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.
     
  16. ExpiredReign

    ExpiredReign Chieftain

    Joined:
    Jan 3, 2013
    Messages:
    2,450
    Gender:
    Male
    Location:
    Tasmania
    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.
     

Share This Page