Creature - Object Information

Sections in this file:

The Basics
Basic Stats
HP and Damage
Spells, Advanced

The current creatures' stats and functions are available in the Cr variable. To access a variable, you must precede the variable with "Cr.", for example, Cr.HP gives you the current hit point total.

Some variables are marked 'Read-Only', which means that they are recalculated often so that modifying them once will have no effect. Special code for feats is the exception - it should modify only 'Read-Only' variables.

Here follows the members of Cr you can access. There are also several useful function is Scripting - Creature Functions.

The Basics

Go back to top


Name As String
RaceName As String
LastFoundRaceID As Integer 'Starts at 0, upon 1st detection is set for the whole session
Desc_PlayerName As String 'Name of the player playing the PC


Function GetRace() As Race
'Returns the race object corresponding to this PC


Go back to top

Consists of data that is displayed in the Desc and Notes tabs, and on the character sheet, but which for the most part has no direct game effect in the program.


Desc As String 'Rich-text
Notes As String 'Plain-text
Languages As String 'Languages spoken
Alignment As String
Height As Long 'in inches
Weight As Long 'in pounds
Desc_HairColor As String
Desc_EyeColor As String
Desc_SkinColor As String
Desc_BackgroundStory As String
Desc_Deity As String
SpecialAttacks As String 'now displayed in the Class Abilities-Frame
SpecialQualities As String 'now displayed in the Class Abilities-Frame
Age As Long
Gender As String
CreatureType As String 'Such as Humanoid, etc.

PictureFileName As String 'Used for character sheet

WeaponProficiencies As String 'New v.176. Not used internally yet.


Sub AddToDesc(RTFText As String, AddHeader As Boolean)
'Adds the text to the description. Set 'AddHeader' to true.

Basic Stats

Go back to top


'Ability scores (current value, including temp. adjustments). Read-Only
Str As Integer 'Current Strength score
Dex As Integer 'Current Dexterity score
Con As Integer 'Current Constitution score
Intel As Integer 'Current Intelligence score
Wis As Integer 'Current Wisdom score
Cha As Integer 'Current Charisma score

'Ability scores base value
StrBase As Integer 'Base (unmodified) Strength score
DexBase As Integer 'Base (unmodified) Dexterity score
ConBase As Integer 'Base (unmodified) Constitution score
IntBase As Integer 'Base (unmodified) Intelligence score
WisBase As Integer 'Base (unmodified) Wisdom score
ChaBase As Integer 'Base (unmodified) Charisma score

'Modifiers for each ability score
StrMod As Integer 'Strength modifier
DexMod As Integer 'Dexterity modifier
ConMod As Integer 'Constitution modifier
IntMod As Integer 'Intelligence modifier
WisMod As Integer 'Wisdom modifier
ChaMod As Integer 'Charisma modifier

Size As Integer 'size as number (unused)
SizeStr As String 'Size as letter (S, M, L) 'v.2.20, changed!
SizeMod As Integer 'Size modifier to attacks, calculated from SizeStr

Speed As Integer 'Currnet walking speed (calculated)
SpeedBase As Integer 'Base walking speed
SpeedMult As Single 'Multiplier to speed (temporary, from conditions. See modifiers as well)

'Face/Reach string, for example "5 ft. by 5 ft./10 ft."
FaceReach As String

'Movement Speed, in ft per round, current and Base
SpeedStr As String

'Saves, Total of base and temp. bonuses. Read-Only
FortSave As Integer, RefSave As Integer, WillSave As Integer
'Base saving throw
FortBase As Integer, RefBase As Integer, WillBase As Integer


Function ChangeCon(NewCon) As Integer
'To change a PC's consitution and affect the base hit points at the same time.
'Directly modifying the "Con" variable will not adjust hit points

Sub CalcSpeed()
'Calculates the speed from Armor and/or load using the RULES.TXT
'Sets it in the Speed variable.

Function GetSizeMod() As Integer
'Uses the data in RULES.TXT to return the creature's size modifier to AC, attacks...

Function GetSizeModSpecial() As Integer
'Returns the special size modifier (see RULES.TXT) used in some situations like grapple.

Sub IncreaseSize(TheNewSize As String)
'Increases the size of the creature (used in monster advancement, or templates)
'TheNewSize is a one-letter string abbreviation of the size (S for Small, etc.)
'Ability scores, natural attack sizes are adjusted as needed.

Sub ReadSpeedStr()
'Reads the 'SpeedStr' variable to determine base walking speed as a number value.

HP and Damage

Go back to top


'Hit Points
HP As Long 'Current Hit Point total 'v.1.17 renamed vHP
HPBase As Long 'Maximum HP
Subdual As Long 'Current Subdual damage

'Permanent Damage Reduction, # of HP absorbed
DamageReduction As Integer

'Permanent Damage Reduction, type of the DR
DamageReductionStr As String 'Permanent type of DR

'Permanent Damage Reduction, bonus value, obsolete in DnD 3.5
DamageReductionPlus As Integer '-1 = silver?

