This page is broken into two sections. The first section will describe the
DEFINE
tag and its uses. The second section will discuss variables and their use in PCGen.
The DEFINE tag is used to create new user-defined variables and set their initial values.
Tag Name: DEFINE:x|y
Variables Used (x): Text (Name of variable)
Variables Used (y): Number or Formula (Can be a formula involving system or user-defined variables or numbers.)
What it does:
PREVARxx
tags, which are prerequisites based upon variable values.DEFINE
tags that match this variable name.BONUS:VAR
tags and after figuring out which ones stack, adds those to the highest define value.PREVARxx
requirement and PCGen then indicates if the character meets this requirement or not.BONUS:VAR
tags which reference variables which have not been defined have no effect and the value of that variable will effectively remain at zero (0).DEFINE
in PCGen release files is to use only one DEFINE
per variable and to initially set the value to zero (0) and adjust it with BONUS:VAR
tags as needed.Example:
DEFINE:MonkeyChop|2
Creates a new variable named MonkeyChop and sets the initial value to 2.
DEFINE:MonkeySwing|0 <tab> BONUS:VAR|MonkeySwing|TL/2
Creates a new variable named MonkeySwing and sets the initial value to zero, then bonuses the variable to half the character's total level.
For those unfamiliar with computer programming or higher math a variable is a symbol which represents a
quantity that is not fixed. Most people's first introduction to variables is in algebra where you might be given a problem
such as "x+y=z". In this formula, the "x", "y" and "z" are variables. PCGen uses
variables and formulas for a wide variety of purposes throughout the program. Some variables are created in LST files,
and are henceforth called user-defined variables, while others are system-defined, that is they are hard-coded into PCGen's code-base.
While both types of variable can be used in any formula in any LST file, only system-defined variables can be used in any gameMode.
Only user-defined variables can be modified through the use of the BONUS:VAR
tag.
Here are a few notes on naming variables:
All variables listed below are global in nature, unless explicitly stated within the variable-specific documentation, and can be used in any formula, in any file, in any gamemode.
This is the total AC Check penalty from armor and shield.
This is the total AC Check penalty from armor.
This is the Base Attack Bonus. The progression for the BAB is set for each individual
class in the class.lst file. The BAB progression is set using the global
BONUS:COMBAT|BAB
tag, which will take a formula. As an example, BONUS:COMBAT|BAB|CL*2
would grant a BAB of +2 per class-level.
This is the unmodified Challenge Rating of the character's race.
This is the modifier for the class's base spell stat. This variable can only be used in a class.lst file.
This will return the Bonus Spellcaster Levels to the class specified, which usually come from Prestige classes.
For example, let's say you have 2 levels Mystic Theurge which add to both your Cleric and
Wizard levels, 3 levels of Archmage which add to your Wizard level, and 1
level of Loremaster which adds to your Cleric level. BL=Wizard
would return 5
and BL=Cleric
would return 3. Replace "{" with "(" and "}" with ")",
e.g. BL=Cleric {Special}
would return the bonus levels of "Cleric (Special)" since "("
and ")" have other meanings in DEFINE variables. If used within a JEP formula you will need to enclose it in a
variable function e.g. var("BL=Cleric {Special}")
.
This is a special variable and is valid only in Spell objects and therefore should only be used in Spell LST Files. See the CASTERLEVEL tag entry on the Spell tag page.
This is the character's CHA modifier.
This is the character's actual Charisma score.
This provides the class level for the class object in which it is being used. This variable is valid only in the Class object and should only be used in class.lst files.
Class Level of the named class. This can now be done with the classlevel() JEP function.
Returns a 1 if the character has the named class, otherwise 0. Replace { with ( and } with ). e.g. CLASS=Ranger {Special} would check for Ranger (Special) since ( and ) have other meanings in DEFINE variables. If used within a JEP formula you will need to enclose it in a variable function e.g. var("CLASS=Ranger {Special}")
Class Level of the named class, replacing ( with { and ) with }. e.g. CLASSLEVEL=Warrior {Ruby} would return the level of Warrior (Ruby) since ( and ) have other meanings in DEFINE variables. If used within a JEP formula you will need to enclose it in a variable function e.g. var("CLASSLEVEL=Warrior {Ruby}")
This is the character's CON modifier.
This is the character's actual Constitution score.
This is the character's number of classes.
This is the character's number of domains.
This is the number of feats of the given name. Great for multiple feats that grant bonuses based on the number of times taken.
This is the character's number of optionally chosen feats (not automatic or virtual).
This is the character's total number of feats (includes automatic and virtual).
This is the character's number of feats matching specified type.
This is the character's number of Followers.
This is the character's number of languages.
This is the character's number of unique special abilities.
This is the character's number of skills.
This is the character's number of spellcasting classes.
This is the number of defined stats.
This is the character's Challenge Rating.
This is the character's DEX modifier.
This is the character's actual Dexterity score.
This is the character's Effective Character Level. It is the sum of all class levels plus any level adjustment the character might have.
This is a value representing the character's current encumbrance level (0=Light, 1=Medium, 2=Heavy, 3=Over-Loaded).
HANDS
This is the number of hands the character has.
HASDEITY:
This returns 1 if the character has the named deity, otherwise 0.
This returns 1 if the character has the named feat, otherwise 0.
This is the character's HD (Starting HD or Monster HD. Not HD from classes).
This is the character's maximum total hit points.
This is the character's adjustment to initiative excluding any dexterity modifier.
This is the character's adjustment to initiative (including dexterity modifier and +4 if you have the Improved Initiative feat).
This is the character's INT modifier.
This is the character's actual Intelligence score.
LEGS
This is the number of legs the character has.
This is the character's racial-based movement.
RACIALHDSIZE
Returns the size of the hit dice type of the creatures racial hit dice (i.e. 6 for d6, 8 for d8, 10 for d10), if any. For creatures with no racial hit dice, RACIALHDSIZE returns 0.
This is the total AC Check penalty from shields.
This is a value representing the character's current size. Fine=0, Diminutive=1, Tiny=2, Small=3, Medium=4, Large=5, Huge=6, Gargantuan=7, Colossal=8. The size designations, including abbreviations, are dependant upon the gamemode used and may be redefined in the sizeadjustments.lst file.
This is the character's Ranks in the named skill replacing ( with { and ) with }. e.g. SKILLRANK=Craft {Woodworking} would return the ranks of Craft (Woodworking) since ( and ) have other meanings in DEFINE variables. If used within a JEP formula you will need to enclose it in a variable function e.g. var("SKILLRANK=Craft {Woodworking}")
Update:
This can now be done with the skillinfo() JEP function.
This is the character's total in the named skill replacing ( with { and ) with }. e.g. SKILLTOTAL=Craft {Woodworking} would return the total of Craft (Woodworking) since ( and ) have other meanings in DEFINE variables. If used within a JEP formula you will need to enclose it in a variable function e.g. var("SKILLTOTAL=Craft {Woodworking}")
Update:
This can now be done with the skillinfo() JEP function.
This is the character's spell failure percentage for all equipped armor.
This is the character's spell resistance.
This is the character's STR modifier.
This is the character's actual Strength score.
Total Level of character, this includes all PC, NPC and Monster class levels. It does not include any level adjustments the character may have
This returns 1 if the character has the named variable, otherwise 0.
is the weight of all carried equipment.
is the weight of all equipped items.
is the weight of the PC.
is the weight of all carried items and PC.
This is the character's WIS modifier.
This is the character's actual Wisdom score.
Note: This is not a definitive list, but a subset showing some of the common user defined variables that PCGen uses.
Ability to take Extra Turning if >= 1
Ability to use a Holy Avenger as a Paladin if >= 1
Ability to use Bardic Knowledge if >= 1
Ability to use Bardic Music if >= 1
Ability to Turn Undead if >= 1