View Full Version : [Python] Jeckel's Modding Utilities


Jeckel
May 26, 2007, 05:50 AM
Various utilities I wrote to help out Python Modders, enjoy. :)

JCvConfigParser Utility (http://forums.civfanatics.com/downloads.php?do=file&id=5590)
A INI file parser and manager.
Allows easy access to options in a mod's config.ini file.
A very handy and well written utility to begin with. I rewrote it to use the python class structure so that instead of calling functions from the module, you now instance the CvConfigParser class and then call methods from the class instance.
On top of standard methods, get, getint, getfloat, and getboolean, I added 3 new methods, getlist, gettuple, and getdict. The 3 new methods smartly handle simple some input from the INI file. None, True, False, integars, and floating numbers will all be handled smartly, though imbedded lists, tuples, and dictionaries are not allowed and all dictionary keys are handled as strings.
This utility uses and requires JCvPath Utility.

JCvPath Utility (http://forums.civfanatics.com/downloads.php?do=file&id=5589)
A Civ4 Path manager.
Allows easy retrieval of Civ path strings.
Provides a class you can instance to get a CvPath object. You can then call various methods which take no arguments and return a valid path string or None. There are methods for the vanilla Civ and Warlords directories, for both the install and My Games.
Inaddition there are methods to retrieve the current Mod directory. This functionality relies on an outside finle called CvModName.py wich has a single attribute called modName that is set to a string equal to the Mod's root folder name. Without this file the Mod path retrievial methods will return like there is no mod.

JCvAlertManager Utility (http://forums.civfanatics.com/downloads.php?do=file&id=5591)
A Civ4 messaging manager.
Allows an easy way to send messages and popups to players.
Includes several methods to send messages to a player's screen in a controlable color.
Also included are methods to send simple popups to one player, a list of players, or all players.

Jeckel
May 26, 2007, 08:15 AM
Right from the very start there were some great python scripts that came out for Civ4. Now that things are moving along, I've found that alot of the old stuff that never got added to the DB is being forgotten. So in an effort to stop this I'm rewriting, updating, and improving some of the old, outdated, lost, and/or forgotten mods I find in threads here, on the web, and in the large mass of unorganized Civ4 files that is half my harddrive.

As my first offering I rewrote and improved two utilitiy files, CvPath and CvConfigParser. They were origionally writen by Dr. Elmer Jiggle as part of his Civilization 4 Alerts Mod and then later released with his standalone CustomEventManager utility. I found his CvConfigParser very useful and have included it in almost all my mods, but there were a few things that could use tweaking and now their tweaked. :D

Jeckel
May 26, 2007, 10:43 AM
Added JCvAlertManager to the list. :cool:

Zebra 9
Jun 19, 2007, 11:31 AM
Does the JCvConfigParser Utility work from the My Docs Civ Dir?

Jeckel
Jun 19, 2007, 11:39 PM
Hmm, off hand I would say no the currently uploaded version doesn't check the my docs directory, there was some issue I can't remember right now, but I am uploading new versions this weekend that solved the issue and does check my docs. :)