'Each DR from conditions
Private TempDR(1 To MAX_DR_ENTRIES) As Integer 'hp absorbed
Private TempDRStr(1 To MAX_DR_ENTRIES) As String 'string
TempDRNum As Integer 'Number of entries

'Permanent Energy Resistance. New v.2.12
PermanentResistance As String

'Internal detailed resistances (not saved: they are recalculated on each CalcConditions)
NumResistances As Integer 'Number of resistance entries. Count starts from 1
ResistanceName() As String 'Name of the energy (acid, cold, etc.)
ResistanceVal() As Integer '# of HP absorbed


Function AdjustDamageForDR(OrigAmount As Integer, DamageType As String, ByRef ReturnDRCause) As Integer
'This functions reads the damage reduction components of ths creature
'OrigAmount: Original damage
'DamageType: Type of damage (like 'S/B, fire' etc.)
'Returns: What damage is left after reduction.
'ReturnDRCause: Is set to a string explaining the cause of the lowered damage

Sub Stabilize()
'Stabilizes a dying creature

Function Rest(FullDay As Boolean) As String
'Rests the character after a night's sleep
'Set FullDay to True to rest for 24 hours (8 hours otherwise)
'Returns the description of what happened to this character


Go back to top


'--- Armor Class ---
AC As Integer 'Regular Armor Class
ACFF As Integer 'Flat Footed AC (no dex)
ACTouch As Integer 'Touch AC (no armor)
ACArmor As Integer 'Is actually permanent _natural_ armor: (Armor bonuses not included in ArmorWorn and Shield)
ACMisc As Integer 'Size, and any other
ACSize As Integer 'Size mod to AC (unused)
ACTemp As Integer 'Sum of all temporary mods. Read-Only
ACDex As Integer 'Dex bonus to AC (limited by armor possibly)
ACMelee As Integer 'Effective AC vs melee (from conditions)
ACRanged As Integer 'Effective AC vs ranged weapons (from conditions)
ACTouchMelee As Integer 'Touch AC (no armor), for melee touch attacks
ACTouchRanged As Integer 'Touch AC (no armor), for ranged touch attacks
ACArmorTemp As Integer 'Sum of all temporary mods for armor. This is from conditions.


Go back to top


NoAttacks As Integer 'The number of attacks this creature has.

'A zero-based array of Attack objects.
Attack(0 To MAX_ATTACKS) As Attack 'Zero-based array: valid from 0 to cr.NoAttacks-1

'Last selected weapon - you can read this as the currently wielded weapon
'This is the entry in the Attack array above.
LastAttack As Integer 'Currently wielded weapon (entry number in Attack array)

'Base attack bonuses, -99 = no attack
BAB(1 To MAX_BAB) As Integer

'New v.2.07
GrappleBonus As Integer 'Permanent grapple bonus (added to size, etc)
GrappleTemp As Integer 'Temp grapple bonus (later, unused for now)


Sub AddAttack(NewAttack As Attack)
'Adds the attack in the NewAttack object to the PC's attacks.

Sub RemoveAttack(AtNum As Integer)
'Removes attack numbered Num from the list.

Sub RemoveAllAttacks()
'Clears the list of attacks, expect the first one which cannot be removed.

Function GetCurrentAttack() As Attack
'Returns the last selected attack, as an object.

Function MakeNewAttack() As Attack
'Creates a blank attack and adds it to the character. Returns the attack object.

Function MoveAttack(AttackNum As Integer, Movement As Integer) As Integer
'Moves the attack AttackNum in the list by + or - Movement.

Function UnhideAllAttacks() As Boolean
'Sets hidden to false for all attacks.
'Returns True if something changed.

Sub FindWeaponHand()
'Looks at the handedness of the current weapon. Sets CurrentWeaponHandedness to that.

Sub MakeBab(FirstBAB As Integer)
'Makes the 2nd and following base attack bonuses based on the FirstBab value, and the progression
'as described in RULES.TXT

Function CalculateBABFromClasses() As Integer
'This loops through each class, adding up the BABs from each to generate a total
'Base Attack Bonus.

Function ChooseOneAttack(FeatName As String, AddingFeat As Boolean) As Attack
'Asks the user to choose one of the attacks of the creature to apply a feat to.


Go back to top


'The auto-attack checkbox is checked
AutoAttack As Boolean 'Will automatically attack target (LastAttackedCreature)
LastAttackedCreature As String 'Is actually the target for the next attack, as set by the dropdown list. New v.170

'Data related to the current combat
Initiative As Single 'Current initiative value.
InitBonus As Integer 'Total init bonus (w/dex). Read Only
InitMiscBonus As Integer 'Other bonuses like improved init.

Round As Long 'Round the creature will be in the next time it acts
Enemy As Boolean 'If true, then the creature an enemy
Inactive As Boolean 'This creature will not enter in a combat
IsFamiliarOrSummoned As Boolean 'Participates in combat, but not to EL. New v.1.21
'Check this box if the creature will participate in combats but won't count in the Encounter Level or the average PC Party level. For example, a wizard may summon a few monsters. These creatures' CR is included in the CR of the wizard, so they should not be counted twice. Familiars and inactive monsters do not count when calculating the XP to award the PCs for defeating enemies.

