This topic is now archived and is closed to further replies.


[2016-01-13] ConstDB converted to libconfig format, added doc/

Recommended Posts

This is an (unplanned) episode in the txt->libconfig conversion project. The reason for the conversion is that we suddenly needed a way to add attributes (specifically, "deprecated" to some constants, since simply removing them would mean that any scripts using them would silently fail (talk about terrible script engine).

The Constants Database (db/const.txt) has been converted to the usual libconfig format. This allows us to add new attributes to the constants.
Old, unused, constants have been marked as deprecated using the facilities provided by the new database format (mostly, Job_Alchem, VAR_*), and their use will now trigger a warning at parse time (previously, it would result in a value of zero being used silently, in a very nasty way).
A new docuemntation file (doc/ is provided, listing all the constants available to the scripting engine (coming from Constants DB, Item DB, Mob DB, Skill DB or even hardcoded in source), since there wasn't any centralized place where all the constants were listed. The file will get automatically updated in future through the HerculesWSAPI bot.
The document is readily available online through the following link: (it will always point to the latest version)

The impact of this changeset on customizations is low. If using custom constants in const.txt, users can either use the provided script to re-generate their constants.conf, or add the entries manually.

The format of constants.conf is the following:
constants_db: {
/************* Entry structure (short) ************************************
	Identifier: value            // (int)
 ************* Entry structure (full) *************************************
	Identifier: {
		Value: value         // (int)
		Parameter: true      // (boolean)      Defaults to false.
		Deprecated: true     // (boolean)      Defaults to false.

(each entry can use either the short or full format).

A special "comment__" field can be added, to generate a corresponding title in the documentation file. Comments will have no other effects (they're not normally parsed, but they're available to plugins).

Merge Date:
Wed, 13 Jan 2016 19:22:45 +0300

Related Pull Requests:
- #1088 - - Constdb revamp [Haru]
- #908 - - Add EQP_ = Equipment Position constants [AnnieRuru]
- #1124 - - Constdb2doc plugin (doc/ [Haru]

Related Commits:
- a815472 - - Sun, 10 Jan 2016 02:01:55 +0100 Converted const.txt to libconfig format [Haru]
- 6ae9045 - - Sun, 10 Jan 2016 02:33:15 +0100 Added support to mark constants in db/constants.conf as deprecated [Haru]
- 3f56ffc - - Sun, 10 Jan 2016 02:33:41 +0100 Marked Job_Alchem and Job_Baby_Alchem as deprecated [Haru]
- 99f707e - - Wed, 13 Jan 2016 11:47:47 +0100 Added converter script from const.txt to constants.conf [Haru]
- 49081f4 - - Wed, 13 Jan 2016 19:22:45 +0300 Merge pull request #1088 from HerculesWS/constdb [Andrei Karas]
- 9e48e2a - - Wed, 13 Jan 2016 17:23:31 +0100 HPM Hooks Update [] (dastgir/master)
- de33b02 - - Fri, 15 Jan 2016 20:34:26 +0100 Fixed a typo in the constdb converter script [Haru]
- a1310e2 - - Wed, 6 Jan 2016 16:38:43 +0800 Remove VAR_ constants - there are 2 same constants for setlook script command, remove the wrong one - VAR_ constant added by l
one_wolf is invalid, so use the LOOK_ constant [AnnieRuru]
- 7610346 - - Sat, 16 Jan 2016 20:23:57 +0100 Merge pull request #908 from AnnieRuru/request_26 [Haru]
- e3253b4 - - Mon, 25 Jan 2016 16:52:27 +0100 Added source support for special comments in the constdb [Haru]
- 72a75cb - - Mon, 25 Jan 2016 15:53:56 +0100 Added constdb2doc plugin [Haru]
- 15bca8f - - Mon, 25 Jan 2016 16:00:44 +0100 Generated doc/ [Haru] (HEAD -> constdb2doc, origin/constdb2doc)

The constdb2doc plugin introduced in 72a75cb is based on my 'vimsyntaxgen' plugin (see

View the full article

Share this post

Link to post
Share on other sites