Tools to make modding easier

Cope

Chieftain
Joined
Sep 30, 2010
Messages
35
So I'm new here, but I thought I'd share a couple programs that have already made modding easier for me.

Windows Grep
The first is Windows Grep, which is free to use. It mimics the grep command on Linux, which lets you search for a specific string inside any number of files or folders. Very useful for finding TXT_KEY's or anything else really, just point it at the Assets folder, put in your search string and *.lua, *.xml as the file types and off you go.

PE Explorer
The second is maybe a bit more esoteric, but it's helped me out with .lua scripting. One thing I can't find anywhere is a list of what functions are available, like City:GetFoodTurnsLeft() for example. So for this I use PE Explorer, which comes with a 30 day trial but I'll leave it up to your imagination to find a version without that. This one probably needs a short tutorial, so here goes:

Most of the available functions are in "CvGameCoreDLLFinal Release.dll" in the root Civ V directory. Open this in PE Explorer then go to View > Exports. Here is a list of *most* of the available functions, but not all of them. It's a bit hard to read, but clicking on any function will give you a slightly better description of it in the box below the function list. See the screenshot attached.

For example in the screenshot I've selected ?getBuiltTime@CvPlot...., which translates to:
Code:
public: int __thiscall CvPlot::getBuildTime(enum BuildTypes)const
Which tells me this function can be called from a Plot object, expects a BuildType to be passed with it, and returns an integer (a whole number). So in a .lua file, I could do:
Code:
local testPlot = Map.GetPlot(m_iCurrentX, m_iCurrentY);
local buildTime = testPlot.GetBuildTime(BuildType.BUILD_FARM);
Which should return the number of turns it will take to build a farm on that particular plot. Finding the BuildType is another instance where Windows Grep is handy, just search for BuildType and it'll find the .xml with a list of all valid build types (in this case CIV5Builds.xml). Note that in .lua the first letter is capitalized too, GetBuildTime.

As I said before some functions don't show up in the export list, there's a way to find these too but it's a little more complicated. I think I'll leave that for another post if people are interested.

Notepad++
Lastly, I'm sure everyone who's modded Civ before will know this one. Notepad++ great for looking through .lua or .xml files to find something you want, before you import it into your mod via ModBuddy.
 

Attachments

  • SS001.png
    SS001.png
    69.2 KB · Views: 374
  • SS003.png
    SS003.png
    43.2 KB · Views: 442
I have a couple of ruby scripts that take the output of PE Explorer and formats it by class and member. I'll take a little time this weekend and put together a quick API listing to post on the wiki.

I'll be SO waiting for that :D And eternally grateful.
 
Thanks for the advice. I'd never seen Grep before. To this date I had been using the Find in Files function of Notepad++.
 
you can find in files with notepad++ as well, and then even edit with it too so kinda makes grep useless unless its find in files function works better somehow.
 
Yeah, I was going to say that EditPad Lite can find and replace multiple lines from numerous files. I've tested it with EU3 modding and it managed to sift through over 1000 files at once.
 
WindowsGrep is an extraordinarily good program.

But let's start a flamewar:
I use gvim for editing.
 
Another comment on EditPad, since I just used it again recently.

Its search and replace functionality seems better than np++'s, because you can use return characters in the search field. (Unless np++ can do that and I haven't seen how?)
 
You can use return characters in np++, so long as you switch to extended mode.
 
You can use return characters in np++, so long as you switch to extended mode.

Using the '\n' right? I can see it working, but if one copy-pastes, one would have to put in the newline characters manually, and pasting into the field chops off everything but the last line from the clipboard item I think. It really doesn't work very well compared to EditPad's method.

Thanks for the tip though. :)
 
Top Bottom