ApplyRangePenalty As Boolean 'Checkbox to apply the range penalty is checked.
Range As Integer 'Value entered in the range box.

'Special init actions
IsDelaying As Boolean
IsReadying As Boolean
DelayInit As Single
ReadyInit As Single
IsReadyingWhat As String 'Unused

'Attacks of opportunity
AoOLeft As Integer 'Attacks of opportunity left
AoOMax As Integer 'Maximum # of attacks of opportunity


Function GetResistance(EnergyType As String) As Integer
'Returns the current resistance to energy/elements of type "EnergyType"
'0 if no resistance is found.

Function GrappleTotal(StrDetails As Variant, Optional AddBonus As Boolean = True, Optional DontAddBAB As Boolean = False) As Integer
'Returns the total grapple bonus, and the details for the calculation in StrDetails
'If AddBonus is false, the "other" bonus is not added.


Go back to top

Note that starting in version 2.15, it is recommended to replace calls like
Cr.AttMelee = Cr.AttMelee + 2
with the more general call:
Cr.AddModifier "Att Melee", 2, "Luck"
As you can see, this allows you to specify the type of bonus, allowing for stacking rules to be enforced. The old calls are still supported, and are the equivalent of adding an untyped (also called unnamed) modifier. Note that modifier names have spaces, e.g. "Att Melee", "Damage Bonus".

Calls of the type:
x = Cr.AttMelee
are equivalent to
x = Cr.GetBonus("Att Melee")
and both can be used.

See the Scripting - Creature Functions section for implementation details.

Note that in order to have a game effect, all of these modifiers must be changed from a feat's "special" code, set for Condition Effect. Changing any of these once (like in Get Feat) will have no effect, because they are recalculated all the time. This is distinct from base values like FortBase, StrBase, which can be modified only once with lasting effect.


'Information about each condition:
Condit(0 To MAX_COND) As Boolean 'is the condition active?
ConditInit(0 To MAX_COND) As Single 'initiative at which it ends
ConditExp(0 To MAX_COND) As Long 'rounds left until it ends
ConditExpRd(0 To MAX_COND) As Long 'round at which it ends

'Informative strings
ConditionStr As String 'A short string with the current conditions
ConditionNotes As String 'RTF string with notes about the condition effects

'- The counters -
CounterInit(0 To MAX_COUNTERS) As Single 'initiative at which it ends
CounterExp(0 To MAX_COUNTERS) As Integer 'rounds left until it ends
CounterExpRd(0 To MAX_COUNTERS) As Integer 'round at which it ends
CounterName(0 To MAX_COUNTERS) As String

'Boolean condition effects
CanAct As Boolean 'the creature can act at all (partial or full)
CanActPartial As Boolean 'just partial actions
CanActFull As Boolean 'take full actions
LoseDex As Boolean 'lose any dex bonus to AC
OnlyMove As Boolean 'only a move for this turn

'All of the following members are for backwards compatibility.
'It is recommended to use cr.AddModifier instead!

DefMelee As Integer 'Melee Attack Bonus if creature is defender
DefRanged As Integer 'Ranged Attack Bonus if creature is defender
AttMelee As Integer 'attack bonus for this creature with thess condition
AttRanged As Integer 'ranged attack bonus for this creature with these condition
MissChance As Integer '% chance to miss
DamageBonus As Integer 'temp bonus to damage (all sorts)
SpellFail As Integer

'other temp bonuses
SkillBonus As Integer 'modifier when rolling skills
AbilityBonus As Integer 'when rolling ability checks

'-- Various types of AC bonuses ---
ACGeneral As Integer 'Sum of unspecified bonuses. Corresponds to modifier name "AC".
ACDeflection As Integer
ACDodge As Integer
ACLuck As Integer
ACSacred As Integer
ACHaste As Integer
ACProfane As Integer
ACInsight As Integer
ACNaturalArmor As Integer
DamageMelee As Integer 'Damage modifier to melee attacks only
DamageRanged As Integer 'Damage modifier to ranged attacks only
TempDRPlus As Integer 'Damage reduction (plus to overcome)
TempDRAmount As Integer 'DR, HP absorbed
TempSpellResist As Integer
TempPowerResist As Integer
TempSpellFail As Integer
TempInitModifier As Integer 'Modifier to initiative bonus
TempHPNum As Integer 'Temp HP, added to total.

'Bonuses to the saves (from conditions, or feat effects)
RefBonus As Integer
WillBonus As Integer
FortBonus As Integer

'New ability scores, -1 = keep the old one
NewStr As Integer
NewDex As Integer
NewCon As Integer
NewInt As Integer
NewWis As Integer
NewCha As Integer

'Modifiers to the current ability score (Str = StrBase + ModStr)
ModStr As Integer
ModDex As Integer
ModCon As Integer
ModInt As Integer
ModWis As Integer
ModCha As Integer

SaveVsFear As Integer 'saves vs fear effects only
SaveVsCharm As Integer

ConditionMaxDex As Integer 'Max Dex from conditions
ConditionCheckPenalty As Integer

'These get calculated...
TempResistanceStr As String '5/Acid, 10/cold


Function GetCondition(CondName As String) As Boolean
'Returns true if the condition named CondName is set

Sub SetCondition(CondName As String, ByVal CondOn As Boolean, ByVal Expiration As Long)
'Looks for a condition named CondName, and sets it to CondOn for Expiration rounds.

Function SetCondName2(CondName As String, Optional Changes As String) As Integer
'Set the condition, checks for the NOT string.
'For example "NOT Fatigued" will remove the Fatigued condition whereas
' "Fatigued" alone will set it.

Function GetModifier(BonusName As String, Optional Subname As String = "", Optional ExtraString As String) As Single
'This function calculates and stacks the matching bonus from all conditions, scripts,
' according to the rules and returns the total bonus value.
' Also, optionally, returns ExtraString, which is extra info from the condition.

Sub AddModifier(BonusName As String, ByVal value As Single, Optional ModType As String, Optional Subname As String = "", Optional VariableName As String, Optional nSource, Optional ExtraString As String, Optional SemiPermanent As Boolean = False)
'This adds an arbitrary bonus/modifier to the PC's list
' BonusName: See RULES.TXT for a list of acceptable bonus names. Examples are "Att Melee" or "AC Deflection".
' Value: The numerical value of the modifier. Can be a float.
' ModType: Optional. The type of the modifier - this can be Luck, Circumstance, Enhancement, etc. or any of the standard modifier types. You can also define new modifier types - just type in a different value than those in the combo box.
' Subname: Optional. The "subname" is a specialization of the name. For instance, for skill bonuses in general Name is "Skill", but you need to specify Subname to the name of the skill, like Listen, Spot, etc... This also applies to DR and energy resistances.
' VariableName: Optional. Name of a custom variable that will replace the value.
' ExtraString: Optional. This is an extra string of information that, in this version, has no game effect.
' nSource: Optional. String indicating what the source of the modifier is. This is set automatically in scripting to say 'Feat X', but can be overriden.
' SemiPermanent:
' Set to TRUE to put the modifier in the 'DM Modifiers' condition - that is, the modifiers
' that can be modified on the fly by the user in the 'Condition Modifiers Editor' (Ctrl+F6)

Function RemoveModifierPermanent(BonusName As String, Optional ModType As String, Optional Subname As String = "") As Boolean
'Removes the semi-permanent modifier:
' Named "BonusName",
' of type "ModType",
' and with additional subname of "Subname"
'This does not remove temporary modifiers which need to be set repeatedly anyway.
'This only applies to those modifiers in "DM Modifier" (or those that show up
'in the bottom of the Ctrl+F6 dialog).


Go back to top

Covers classes and levels, XP, hit die, and templates.


LevelStr As String 'Levels as a string. Auto-generated

ChallengeRating As Single

XP As Long 'Experience point total
XPNextLevel As Long 'Experience points to reach next level

GetsXPPercent As Integer 'Portion of XP the creature receives in the party

'----- Classes -----

'Number of classes the PC has.
'These are counted from 1 to NumCrClasses.
NumCrClasses As Integer

ClassName(0 To MAX_CLASSES) As String 'Abbreviation of the class name
ClassLevel(0 To MAX_CLASSES) As Integer '# of levels in this class
ClassNotes(0 To MAX_CLASSES) As String 'Notes for the class, displayed in Classes tab

Level As Integer 'Total levels in all classes
ECLevel As Integer 'Equivalent Character Level
RaceLevelAdjust As Integer 'Level Adjustment from race.
TotalHD As Integer 'Total HD = class levels + race HD (ignoring 1)
TotalHDwithConBonus As Integer 'Total HD that have a con bonus (for Temp HP)
RaceHD As Integer 'Race HD (not adjusted)

'- Template stuff -
TemplateLevelAdjust As Integer 'Level Adjustment from template(s) applied, new v.2.04

'New v.2.04 - NOT YET used
TemplateNameList As String '| separated
TemplateCR As Single 'Change in CR due to template(s)

'----- Hit Die details ------

'The number of entries in the HD columns (is equal to the number of hit die, unless some are lost)
HD_num As Integer

'The die rolled for this particular level, e.g. '8' for 1d8
HD_Roll(1 To MAX_LEVEL) As Integer

'The number of hp rolled for this roll (e.g. 6)
HD_hp(1 To MAX_LEVEL) As Integer

'The source of this hit die:
' 0: Race
' 1: Class
' 2: Creature advancement class
' 3: Race, but lost because of class
HD_source(1 To MAX_LEVEL) As Byte

'Does this die get the con bonus? Set to non-zero if yes
HD_Con(1 To MAX_LEVEL) As Byte


Sub AddHitDie(roll As Integer, NewHP As Integer, Source As Byte, ConBonus As Byte)
'Adds a hit dice to a PC
' Roll: die rolled for this particular level, e.g. '1d8'
' newHP: The number of hp rolled for this roll (e.g. 6)
' source: Source of this hit die
' conBonus: Get the con bonus? Set to non-zero if yes

Sub RemoveHitDie(num As Integer)
'Remove hit die # num from the list of hit dies.

Sub RecalcHP(ResetHPLeft As Boolean, Optional KeepSameDamage As Boolean = False)
'Recalculates total HP, from each hit die's total
'Use this if you modify
HD_hp(num) for example
'Set ResetHPLeft to give full health after recalculating hp.

Sub AddBaseHPManually(NewTotal As Integer)
'Fixes each hit dice individually so that the final total is NewTotal
'This does not change the number of hit dice, but adds the hit points
'in a distributed way on the existing ones.

Function MakeHDString() As String
'Returns the list of hit dice of the creature in the format "1d8+3 + 2d6" etc.

Function GetClassLevel(ClN As String) As Integer
'Returns how many levels the PC has in a class. Use the abbreviation.

Function GetClassNum(ClN As String) As Integer
'Returns the index in the class arrays for this particular class abbreviation.
'This is used in
SpellSlot for example.

Function GetLevel() As Long
'Returns the total character level of the PC

Function GetXPNextLevel() As Long
'Returns amount of XP for the next level to be gained.

Function GetNumHD() As Integer
'Returns the number of hit die

Sub RerollHD(NewHD As Integer, RaceOnly As Boolean, Optional DiscardClasses As Boolean = False, Optional MultiplyHitDie As Single = 1)
'For Templates:
'For the total HD the creature currently has, reroll as though it were actually rolled with a dice of value "NewHD"
' Set RaceOnly to true and class HD are kept the same value
' if DiscardClasses is true then HD from classes (except monster advancement) are ignored
' If MultiplyHitDie isn't 1 then the number of hit die after dropping classes/race is multiplied by that number


Go back to top


NumItems As Long 'Number of items.
Items() As item 'Array of item records. Array is 1-based.

'Accessing Item Data
'The following read/set the property for the item # entered in parentheses
'for example. Cr.ItemCharges(num) = 3
' x = cr.ItemCount(num)
'Using GetItemStat is equivalent and offers more options. These functions are useful shortcuts, though.

ItemName(num) '(read only)
SetItemName(num, NewName)
ItemNumContained(num) '(read only)

'Armor, as read from equipped items
Private ArmorWorn As Armor
'Shield, as read from equipped items
Private Shield As Armor

'Weight/value of items (calculated)
TotalWeight As Single 'Weight of all items
EquippedWeight As Single 'Weight of equipped items (not used for load calculations)
TotalGP As Single 'Total value of items in GP

'Calculated load values, in pounds
LoadLight As Single '# of pounds beyond which load is light
LoadMedium As Single '# of pounds beyond which load is medium
LoadHeavy As Single '# of pounds beyond which load is heavy

CarryingMultiplier As Single 'Multiplier to carrying capacity (for quadrupeds, for instance)

Cash As Single 'Total cash, in gp. Calculated.
CashPP As Long 'Platinum pieces
CashGP As Long 'Gold pieces
CashSP As Long 'Silver pieces
CashCP As Long 'Copper pieces
Valuables As String 'Open text field for notes about gems and such


Sub SetItemName(ByVal index As Integer, NewName As String)
'Set the name of an item. Use instead of cr.ItemName(num) = "Something"

Sub ItemTotals()
'Recalculates items' total weights

Function CoinWeight() As Single
'Returns the weight of the coins in pounds. The coins per pound is set in RULES.TXT.

Sub CalcLoads()
'Calculates the carrying capacity of the character and saves in the variables:
' LoadLight, LoadMedium and LoadHeavy.

Function FindItemName(ItemName As String) As Integer
'Takes the item name, finds it, returns the position in this creature's item Array (localID)
'This number can then be used in other functions or to directly access the item.

Function AddItemObj(TheItemObj As ItemObj, Optional ContainerLocalID As Integer = 0) As Integer
'Adds a copy of the item object TheItemObj to this creature's inventory.
' ContainerLocalID = Inside what container (defaults to 0, which is the root container.)
' Returns: The new item number

Sub AddItem(nName As String, nWeight As Single, nCost As Single, Optional TheType As Integer = 0, Optional ByVal TheCount As Integer = 1)
'Adds a simple item to the character's inventory.
'Only the name, cost, weight, type and quantity can be set.

Sub RemoveItem(num As Integer, Optional SellPercent As Integer = 0)
'Removes item # num (You can find a particular item by scanning from 1 to cr.NumItems).
'Set SellPercent to 100 to get 100% of the value in gp added to coins.

Sub RemoveAllItems()
'Clears the entire list of items of the PC

Function RunItemScript(ItemLID As Integer, CodeType As eItemScriptType, Optional ByVal RestHours As Integer = 0, Optional WeaponAttack As Attack) As String
'Warning: An advanced function, which directly runs an item's script code!
' ItemLID is the item # (use FindItemName, for example)
' CodeType is : SharedCode = 0; UseItem = 1; Rest = 2; EquipItem = 3; UnequipItem = 4; WeaponAbility = 5; ArmorAbility = 6; ContentsChange = 7; ConditionEffect = 8; AttackBonusCalculation = 9
' Do not use the Weapon/Armor ability code, they will not work.

Sub UseItemNum(ItemNum As Integer)
'This does the same thing as right-clicking an item and selecting 'Use Item'
'ItemNum is the number of the item.

Sub ReadEquipment(sEquip As String)
'Reads an equipment string (like from a stat block format) and adds it to the inventory.
'Will look for Standard Items matching the name and use them, if any are found.

Function HasArmor() As Boolean
'Returns true if an armor is equipped.

Function HasShield() As Boolean
'Returns true if a shield is equipped.

Function FindArmorWeight(LookShield As Boolean) As Single
'Looks in the items and finds the weight of the armor/shield

Function GetItemStat(ItemNum, PropertyName As String, Optional num As Integer = 1)
'Function for scripting
'Returns the property named PropertyName from the item ItemNum
'If PropertyName is an array, the index looked at is ArrayNum

Sub SetItemStat(ItemNum, PropertyName As String, ValueToSet As Variant, Optional num As Integer = 1)
'Function for scripting
'Sets the property named PropertyName from the item ItemNum
'If PropertyName is an array, the index looked at is ArrayNum

Sub SpendGP(OriginalCost As Single)
'Spends a certain amount of money. OriginalCost is in gp.

Sub ReceiveGP(NumGP As Single)
'Add a certain amount of gold (or other) coins to the character's cash

Function GetArmorStat(ByVal LookShield As Boolean, ByVal StatName As String) As Variant
'Returns the stat for the armor/shield used.
' LookShield: Set to true to get shield data
' StatName: Either "Name", "Ac" (Non-magical ac bonus), "Magic" (magical bonus),
' "MaxDex", "Check" (skill check penalty), "SpellFailure"


Go back to top


'Skills are an array numbered from 1 to func.GetNumberOf_Skills
SkillTotal(0 To MAX_SKILLS) As Integer 'Total bonus to the skill roll. Read-Only
SkillRanks(0 To MAX_SKILLS) As Single 'Ranks bought (can be .5)
SkillMisc(0 To MAX_SKILLS) As Integer 'Any misc mods (race, synergy...)
SkillTemp(0 To MAX_SKILLS) As Integer 'Temporary, from conditions. Read-Only

SkillInfo As String 'Info such as craft (pottery), etc.

'Comma-separated list of skills which are to be considered as class-skills for all levels gained by the PC. You can also specify that a skill should be class for only ONE class by putting the abbreviation in square brackets. For example, by using "Listen, Spot [Ftr], Bluff [Rog]", the skill Listen will be class for all classes; Spot will only be class when leveling the Fighter, and Bluff will be class when leveling the Rogue.
ForcedClassSkills As String 'Comma-separated list of Class Skills for all classes. 'New v.2.06

SkillPoints As Integer 'Total skill points the PC should have

FinalCheck As Integer 'Final check penalty to skills, calculated automatically (read-only)


Sub CalcAllSkills()
'Recalculates totals for all skills.

Sub ReadSkills(ins As String, Optional AddMiscBonusesOnly As Boolean = False, Optional SubtractMiscBonuses As Boolean = False)
'Reads a string like "Balance +2|2, Spot +4" etc... into skills
'if AddMiscBonusesOnly then only the misc bonuses are added - nothing else. Otherwise, the entire set of skill ranks and misc bonuses will be cleared.
'if AddMiscBonusesOnly is false then also, all ranks etc are reset to 0 before the read
' If SubtractMiscBonuses AND AddMiscBonusesOnly are True, then the misc bonuses are substracted instead of added


Go back to top


FeatList(0 To MAX_FEATS) As Boolean 'True means he has the feat.
FeatMisc As String 'info like Empower (Magic Missile), etc.

NumFeatsChosen As Integer 'Used by the leveling wizard for display only.


Sub ReadFeats(ins As String, Optional DontClearFeats As Boolean = False)
'Reads a comma-separated string (ins) into a list of feats.
'Set DontClearFeats to true to keep the current list, and only add to it.
'Does not call the GiveFeat script code.

Function RunFeat(ByVal FeatNum As Integer, ByVal RunWhat As Integer, Optional ByVal RestHours As Integer = 0) As Boolean
'-- This functions runs a feat as though the user had clicked a button on the feat tab 'FeatNum: The feat ID (use func.GetFeatNum)
'RunWhat: USE button = 2; STOP button = 3; REST button = 4;
'RunWhat: The Get Feat script is 0 and the Remove Feat script is 1 - but it is not recommended to run these directly! Use
GiveFeatName instead.
'RestHours: Parameter passed to the REST function

Function HasFeatName(FeatName As String) As Boolean
'Returns true if the PC has the named feat.

Sub GiveFeatName(FeatName As String, ClassAbil As String, NewVal As Boolean, Optional AddSecondTime As Boolean = False)
'Set the named feat as true/false (depending on NewVal)
' ClassAbil is the class corresponding to it if it's a class ability
' If AddSecondTime is true then add the feat again if the feat can be taken multiple times (e.g. Weapon Focus)
' This will run the feat script code, if applicable.

Sub RecalculateLevelDependantFeats()
'For level-dependant feats, recalculate the FeatGet code because level (might) have changed


Go back to top

General note about spells: Spells and psionic powers are used interchangably in DM Genie. Functions that operate on spells work on powers as well, though you may need to specify a "PsionicMode" value which is normally optional.


'Spells are an array from 1 to func.GetNumberOf_Spells
SpellList(0 To MAX_SPELLS) As Boolean 'True = knows the spell
SpellMem(0 To MAX_SPELLS) As Byte '# of times the spell has been memorized

SpellSlotFull(0 To MAX_CLASSES, 0 To MAX_SPELL_LEVEL) As Byte 'Maximum daily spell slots. Returns -1 if the player CANNOT cast the spell at all.
SpellSlot(0 To MAX_CLASSES, 0 To MAX_SPELL_LEVEL) As Byte 'Remaining spell slots.
SpellMaxLevel(0 To MAX_CLASSES) As Byte 'Max level for each spell casting class (unused for now -- always 0!)

SpellResistance As Integer 'Permanent spell resistance

SpellNotes As String 'Misc notes about spells 'New v.1.14.172

'Preset lists of memorized spells to use each morning. See the Spells menu. (new v.2.03)
SpellMemorizedListName() As String 'The name of the list (e.g. "Dungeon")
SpellMemorizedList() As String 'The list (like in stat blocks)
SpellMemorizedNum As Integer
SpellMemorizedLastRecalled As Integer 'New 2.07 - the last used list of spells

'- Cleric Domains -
ClericDomains As String 'Comma separated list of domains
Domains() As String 'Separated version of the list of domains. Do not modify directly.
NumDomains As Integer

'Used when leveling to see if the "+1" spell slots should be used. Corresponds to the checkbox.
SpellSpecialized As Boolean
PsionicSpecialized As Boolean


Sub ClearSpellList(Optional MemorizedOnly As Boolean = False, Optional PsionicMode As Boolean = False)
'Clear old list of spells (or psionic powers if PsionicMode is true)
' or only resets the # memorized to 0 if MemorizedOnly is true

Sub ReadSpellsKnown(ins As String, Optional PsionicMode As Boolean = False, Optional ForceClass As String = "")
'Reads a comma-separated string into a list of spells
'Doesn't clear list beforehand
'Set ForceClass if you know the class for sure.

Sub ReadSpellsMem(ins As String, Optional DetailedInfo As Boolean = False, Optional ForceClass As String = "", Optional ReduceSlots As Boolean = False)
'Reads a comma-separated string into a list of times spells were memorized
'Doesn't clear list beforehand
'Set DetailedInfo to false - it is used internally
'ForceClass : Set to "" to automatically choose the class. Set to "Race" for example to read spell-like abilities

Function CanCastArcane() As Boolean
'Returns true if one of the classes can cast arcane spells

Function CanCastDivine() As Boolean
'Returns true if one of the classes can cast divine spells

Sub AutoSpellList(Optional defS As String = "", Optional ForceClass As String = "", Optional ShowPsionic As Boolean = False)
'Prompts the user to create a spell list automatically, same as the menu option.

Function ClassSpellCasting(ByVal index As Integer) As Boolean
'Returns true if the character's class number Index is a spellcasting class

Function GetSpellCastLevel(ByVal ClNum As Integer) As Integer
'Get the effective spellcasting level for class numbered ClNum

Function GetSpellDC(ByVal ClNum As Integer, ByVal SpLevel As Integer) As Integer
'Returns the DC for a spell of level SpLevel cast as a class # ClNum

Function TurnUndead() As String
'Makes a turn undead check. Returns the appropriate string to display in the Combat Log.
' As of version 2.21, this simply calls the Global Script "TurnUndead"

Function SpellSlotsToFull() As Boolean
'Resets the remaining spell slots (SpellSlot) to the full value (SpellSlotFull) .
'Returns TRUE if anything changed

Function UseSpellSlot(ClassName As String, LevelOfSpell As Integer, NumUsed As Integer) As Boolean
'Substract NumUsed slots from slot # LevelOfSpell for class ClassName

Spells, Advanced

Go back to top

These functions can be used when ReadSpellsKnown and ReadSpellsMem are not sufficient.
The functions require the Spell ID: use func.GetSpellNum to find it.
All of these functions will work equally on psionic powers as on spells.


'This variable is the index in the list of memorized slots that was last selected. You can either read or set the value (also see SpellKnownFindMemorizedSlot, above) :
SpellKnownLastSelection(ByVal SpellID As Integer) as Integer

'This variable is a string with the list of memorized slots. It is formatted with the pipe character as a separator, and metamagic feats in parentheses. For instance: "Clr|Clr(maximized)|Pal"
SpellKnownMemorizedList(ByVal SpellID As Integer) as String


Sub LearnSpell(SpellID As Integer, Optional ForceClass As String = "", Optional AllowInput As Boolean = True, Optional DefaultClass As String = "")
'- Learn a spell/psionic power, and specify the "Known By" class -
'SpellId: The ID# of the spell in question. Use Func.GetSpellNum("SpellName", False) or Func.GetSpellNum("PsionicPowerName", true)
'ForceClass = "X": Always set the known class as X. For instance, set to "Race" to force a spell to be a racial ability.
'AllowInput = If True then prompt the user if needed (that is, if there is more than one possible class that could use this spell)
'DefaultClass = "X": Use X when a choice would be presented (AllowInput must be false). If no user input is allowed, and DefaultClass is not set, then the first valid class found is used.
'E.g. To give a spell-like ability:
'num = func.GetSpellNum("Fireball", False)
'if num > 0 then
' call cr.LearnSpell(num, "Race")
'End If

Function SpellKnownBySpecificClass(ByVal SpellID As Integer, TheClassName As String) As Boolean
'- Is this spell known by a certain class? -
'Returns true/false depending on whether that spell is known by that class
'SpellID: ID of the spell (use func.GetSpellNum)
'TheClassName: The class that the spell should know

Sub SpellKnownMemorize(ByVal SpellID As Integer, MemorizeStr As String)
' - Add a memorization to the list -
'SpellID: ID of the spell (use func.GetSpellNum)
'If the spell is not already known it will be learned automatically (using LearnSpell)
'An extra memorization is added to the list for that spell.
' The class that has it memorized is set by MemorizeStr
'For instance, this will memorize the spell Fireball as a Sorcerer
'num = func.GetSpellNum("Fireball", False)
'If num > 0 Then
' Call Cr.SpellKnownMemorize(num, "Sor")
'End If

Sub SpellKnownUnMemorize(ByVal SpellID As Integer, SlotNumber As Integer)
'Remove a memorization from the list, the one at index SlotNumber (starts at 1)
'SpellID: ID of the spell (use func.GetSpellNum)

Function SpellKnownFindMemorizedSlot(ByVal SpellID As Integer, ClassName As String) As Integer
'- Look in the MemorizedList to find a slot to call -
' Explanation: Each spell has a list of memorized slots, and the class that memorized it. For example, a Clr/Pal who memorized Bless for each class in a certain order might have 'Clr, Pal, Clr, Clr' in the list of slots for Bless
' Basically this allows you to know if a spell has been memorized for a specific class or not. It returns 0 if the class name does not match any slots
'SpellID: ID of the spell (use func.GetSpellNum)
'ClassName: The class that memorized the spell


Go back to top


'Psionic powers and spells share the same interface. Use cr.SpellList to determine
'if a PC has a particular psionic power

PowerResistance As Integer 'Akin to spell resistance
PowerPointsMaxBase As Long 'Max stored PPs

PowerPointsMaxTemp As Long 'Temporary bonus to max PP
PowerPointsMaxBonus As Long 'bonus to max PP from ability

PowerPoints As Long 'Number left
TalentsLeft As Integer 'talents left

'New v.2.09
PsionicFocus As Integer '# of times the PC is focused (usually 1, can be higher)

'The following are unused
TalentsMax As Integer 'Max talents/day (unused)
MentalHardness As Integer 'Unused.
PowersNotes As String 'misc notes (unused)
PsionAbility As Integer '0 = str, etc.
PsionDiscipline As String 'changes ability
PsionNickname As String 'Unused.
Psicrystal As String 'Unused.
PsicrystalEffect As String 'Unused.
PsicrystalAbilities As String 'Unused.


Sub ReadPowers(ins As String)
'Reads a comma-separated string into a list of Powers
'Same as ReadSpellsKnown(ins, true) since version 2.09.

Function ClassIsPsionic(ByVal index As Integer) As Boolean
'Returns true if the character's class number Index is a psionic class

Function GetPsionicManifestLevel(ByVal ClNum As Integer) As Integer
'Get the effective psionic manifesting level for Class # ClNum


Go back to top

You can declare general variables for use in your feats. Variables are:
- Persistent: They are saved when closing the program.
- Unique to each PC
- For best compatibility, use strings

There is no real limit to how many variables a single PC can have, other than memory concerns it can be up to 32000.
Custom variables can be displayed in the character sheet using the tag |CUSTOMVAR: TheNameOfMyVariable|

You can also filter HTML in the character sheet using the format
This html code will only be displayed if the variable is not empty.


'Custom Variables, built-in to the program. New v.2.11
CustomVar(0 To 15) As Long


Sub SetVariable(VarName As Variant, VarValue As Variant)
'Creates (if necessary) a custom variable of name VarName and sets its value to VarValue.
' VarName is NOT case-sensitive
' Make sure you use a unique name for VarName, for example:
' WeaponFocus
' UncannyDodgeRog

Function GetVariable(VarName As Variant) As String
'Get the custom variable of name VarName and returns its value.
' VarName is NOT case-sensitive

Sub RemoveVariable(VarName As Variant)
'Removes the Variable called VarName. Make sure you call this in FeatRemove to avoid leaving junk!
' VarName is NOT case-sensitive

Documentation for DM Genie and Player Genie, page Creature. Copyright © Mad Scientist Studios, 2006.
Help Contents   |   DM Genie home page
Click here if you cannot see the table of contents on the left