Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

From Roll20 Wiki

Jump to: navigation, search
Line 8: Line 8:
 
|lastmodified=2022-01-09
 
|lastmodified=2022-01-09
 
|code=MagicMaster
 
|code=MagicMaster
|dependencies=None
+
|dependencies=ChatSetAttr, Tokenmod, RoundMaster, InitiativeMaster, AttackMaster
 
|conflicts=None}}
 
|conflicts=None}}
  
 +
==What MagicMaster does==
 +
===Item, Spell and Power databases===
 +
<p>MagicMaster uses a large range of items held in databases.  The current versions of these databases are distributed with the API, will be automatically created in any campaign the API is installed in and updated as new versions are released via Roll20.  Spell, Power and Item Databases are implemented as ability macros in specific library character sheets.  These macros can do anything that can be programmed in Roll20 using ability macros and calls to APIs, and are found and called by the MagicMaster API when the Player selects them using the menus provided by the MagicMaster functions.  The GM can add to the provided items in the databases using standard Roll20 Character Sheet editing, following the instructions provided in the <b>Magic Database Handout</b>.</p>
 +
===Spells and Powers===
 +
<p>The Ability Macros for spells and powers include descriptions of the spell they represent (limited, I'm afraid, to avoid copyright issues), and also can optionally have API Buttons embedded in them which, if selected by the Player, can enact the actions of the spell or power.  The API Buttons call one or more of the API commands listed in this document, or commands provided by other APIs.  This is most powerful when combined with the <b>RoundMaster API</b> to implement token statuses and status markers with durations and effect macros, enabling the spells & powers to make temporary (or permanent, if desired) changes to the targeted creature's token and character sheet attributes.</p>
 +
<p>The best way to learn about these capabilities is to look at example spell definitions in the databases and use those spells or powers to see what they do.</p>
 +
===Adding Spells & Powers to the Character===
 +
<p>Spells need to be added in two steps: 1. adding to a Character's or NPC's spell book; and 2. Memorising the spells each day.</p>
 +
<p>The simplest way to add spells to a Character's spell books is to use the <b>CommandMaster API</b> functions that set up Character Sheets from scratch.  However, spells can be added to the Character Sheet manually: see the <b>RPG Master CharSheet Setup handout</b> (created by the API) for details of how to do this.  Either approach results in the Character having a list of spells at each spell level they can use that they have available to memorise.</p>
 +
<p>Spells can be memorised using the <b>--mem-spell</b> MagicMaster command.  This limits the number of spells memorised at each level to the number that is valid for the Character, with their specific characteristics, class, level and other valid adjustments (though it is possible to add a “fudge factor” if needed via the menu).  Once memorised, they can be rememorised or changed at any time, though the DM usually limits this in game play to once each in-game day.  If a Player is happy with the spells a Character has, the Character just needs to rest at the end of the day to regain their spells (and powers, and recharging magic item charges) automatically.</p>
 +
<p>Powers are added in exactly the same way as Spells.  The difference between the two is that Powers are granted to a Character, either as a function of the class they have adopted, or from being granted powers in game-play.  Of course, NPCs and creatures also have many various powers.  Some Powers can be used more than once a day, or even 'at will' (an example is Priests turning undead).</p>
 +
===Casting spells and using powers===
 +
<p>Spells memorised by the Character can be cast using MagicMaster menus.  As with items, when used with the <b>InitiativeMaster API</b> the action for the next round can be the casting of a specific spell, with the speed of the Casting Time.  Casting a spell will remove it from memory for the rest of the day, but a rest will bring it back.  Like items, spells use Roll20 ability macros and thus can perform any function a macro or an API call can achieve.  The same capability to affect tokens and Character Sheets is available if used with the RoundMaster API.</p>
 +
===Types of Item Provided===
 +
<p>The Item database is split into nine parts: Weapons, Ammunition, Armour, Lights, Potions, Scrolls & Spellbooks, Wands Staves & Rods, Rings, and Miscellaneous.  More might be added in future releases, and any DM can add more databases with their own items. </p>
 +
<p>Armour can be used by the <b>AttackMaster API</b> to automatically set the Character's Armour Class, including altering AC as a shield is taken in hand or put away, and taking into account items such as Rings of Protection and Bracers of Defense.  Weapons and Ammunition can also be taken in hand to attack with.  Weapons can dance, and thrown weapons and ammunition can be magically self-returning (they don't have to be retrieved by the AttackMaster <i>Recover Ammo</i> function).</p>
 +
<p>Many magic items have actions that they can perform in the same way as Spells & Powers, using API Buttons in their macros that call MagicMaster API commands, or commands from other APIs.  As with spells & powers, this is most powerful when combined with the capabilities of the <b>RoundMaster API</b>.</p>
 +
<p>Items can have stored spells (like <i>Rings of Spell Storing</i>) and the spells can be cast from them, and/or can have powers that can be consumed and are refreshed each day.  The spells and powers can have temporary or permanent effects on Tokens and Character Sheets, if desired, via RoundMaster functions.</p>
 +
===Adding Items to the Character===
 +
<p>The MagicMaster API provides commands to perform menu-driven addition of items to the Character Sheet.  Using these commands will set up all the necessary fields so that the Player can use the items with the other APIs - if using MagicMaster then items should not be added directly to the Character Sheet.</p>
 +
<p>Items can also be acquired by finding them in chests or on tables (tokens with images of chests & tables that represent Character Sheets with items added to them) that can be looted, or even dead bodies of NPCs that have been killed in battle.  MagicMaster provides commands that support a menu-driven way to perform looting.  Characters, especially Rogues, can even try to Pick Pockets to take items from NPCs (or even other Characters…), though failure may alert the DM (or other Player) to the attempt.  Containers can even be trapped, with magical consequences if the trap goes off!  On the other hand, Characters can also put items away into chests or onto tables or other storage places, or give them to other Characters or NPCs, all using easy menus and button clicks.</p>
 +
===Using Items===
 +
<p>Items possessed by the Character can be used to perform their functions, using MagicMaster menus.  When used with the <b>InitiativeMaster API</b>, the action for the next round can be the use of a specific item the Character has on them, with the speed of that item.  This may use charges or consume quantities of the item, and these charges may or may not be regained overnight, or through other means.  The items use Roll20 ability macros that can be as simple as putting text in the chat window explaining what the item does, through to much more complex targeting of effects on the user, a single other target, or all tokens in a defined area.  When used with the <b>RoundMaster API</b>, targeted tokens can have a status marker applied with a pre-determined duration and associated effects at the start, each round and when it finishes.  Items that are totally consumed will automatically disappear from the Character Sheet.</p>
 +
===Dynamic lighting for tokens===
 +
<p>MagicMaster API provides commands to change the lighting settings of the token to reflect illumination, as if holding various light sources.  This includes both radiant light sources such as hooded lanterns, torches, continual light gems, magic items and magic armour, and also directed light sources such as beacon lanterns and bullseye lanterns which only illuminate in beams.</p>
 +
===DM tools===
 +
<p>The DM is provided with tools to be able to add items to chests, NPCs, Characters etc.  These tools allow the DM to also change certain aspects of the items, including the displayed name and the cursed status of the item.  Items that are cursed are not obvious to Characters and Players, and such items can be 'hidden' and appear to be other items until revealed as the cursed item by the DM.</p>
 +
<p>The tools also allow the DM to increase or restrict the number of items Characters can have on their person: it is then possible to give each Character a 'backpack' token/character sheet, which the Character can store items to and get items from - of course, retrieving an item from the backpack takes a round…  They can even have horses with saddlebags that can hold items.</p>
 +
<p>DMs can also add their own items, spells and powers to additional databases (the provided databases should not be added to, but entries can be replaced by new entries in your own databases - updates will not overwrite items you create in your own databases).  This requires some knowledge of Roll20 macro programming and use of APIs.  See the Roll20 Help Centre for information, and the information in Section 8 of this document.</p>
 +
<br>
 
== Syntax ==
 
== Syntax ==
<p>The AttackMaster API is called using !attk.</p>
+
<p>The MagicMaster API is called using <code>!magic</code> (or the legacy command <code>!mibag</code>).</p>
<pre>!attk --help</pre>
+
<pre>!magic --help</pre>
<p>Commands to be sent to the AttackMaster API must be preceded by two hyphens <b>‘--’</b> as above for the <b>--help</b> command.  Parameters to these commands are separated by vertical bars |, for example:</p>
+
<p>Commands to be sent to the MagicMaster API must be preceded by two hyphens '--' as above for the --help command.  Parameters to these commands are separated by vertical bars '|', for example:</p>
<pre>!attk --attk-hit token_id | [message] | [monster weap1] | [monster weap2] | [monster weap3]</pre>
+
<pre>!magic --mi-power token_id|power_name|mi_name|[casting-level]</pre>
 
<p>If optional parameters are not to be included, but subsequent parameters are needed, use two vertical bars together with nothing between them, e.g.</p>
 
<p>If optional parameters are not to be included, but subsequent parameters are needed, use two vertical bars together with nothing between them, e.g.</p>
<pre>!attk --checkac token_id || [SADJ / PADJ / BADJ]</pre>
+
<pre>!magic --cast-spell MI|[token_id]||[casting_name]</pre>
 
<p>Commands can be stacked in the call, for example:</p>
 
<p>Commands can be stacked in the call, for example:</p>
<pre>!attk --checkac token_id | [ SILENT ] | [SADJ / PADJ / BADJ] –weapon token_id</pre>
+
<pre>!magic --spellmenu [token_id]|[MU/PR/POWER] --mimenu [token_id]</pre>
<p>When specifying the commands in this document, parameters enclosed in square brackets [like this] are optional: the square brackets are not included when calling the command with an optional parameter, they are just for description purposes in this document.  Parameters that can be one of a small number of options have those options listed, separated by forward slash /, meaning at least one of those listed must be provided (unless the parameter is also specified in [] as optional): again, the slash /is not part of the command.  Parameters in UPPERCASE are literal, and must be spelt as shown (though their case is actually irrelevant).</p>
+
<p>When specifying the commands in this document, parameters enclosed in square brackets [like this] are optional: the square brackets are not included when calling the command with an optional parameter, they are just for description purposes in this document.  Parameters that can be one of a small number of options have those options listed, separated by forward slash '/', meaning at least one of those listed must be provided (unless the parameter is also specified in [] as optional): again, the slash '/' is not part of the command.  Parameters in UPPERCASE are literal, and must be spelt as shown (though their case is actually irrelevant).</p>
 +
==Command Index==
 +
===Spell and Power management===
 +
<pre>--spellmenu [token_id]|[MU/PR/POWER]<br>
 +
--mem-spell (MU/PR/POWER)|[token_id]<br>
 +
--view-spell (MU/PR/POWER)|[token_id]<br>
 +
--cast-spell (MU/PR/POWER/MI)|[token_id]|[casting_level]|[casting_name]<br>
 +
--cast-again (MU/PR/POWER)|token_id|[spell_name]</pre>
 +
===Magic Item management===
 +
<pre>--mimenu [token_id]<br>
 +
--edit-mi [token_id]<br>
 +
--view-mi [token_id]<br>
 +
--use-mi [token_id]<br>
 +
--mi-charges token_id|value|[mi_name]|[maximum]<br>
 +
--mi-power token_id|power_name|mi_name|[casting-level]<br>
 +
--mem-spell (MI-MU/MI-PR)|[token_id]<br>
 +
--view-spell (MI-MU/MI-PR/MI-POWER)|[token_id]<br>
 +
--cast-spell MI|[token_id]|[casting_level]|[casting_name]|[CHARGED]|[mi-name]</pre>
 +
===Spell, power & magic item effects and resting===
 +
<pre>!rounds --target CASTER|token_id|spell_name|duration|increment|[msg]|[marker]<br>
 +
!rounds --target (SINGLE/AREA)|token_id|target_token_id|spell_name|duration|increment|[msg]|[marker]<br>
 +
--touch token_id|effect-name|duration|per-round|message|marker<br>
 +
--rest [token_id]|[SHORT/LONG]|[MU/PR/MU-PR/POWER/MI/MI-POWER]|[timescale]</pre>
 +
===Treasure & Item container management===
 +
<pre>--gm-edit-mi [token_id]<br>
 +
--search token_id|pick_id|put_id<br>
 +
--pickorput token_id|pick_id|put_id|[SHORT/LONG]</pre>
 +
===Light source management===
 +
<pre>--lightsources [token_id]<br>
 +
--light token_id|(NONE/WEAPON/TORCH/HOODED/CONTLIGHT/BULLSEYE/BEACON)<br>
 +
--changelight token_id|(NONE/WEAPON/TORCH/HOODED/CONTLIGHT/BULLSEYE/BEACON)</pre>
 +
===Other commands===
 +
<pre>--help<br>
 +
--check-db [ db-name ]<br>
 +
--debug (ON/OFF)</pre>
 
<br>
 
<br>
 
+
==Spell management==
== Installation and Configuration ==
+
===Display a menu to do actions with spells===
Copy the script's code, available from the menu on the right and stored at Roll20's [https://github.com/Roll20/roll20-api-scripts API GitHub Repository]. Paste the code into a new script in your campaign's [[API:Use_Guide#The_Script_Editor|API Script Editor]]. Save the new script and it will be available inside your campaign. It will install several new Character Sheets & Handouts: The handout '''AttackMaster Help''' provides a full manual of how to use AttackMaster.  The handout '''RPGMaster CharSheet Setup''' provides information on setting up a character sheet for use with AttackMaster.  The handout '''Weapon & Armour Database Help'' provides information on the databases that come with the API, and how to add to and change them.
+
<pre>--spellmenu [token_id]|[MU/PR/POWER]</pre>
 
+
<p>Takes an optional token ID and an optional menu type as arguments. If token ID is not specified, uses the selected token.</p>
== Script Use ==
+
<table>
After installing the script, refer the the handout '''AttackMaster Help''' for full information on use.  Below is a copy of the contents of that handout.
+
<tr><th scope="row">MU:</th><td>displays buttons for Magic User/Wizard spells for casting, resting (short or long), memorising spells from the character's spell book, or viewing the memorised spells.</td></tr>
 
+
<tr><th scope="row">PR:</th><td>displays buttons for Priest spells for casting, resting (short or long), memorising spells from the character's spell book, or viewing the memorised spells.</td></tr>
=Command Index=
+
<tr><th scope="row">POWER:</th><td>displays buttons for using powers, doing a long rest, changing/resetting powers from the character's granted powers, or viewing the granted powers.</td></tr>
==Menus==
+
<tr><th scope="row">None of the above:</th><td>the system will check the class(es) of the character and display the appropriate menu, or if a multi-class character including both a Wizard and a Priest, ask if the player wants to display Magic User or Priest menus.</td></tr>
<pre>--menu [token_id]
+
</table>
--other-menu [token_id]</pre>
+
<p>If the specified token is not associated with a character that has a spell book of the chosen type, or any granted powers, an error message is displayed.</p>
==Attacking commands==
+
===Display a menu to memorise spells from the Character's spell book===
<pre>--attk-hit [token_id] | [message] | [monster weap1] | [monster weap2] | [monster weap3]
+
<pre>--mem-spell (MU/PR/POWER/MI-MU/MI-PR)|[token_id]</pre>
--attk-roll [token_id] | [message] | [monster weap1] | [monster weap2] | [monster weap3]
+
<p>Takes a mandatory spell book type and an optional token ID as arguments. If token ID is not specified, uses the selected token.</p>
--attk-target [token_id] | [message] | [monster weap1] | [monster weap2] | [monster weap3]
+
<p>The Character Sheet associated with the token must have spell books specified for the relevant types of spells or powers.  These are lists of spells from the spell macro databases (see Section 7) specified by level (powers are all 1 level) and as lists separated by '|'.  E.g. Charm-Person|Light|Sleep.  If the CommandMaster API is installed, the GM can use its menus to set up character spell books and granted powers.</p>
--twoswords [token_id]|[prime-weapon]</pre>
+
<p>Initially displays a menu for memorising Level 1 spells (the only level for powers), with a button to choose a spell from the Level 1 spell book on the character sheet, Review the chosen spell, and all the memorising slots the Character has at this level.  Other buttons to memorise or remove spells become available when spells or slots are chosen.  Another button goes to the next available level with slots.  When a granted power is memorised to a slot, a quantity per day can be specified: -1 will grant unlimited uses of the power per day.  Memorising any other type of spell is limited to 1 use per slot.</p>
==Weapon Management==
+
<p>MI-MU and MI-PR have a special function: these are used to cast memorised spells into a spell-storing magic item (which should be the last item selected by the Character running the command), such as a Ring of Spell Storing.  Magic Item spells are stored in an unused level of the Character Sheet.  This command displays both all memorised spells and all spell-storing magic item spell slots, and allows a memorised spell to be selected, a slot (for the same spell name) to be selected, and the spell cast from one to the other.</p>
<pre>--weapon [token_id]
+
===View the memorised spells or granted powers===
--dance [token_id] | weapon  | [ STOP ]
+
<pre>--view-spell (MU/PR/POWER/MI-MU/MI-PR/MI-POWER)|[token_id]</pre>
--mod-weapon [token_id] | weapon | MELEE / RANGED / DMG / AMMO | adjustments
+
<p>Takes a mandatory spell type and an optional token ID. If token ID is not specified, uses the selected token.</p>
--quiet-modweap [token_id] | weapon | MELEE / RANGED / DMG / AMMO | adjustments
+
<p>Displays a menu of all levels of memorised spells of the selected type (there is only 1 level of powers).  Spells that have already been cast appear as greyed out buttons, and can't be selected.  Spells that are still available to cast that day can be selected and this runs the spell or power macro from the relevant database without consuming the spell, so that the Player can see the specs.</p>
--edit-weapons [token_id]</pre>
+
<p>Adding MI- before any of the types of spell views the spells or powers available for the last Magic Item used by the Character using the command.  Generally this version of the command is only called from API Buttons from the magic item's ability macro.</p>
==Ammunition Management==
+
===Cast a memorised spell or use a granted power===
<pre>--ammo [token_id]
+
<pre>--cast-spell (MU/PR/POWER/MI)|[token_id]|[casting_level]|[casting_name]|[CHARGED]</pre>
--setammo [token_id] | ammo_name | [ [+/-]cur_qty / = ] | [ [+/-]max_qty / = ] | [ SILENT ]</pre>
+
<p>Takes a mandatory spell type, an optional token ID (if not specified, uses the selected token), an optional casting level, and an optional caster name, and an optional 'CHARGED' command.</p>
==Armour Class and Saving Throws==
+
<p>This displays a menu of all levels of the memorised spells/powers of the relevant type.  MI displays the spell book for all stored spells (both MU & PR), and MI-POWER all stored powers in the last selected magic item, (this version of the command is generally called using an API Button in the magic item ability macro).  The player can select a spell/power and then a button becomes available to cast it, using up that slot/deducting a power charge until the next long rest.</p>
<pre>--edit-armour [token_id]
+
<p>If a casting_level is specified, the spell will be cast as if by a caster of that level, and if a casting_name is specified, that name will be displayed in the spell macro information.  These functions are often used for magic items that cast at specific levels of use, or magic artefacts that are named and/or sentient.  If these are not specified, the caster name and relevant class level are used.  In either case, specified or not, the character's Character Sheet Attributes called @{Casting-name} and @{Casting-level} are set to the values used, and can be used in spell, power, or magic item macros.</p>
--checkac [token_id] | [ SILENT ] | [SADJ / PADJ / BADJ]
+
<p>If the optional CHARGED parameter is specified (only relevant to spells and powers stored on magic items), this specifies that the Magic Item from which the spell or power is cast is charged, and looses one charge when that cast is made.  This is generally the case when the spell or power is on a Scroll.  When the charge quantity reaches zero, the item will follow the behaviour determined by its charge type (charged, uncharged, rechargeable, recharging, self-charging) - see section 4.1 for more information on charges and charge types.</p>
--save [token_id] | [situation-mod]</pre>
+
===Cast the last used spell or power again===
==Other Commands==
+
<pre>--cast-again (MU/PR/POWER)|token_id|[spell_name]</pre>
<pre>--help
+
<p>Takes a mandatory spell type, a mandatory token ID and an optional spell name.</p>
--check-db [ db-name ]
+
<p>This command is used for certain spells and powers that, once cast, allow continuing effects in the same or subsequent rounds, without using additional charges.  If the optional spell name is not used, the command just casts again the same spell as the last spell cast by the character associated with the selected token, at the same casting level and casting name.  If a spell name is specified, this spell is cast instead as if it were the same spell: this is used where different spell macros are required to specify subsequent spell effects.</p>
--handshake from | [cmd]
+
--hsq from | [cmd]
+
--hsr from | [cmd] | [TRUE/FALSE]
+
--debug [ ON / OFF ]</pre>
+
==7. How To Use AttackMaster==
+
<pre>Specifying a token
+
Who can make AttackMaster API command calls
+
Weapons that can be used
+
Allocating weapons to a Character
+
Selecting weapons to attack with
+
Making attacks
+
Ammunition
+
Ranged weapon and ammunition ranges
+
Dancing weapons
+
Armour Class management
+
Saves</pre>
+
 
<br>
 
<br>
==Configuring the Token and Character Sheet for use==
+
==2. Magic Item management==
==Character Sheet data fields==
+
===Display a menu of possible Magic Item actions===
 +
<pre>--mimenu [token_id]</pre>
 +
<p>Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.</p>
 +
<p>Displays a menu with the following actions: Use a magic item, Search for magic items & treasure, Store magic items in a container, Edit the contents of a character's magic item bag, and View the contents of a character's magic item bag.</p>
 +
<p>Searching & Storing are explained in section 4.</p>
 +
===Edit a Magic Item bag===
 +
<pre>--edit-mi [token_id]</pre>
 +
<p>Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.</p>
 +
<p>Displays a menu similar to editing memorised spells.  At the top are buttons to choose different types of magic items which have macros in the magic item databases.  The slots available in the bag are shown (with their current contents) and, when magic items and/or slots are chosen buttons become selectable below to store, review, or remove magic items in/from the bag.</p>
 +
<p>Storing a magic item will ask for a number - either a quantity or a number of charges.  Magic Items can be of various types: Charged (is used up when reaches 0), Uncharged (a number is a pure quantity that is not consumed), Recharging (regains charges after each long rest), Rechargable (is not used up when reaches 0, stays in bag and can be recharged when the DM allows), Self-charging (recharge at a rate per round determined by the item) and can also be Cursed - more under section 4.</p>
 +
<p>This menu is generally used when Magic Item & treasure containers (such as Treasure Chests and NPCs/monsters with treasure) have not been set up in a campaign as lootable as a means of giving found magic items to characters, and the DM just tells the Player that they have found a magic item.</p>
 +
===View a character's Magic Item Bag===
 +
<pre>--view-mi [token_id]</pre>
 +
<p>Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.</p>
 +
<p>Displays a menu of items in the character's magic item bag, with the quantity possessed or the number of charges.  Pressing a button displays the named Magic Item specs without using any charges so that the Player can review the specifications of that item.  Items for which all charges have been consumed are greyed out, and cannot be viewed as the character can no longer use them.  They will become viewable again if they gain charges.</p>
 +
===Use a Magic Item from the bag===
 +
<pre>--use-mi [token_id]</pre>
 +
<p>Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.</p>
 +
<p>Displays a similar menu as for viewing the contents of the Magic Item Bag, but when an item is selected, a button is enabled that uses the Magic Item and consumes a charge.  Other buttons specified in the item macro might use additional charges to perform additional effects.  See section 3.</p>
 +
<p>Items with 0 quantity or charges left are greyed out, and cannot be selected.  When a Charged Item reaches 0 charges left, it is removed from the character's Magic Item Bag automatically.</p>
 +
===Add, set or deduct Magic Item charges===
 +
<pre>--mi-charges token_id|[+/-]value|[mi_name]|[maximum]</pre>
 +
<p>Takes a mandatory token ID, a mandatory value preceeded by an optional + or -, and an optional magic item name and optional maximum value as arguments.</p>
 +
<p>Does not display anything but alters the number of current or recoverable charges on an item.  By default, alters the last magic item used by the character, or will affect the named magic item.  Warning: a character can have two items of the same name, and there is no guarantee which will be affected if the name is used.</p>
 +
<p>Remember: using a Charged, Recharging, Rechargeable or Self-Charging Magic Item will automatically use 1 charge on use.  This command is not required in order for that to happen.  In addition, that one charge deduction always happens - if an effect of a Magic Item uses 2 charges, only 1 more needs to be deducted.</p>
 +
<p><b>Note:</b> '-' reduces <i>current</i> remaining charges, '+' adds to the <i>maximum</i> recoverable charges, and no + or - sets the <i>maximum</i> recoverable charges.  This command <b><i>cannot</i></b> be used to increase the current remaining charges.</p>
 +
<p>Using minus '-' before the value will deduct charges from the current quantity/charges: e.g. if using an optional power of the item that uses more than 1 charge.  Using + before the value will add the value to the number of recoverable charges (either overnight or rechargeable), up to any specified maximum (often used for magic items that regain variable numbers of charges overnight).  Just using the value without + or - will just set the number of recoverable charges to the given value.  This command is not required to recharge self-charging items but can be used to change the maximum number of charges they will self-charge up to.</p>
 +
===Use a Magic Item power===
 +
<pre>--mi-power token_id|power_name|mi_name|[casting-level]</pre>
 +
<p>Takes a mandatory token ID, mandatory power name, mandatory magic item name, and an optional casting level as parameters.</p>
 +
<p>Magic Items, especially artefacts, can have their own powers that can be used a specified number of times a day, or at will.  This command can be used in API buttons in the Magic Item macro to call on that power.  The power name and the magic item name must be specified to select the right power.  If a casting level is specified, any relevant impacts on use of the power will be taken into account: it is often the case that magic items use powers at specific levels. If not specified, the item using Character's level is used (user does not need to be a spell caster).</p>
 +
<p>Generally, magic item powers have unique names, though they do not have to.  Such magic items require specific setting up by the DM - see later sections.</p>
 +
===Store spells in a spell-storing Magic Item===
 +
<pre>--mem-spell (MI-MU/MI-PR)|[token_id]</pre>
 +
<p>Takes a mandatory spell type, an optional Token ID for the character, and an optional magic item name.  If token ID is not provided, it uses the selected token.  If the magic item name is not provided, uses the last magic item selected, viewed or used by the character represented by the token.</p>
 +
<p>MI-MU and MI-PR mem-spell types are used to cast memorised spells into a spell-storing magic item, such as a Ring of Spell Storing.  Magic Item spells are stored in an unused spell level of the Character Sheet (by default Wizard Level 15 spells).  This command displays both all the character's memorised spells and the spell-storing magic item spell slots in the last magic item selected by the Character, and allows a memorised spell to be selected, a slot (for the same spell name - limiting the item to only store certain defined spells) to be selected, and the spell cast from one to the other.</p>
 +
<p>Unlike some other menus, however, magic item spell slots that are full are greyed out and not selectable - their spell is intact and does not need replacing.  Spell slots that need replenishing are displayed as selectable buttons with the spell name that needs to be cast into the slot.</p>
 +
<p>The level of the caster at the time of casting the spell into the magic item is stored in the magic item individually for each spell - when it is subsequently cast from the spell-storing magic item it is cast as if by the same level caster who stored it.</p>
 +
<p>A spell-storing magic item can hold spells from one or both of Wizard and Priest spells.  The database where the spell is defined is also stored in the magic item with the spell, so the correct one is used when at some point in the future it is cast.  If, when cast, the system can't find the database or the spell in that database (perhaps the character has been moved to a different campaign with different databases) the system will search all databases for a spell with the same name - this does not guarantee that the same spell will be found: the definition used by a different DM could be different - or the DM may not have loaded the database in question into the campaign for some reason.  In this case, an error will occur when the spell is cast.</p>
 +
<p>See Section 8.3 for how spell-storing magic items are defined.</p>
 +
===Casting a spell from a spell-storing magic item===
 +
<pre>--cast-spell MI|[token_id]|[casting_level]|[casting_name]|[CHARGED]|[mi-name]</pre>
 +
<p>Takes a mandatory casting type of 'MI', an optional Token ID (if token ID is not provided, it uses the selected token), an optional casting level (which will be ignored in favour of the level of the caster of the spell who cast it into the item), an optional casting name which, if not specified, will be the name of the wielder of the magic item, and an optional magic item name (if not provided, uses name of the last magic item the character selected, viewed or used).</p>
 +
<p>This command works in the same way as for casting other spells.  However, spells cast from a spell-storing magic item are not regained by resting - either short or long rests.  The only way to regain spells cast from such an item is to cast them back into the item from the character's own memorised spells: see the -mem-spell command above.  If the character does not have these spells in their spell book or is not of a level able to memorise them, then they will not be able to replace the spells and will have to get another spell caster to cast them into the item (by giving the item to the other Character and asking nicely for it back again) or wait until they can get the spells.</p>
 +
<p>If the optional parameter <i>'CHARGED'</i> is used, spells on the magic item are not re-storable.  The spells will be deleted after they are all used up and the magic item will not be able to store any more spells.  This is mainly used for Scrolls with multiple spells.</p>
 
<br>
 
<br>
 +
==Spell, power & magic item effects and resting==
 +
<p>If this API is used in conjunction with the RoundMaster API, Magic Items, Spells & Powers can all place status markers on tokens, and also cause real Effects to alter token & character sheet attributes and behaviours: when cast; during each round of their duration; and when they expire.  See the RoundMaster documentation for further information, especially on Effects and the Effects Database.</p>
 +
===Target spell effects on a token (with RoundMaster API only)===
 +
<pre>!rounds --target CASTER|token_id|spell_name|duration|[+/-]increment|[msg]|[marker]<br>
 +
!rounds --target (SINGLE/AREA)|token_id|target_token_id|spell_name|duration|increment|[msg]|[marker]</pre>
 +
<p>Takes mandatory CASTER, SINGLE or AREA command, a mandatory caster token ID, for SINGLE/AREA a mandatory target token ID, mandatory spell name, duration & increment (preceeded by an optional +/-), and an optional message and optional token marker name.</p>
 +
<p>If using the RoundMaster API, this command targets one, or a sequential set of tokens and applies a token marker to the token for the specified duration number of rounds, with the increment applied each round.  The optional message will be shown below that token's turn announcement each round.  The marker used will either be the one specified or if not specified a menu to choose one will be shown.</p>
 +
<table>
 +
<tr><th scope="row">CASTER</th><td>will just take one Token ID and apply the marker to that token.</td></tr>
 +
<tr><th scope="row">SINGLE</th><td>will take both the Token ID of the caster, and the Token ID of a target of the spell/power/MI.  The marker will be applied to that of the target.</td></tr>
 +
<tr><th scope="row">AREA</th><td>will take the Token ID of the caster, and one Token ID of the first token in the area of effect.  As each token is specified the command will ask the Player to select subsequent tokens in the area of effect.</td></tr>
 +
</table>
 +
<p>If the Player is not the DM/GM, the system will ask the DM/GM to approve the marker/effect for each token - this allows the DM to make saving throws for monsters/NPCs affected where appropriate.</p>
 +
<p>See the RoundMaster API documentation for full details.</p>
 +
===Cast a spell that requires a “touch” attack roll===
 +
<pre>--touch token_id|effect-name|duration|per-round|[message]|[marker]</pre>
 +
<p>Takes mandatory token ID, effect name, duration of the effect, an increment to the duration per round (often -1), an optional message each round for the targeted token, and an optional status marker to use (if not supplied, the DM or user will be asked to select one).</p>
 +
<p>Note: this command requires RoundMaster API to also be loaded, but is a !magic command.</p>
 +
<p>Sets up the Character represented by the specified token ready for an “Attack Roll” to deliver a touch attack for a spell or power or magic item use that requires an attack.  The parameters are those that will be passed to the !rounds -target command if the attack is successful (see above).</p>
 +
<p>To use this command, add it as part of a spell, power or MI macro in the appropriate database, before or after the body of the macro text (it does not matter which, as long as it is on a separate line in the macro - the Player will not see the command).  Then include in the macro (in a place the Player will see it and be able to click it) an API Button call [Button name](~Selected|To-Hit-Spell) which will run the Ability “To-Hit-Spell” on the Character's sheet (which has just been newly written there or updated by the -touch command).</p>
 +
<p>Thus, when the Player casts the Character's spell, power or MI, they can then press the API Button when the macro runs and the attack roll will be made.  If successful, the Player can then use the button that appears to mark the target token and apply the spell effect to the target.</p>
 +
<p>See the RoundMaster API documentation for further information on targeting, marking and effects.</p>
 +
===Perform Short or Long Rests===
 +
<pre>--rest [token_id]|[SHORT/LONG]|[MU/PR/MU-PR/POWER/MI/MI-POWER]|[timescale]</pre>
 +
<p>Takes an optional token ID (if not specified, uses the selected token), an optional rest type, short or long, an optional magic type to regain charges for, and an optional timescale for days passing.</p>
 +
<p>Most magic requires the character to rest periodically to study spell books, rememorise spells, and regain powers and charges of magic items.  This command implements both Short and Long rests.</p>
 +
<p>The type of rest (short or long) can be specified or, if not specified, the system will ask the Player what type of rest is to be undertaken - though Long Rests will be disabled if the Timescale (either the optional value or the character sheet attribute) is not 1 or more days (see below).  The type of magic to be affected can also be specified or, if not specified, all types of magic are affected.</p>
 +
<p>A Short rest is deemed to be for 1 hour (though this is not a restriction of the system and is up to the DM), and allows spell casters (such as Wizards and Priests, as well as others) to regain their 1st level spells only.  This can happen as often as the DM allows.</p>
 +
<p>A Long rest is considered to be an overnight activity of at least 8 hours (though again this is not a restriction of the system and is up to the DM).  A Long rest allows spell casters to regain all their spells, all character and magic item powers to be regained to full uses per day, and for recharging magic items to regain their charges up to their current maximum.  After a long rest, ammunition that has been used but not recovered can no longer be recovered using the Ammunition Management command (see AttackMaster API documentation): it is assumed that other creatures will have found the ammo, or it has been broken or otherwise lost in the 8 hours of the long rest.</p>
 +
<p>A Long rest can only be undertaken if certain conditions are met: either the optional Timescale (in days) must be specified as 1 or more days, or the Character Sheet must have a Roll20 attribute called Timescale, current, set to a value of 1 or more (can be set by <b>InitiativeMaster API --end-of-day</b> command).  An internal date system is incremented: an attribute on the Character Sheet called In-Game-Day is incremented by the Timescale, and Timescale is then set to 0.</p>
 +
<p>If the <b>InitMaster API</b> is being used, the system will interact with the “End of Day” command to allow rests to be coordinated with the choice of accommodation (and its cost…!).</p>
 
<br>
 
<br>
=Command Details=
+
==Treasure & Item container management==
==Menus==
+
===DM/GM version of Magic Item management===
===Display a menu to do actions relating to attacks===
+
<pre>--gm-edit-mi [token_id]</pre>
<pre>--menu [token_id]</pre>
+
<p>Takes an optional token ID. If token ID is not specified, uses the selected token.</p>
<p>Takes an optional token ID – if not specified uses selected token</p>
+
<p>This command opens a menu showing all the items in the Backpack of the character sheet associated with the specified tokenUnlike the Player version of the command (--edit-mi), this command shows all attributes of every magic item, including those of hidden and cursed items, and also offers an additional list of “DM Only” magic items from the magic item databases.</p>
<p>Displays a Chat menu with buttons for: Attacking, with either Roll20 rolling a dice, or the Player entering a dice roll result; changing what is in the Character’s (or NPC’s) hands; to recover spent ammo; and to check the current Armour Class for the Character under various circumstances.  If the GM uses the menu, an additional button for a Targeted Hit appears, which allows the GM to select both the attacker and the target and get full specs on the hit and damage done, and the AC & current hit Points of the target.</p>
+
<p>The following functions are available once both a magic item is selected from the lists, and a slot to store it in are selected:</p>
===Display a menu of other actions===
+
<pre>--other-menu [token_id]</pre>
+
<p>Takes an optional token ID – if not specified uses selected token</p>
+
<p>Displays a Chat menu with buttons for: saving throws and saving throw management; and managing light sources for the character’s token (if Dynamic Lighting is being used) (requires <b>MagicMaster API</b> to work). If the GM uses the menu, two further options appear: mark the token selected as Dead (which also marks the body as an inanimate object that can be looted); and the ability to adjust damage for the selected token for any arbitrary reason, which can also be noted.</p>
+
==Attacking Commands==
+
===Attack an opponent with a weapon===
+
<pre>--attk-hit [token_id] | [message] | [monster weap1] | [monster weap2] | [monster weap3]
+
--attk-roll [token_id] | [message] | [monster weap1] | [monster weap2] | [monster weap3]
+
--attk-target [token_id] | [message] | [monster weap1] | [monster weap2] | [monster weap3]</pre>
+
<p>Each takes an optional token ID (if not specified uses selected token), an optional formatted message to include with the attack damage, and up to three optional names for each of the monster attacks that are displayed on the attack menu.</p>
+
<p>Each of these three commands present a menu of currently possible attacks, using the weapons and ammo in-hand or, for monsters using the Monster tab on the AD&D 2e Character Sheet, up to 3 types of monster attacksRanged weapon attacks will prompt the Player to specify which range to fire at. Selecting one of the possible attacks has different outcomes based on the command used:</p>
+
<dl><dt>--attk-hit</dt><dd>prompts Roll20 to make an attack roll, using 3D dice if they are enabled, displays the AC hit with supporting information on how this was calculated and displays buttons to roll for damage if the attack is successful.</dd>
+
<dt>--attk-roll</dt><dd>displays an entry field to allow the Player to enter the value of their own dice roll (for those that prefer to roll their own dice) though the default entry will also roll the dice for the player.  Subsequently, the process is the same as --attk-hit.</dd>
+
<dt>--attk-target</dt><dd>is only available to the GM.  It asks the GM to select a target token for the attack.  It then displays the AC the attack roll will hit and the AC of the selected target.  It also automatically rolls damage for Small/Medium and Large targets, and displays the current Hit Points for the targeted token.</dd></dl>
+
<p>The optional message is displayed as part of the display of the damage done on a successful hit.  If a monster, the message can be three concatenated messages separated by ‘$$’.  The message can include API Buttons if needed.  The following characters must be replaced (escaped) using these replacements:</p>
+
 
<table>
 
<table>
<tr><th scope="row">Character</th><td>?</td><td>[</td><td>]</td><td>@</td><td>-</td><td>|</td><td>:</td><td>&</td><td>{</td><td>}</td></tr>
+
<tr><th scope="row">Store item:</th><td>Select a magic item from the databases and store it in a slot - this is the same as the Player version.</td></tr>
<tr><th scope="row">Substitute</th><td>^</td><td>&lt;&lt;</td><td>&gt;&gt;</td><td>`</td><td>~</td><td>¦</td><td> </td><td>&amp;amp;</td><td>&amp;#123;</td><td>&amp;#125;</td></tr>
+
<tr><th scope="row">Hide item as different item:</th><td>The magic item already in the selected bag slot is given the displayed name of the magic item selected from the databases - the Player will only see the Magic Item selected (Displayed Name), and not the hidden actual name.  The MI will behave exactly like the selected, displayed item until the DM reverts the item to the hidden version using the [Reset Single MI] button.  This is generally used for Cursed items in containers, so that the real nature of the item is hidden until the character discovers the curse.</td></tr>
<tr><th scope="row">Alternative</th><td>\\ques</td><td>\\lbrak</td><td>\\rbrak</td><td>\\at</td><td>\\dash</td><td>\\vbar</td><td>\\clon</td><td>\\amp</td><td>\\lbrc</td><td>\\rbrc</td></tr>
+
<tr><th scope="row">Remove MI:</th><td>Blanks the selected Bag slot, removing all details, both displayed & actual.</td></tr>
 +
<tr><th scope="row">Change MI Type:</th><td>This allows the type of the item in the selected Bag slot to be changed.  It can be one of the following - Charged, Uncharged, Recharging, Rechargeable, Self-chargeable, Cursed, Cursed-Charged, Cursed-Self-chargeable, Cursed-Recharging (cursed rechargeable items behave in exactly the same way as Cursed-Charged items).  Cursed versions of items cannot be removed from the character's MI Bag, given away, stored or deleted by the Player, even when all their charges are depleted.  Otherwise, they act in the same way as other magic items.</td></tr>
 +
<tr><th scope="row">Change Displayed Charges:</th><td>Changes the number of displayed/current charges for the item in the selected Bag slot.  This can be used to set the quantity of Uncharged items, or the current charges of other types.  It also allows charged items in containers to be stored as a single item, for instance single Wands with multiple charges - see the  pickorput command below.</td></tr>
 +
<tr><th scope="row">Change Actual Charges:</th><td>Setting this allows the actual quantity of Uncharged items in containers to be hidden, or the maximum number of charges to be set for other types.  When the item is picked up from a container, the actual number of charges will be set as the current value.</td></tr>
 +
<tr><th scope="row">Change Item Cost:</th><td>Items can have a cost in GP (fractions allowed which get converted to SP & CP).  When an item is picked up from a container, the cost will be multiplied by the quantity picked up and the Player will be asked if they want the character to pay the cost.  If confirmed, the cost will be deducted from the money values on the character sheet.  0 and negative values are allowed.  This supports merchants and shops to be created in the campaign.</td></tr>
 +
<tr><th scope="row">Reset Single MI:</th><td>Allows the DM to reset the item in the selected Bag slot to the actual values, revealing any hidden name, and resetting the displayed quantity to be the actual quantity.  From that point on, the item will behave as the revealed item.  This is mostly used to reveal cursed items.</td></tr>
 +
<tr><th scope="row">Edit Treasure:</th><td>Mainly for use on Magic Item containers, such as Treasure Chests, but also useful for NPCs and Monsters.  Allows the DM to add text only treasure descriptions to the container.  The displayed menu allows [Add], [Edit], and [Delete] functions to manage multiple lines/rows of treasure description.</td></tr>
 +
<tr><th scope="row">Container Type:</th><td>Sets the type of the Magic Item container or Bag.  Available choices are: Empty Inanimate object, Inanimate object with stuff, Sentient Being with empty Bag, Sentient Being with items, Trapped container. If searched,  Inanimate objects can be looted without penalty;  Sentient beings require a Pick Pockets check; Trapped containers call a Trap ability macro on the container's character sheet to determine the effect.  See -search command below.</td></tr>
 +
<tr><th scope="row">Container Size:</th><td>Sets the maximum number of items that can be stored in the selected Character's/containers bag.  The default is 18 items, though identical items can be stacked.</td></tr>
 
</table>
 
</table>
 +
===Search tokens for Magic Items and Treasure===
 +
<pre>--search token_id|pick_id|put_id</pre>
 +
<p>Takes a mandatory token ID, mandatory token ID of the token to search and pick up items from, mandatory token ID of the token to put picked up items in.</p>
 +
<p>This command can be used to pick the pockets of an NPC or even another Player Character, as well as to loot magic item and treasure containers such as Chests and dead bodies.  It can also be used for putting stuff away, storing items from the character's Magic Item Bag into a container, for instance if the MI Bag is getting too full (it is limited to the number of items specified via the --gm-edit-mi menu, though similar items can be stacked). The effect of this command when looting (i.e. the Character's token_id is also the put_id) depends on the Container Type of the searched token set by the DM using the -gm-edit-mi command menu:</p>
 +
<table>
 +
<tr><th scope="row">Inanimate without items:</th><td>a message is shown to the Player saying the container is empty or, if there are no Magic Items but there is text describing contained treasure, this will be displayed.</td></tr>
 +
<tr><th scope="row">Inanimate with items:</th><td>the items in the container are displayed, and the character doing the search (associated with the put_id token ID) can pick them up and store them in their own Magic Item Bag.</td></tr>
 +
<tr><th scope="row">Sentient being without items:</th><td>a Pick Pockets check is undertaken - the Player is asked to roll a dice and enter the result (or Roll20 can do it for them), which is compared to the Pick Pockets score on their character sheet.  If successful, a message is displayed in the same way as an Inanimate object.  If unsuccessful, a further check is made against the level of the being targeted to see if they notice, and the DM is informed either way.  The DM can then take whatever action they believe is needed.</td></tr>
 +
<tr><th scope="row">Sentient being with items:</th><td>the Pick Pockets check is done the same way as above, but if successful, the items in the target's Magic Item Bag are displayed and the Player can pick them up and store them in their character's Magic Item Bag.</td></tr>
 +
<tr><th scope="row">Trapped container:</th><td>Traps can be as simple or as complex as the DM desires.  Traps may be nothing more than a lock that requires a Player to say they have a specific key, or a combination that has to be chosen from a list, and nothing happens if it is wrong other than the items in the container not being displayed.  Or setting it off can have damaging consequences for the character searching or the whole party.  It can just be a /whisper gm message to let the DM know that the trapped container has been searched.  Searching a trapped container with this command calls an ability macro called “Trap-@{container_name|version}” on the container's character sheet: if this does not exist, it calls an ability macro just called “Trap”.  The first version allows the Trap macro to change the behaviour on subsequent calls to the Trap functionality (if using the ChatSetAttr API to change the version attribute), for instance to allow the chest to open normally once the trap has been defused or expended.  This functionality requires confidence in Roll20 macro programming.<br><b>Important Note:</b> all Character Sheets representing Trapped containers <b><u><i>must</i></u></b> have their <i>'ControlledBy'</i> value (found under the [Edit] button at the top right of each sheet) set to <i>'All Players'</i>.  Otherwise, Players will not be able to run the macros contained in them that operate the trap!</td></tr>
 +
</table>
 +
===Looting without searching, and storing items in a container===
 +
<pre>--pickorput token_id|pick_id|put_id|[SHORT/LONG]</pre>
 +
<p>Takes a mandatory token ID for the Player's character, a mandatory token ID for the token to pick items from, a mandatory token ID for the token to put items in to, and an optional argument specifying whether to use a long or a short menu.</p>
 +
<p>This command displays a menu from which items in the Backpack Bag on the character sheet associated with the Pick token can be selected to put in the Bag of the character sheet associated with the Put token.  The Player's character's token can be either the Put token (if picking up items from a container) or the Pick token (if storing items from their Bag into the container).  The other token can be another Player Character (useful for one character giving a magic item to another character) or any other selectable token with a character sheet.  No traps or sentient being checks are made by this command - this allows the DM to allow Players to bypass the searching functionality when looting a container or storing items in it.  Note: the Player's Magic Item menu (accessed via the -mimenu command) does not have an option to loot without searching, but the Store function on that menu does not use Search.</p>
 +
<p>There are two forms of this menu - the Long form displays all items in the container as individual buttons for the Player to select from, and a single button to store the item: this is generally OK when looting containers with not much in them.  The Short form of the menu shows only two buttons: one button which, when clicked, brings up a pick list of all the items in the Pick container, and another button to store the item in the Put container: this is generally best for when a character is storing something from their MI Bag into a chest or other container, or giving an MI to another character, as a character's MI Bag often has many items in it which can make a Long menu very long.  Each type of menu has a button on it to switch to the other type of menu without re-issuing the command.  If not specified in the command, the type of menu the Player last used in this campaign is remembered and used by the system.</p>
 
<br>
 
<br>
===Use two weapons to attack===
+
==Light source management==
<pre>--twoswords [token_id]|[prime-weapon]</pre>
+
<p>These functions use Roll20 Dynamic Lighting to provide a token with a light sourceIf your campaign does not use Dynamic Lighting, they will not functionThey can also be accessed through the menu displayed by the AttackMaster API -other-menu command.</p>
<p>Takes an optional token ID (if not specified uses selected token) and an optional weapon name.</p>
+
===Show a menu of Light Sources to select from===
<p>This command sets the system up to apply the correct penalties / bonuses when using two weapons to attack.  Under AD&D 2e rules, only types of Fighter & Rogue can use 2 weapons at a time to attack in a round, and only Rangers do so without penalty.  Using this command with the name of a <i>prime-weapon</i> specified will mark that weapon as the Primary which will get the smaller penalty of the two and will also be allowed multiple attacks per round (if using <b>InitiativeMaster API</b>)Use of any other weapon during the current or subsequent rounds will incur a larger penalty and be restricted to one attack per round regardless of type of weapon, level & proficiency.  Penalties are adjusted by the Dexterity Reaction Adjustment.  See AD&D 2e PHB p96 for full explanation of rules applied.</p>
+
<pre>--lightsources [token_id]</pre>
<p>Calling this command without a prime-weapon specified will terminate two-weapon mode and no penalties will be applied for the current and subsequent rounds.</p>
+
<p>Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.</p>
<br>
+
<p>This command brings up a menu showing a selection of various light sources that a character can useSelecting one will change the Roll20 Dynamic Lighting values on the Token identified to provide this lighting effectThese are:</p>
==Weapon Management==
+
<ul>
===Change weapons currently in hand===
+
<li>Magic Weapon or Magical Armour (5ft radius circle),</li>
<pre>--weapon [token_id]</pre>
+
<li>Torch (15ft radius circle),</li>
<p>Takes an optional token ID – if not specified uses selected token.</p>
+
<li>Hooded Lantern (30ft radius circle),</li>
<p>This command displays a chat menu displaying what is currently in the Character’s (or NPC or creature’s) hands, and allowing the Player to change what is held to any weapon or shield that they have in their backpack.  Subsequent attacks will then use the newly specified weapon(s)Selecting a ranged weapon that uses ammunition, the appropriate ammunition held in their backpack is also loaded into the character’s “quiver”.</p>
+
<li>Continual Light lantern (60ft radius circle),</li>
<p>Selecting a hand (either Left or Right) will display any 1-handed weapons that can be used for selection in a list.  Selecting the Both Hands button will display all the 2-handed weapons (including bows) that can be used for selection in a list.  Some weapons can be used either 1-handed or 2-handed, and the appropriate stats will be given based on the selection made.</p>
+
<li>Bullseye Lantern (cone of light, 20 degrees wide and 60ft long),</li>
<p>If being used by the GM, the menu also has an option to change the number of hands the creature has, which will then allow the creature to hold (and attack with) more than two items, or to hold items that require more than two hands.</p>
+
<li>Beacon Lantern (cone of light, 20 degrees wide and 240ft long).</li>
<p><b>Note:</b> this function is dependent on the weapon and shield definitions including certain key information in a specified format: see section 8 below.</p>
+
</ul>
===Manage a dancing weapon===
+
<p>The menu shows [ON] and [OFF] buttons for each type.  Only one type can be ON for each Token: selecting an ON button for any light source turns OFF the others for that TokenTurning the current light source off will turn off all lighting effects on the identified token.</p>
<pre>--dance [token_id] | weapon  | [ STOP ]</pre>
+
===Set a lightsource for a token===
<p>Takes an optional token ID (if not specified uses selected token), a mandatory weapon name, and an optional STOP command.</p>
+
<pre>--changelight token_id|(NONE/WEAPON/TORCH/HOODED/CONTLIGHT/BULLSEYE/BEACON)</pre>
<p>This command marks the named weapon as “dancing” which means it will no longer occupy a hand, but will still appear in the list of possible attacks when an attack is made.  When started, the --weapon command is automatically run so that an additional weapon can be taken in the freed-up hand.</p>
+
<p>Takes a mandatory token ID, and a mandatory type of light source.</p>
<p>Appending the “STOP” command will un-mark the weapon as dancing.  The Player will have to take the no-longer dancing weapon back in hand, if they so desire, using the --weapon command.</p>
+
<p>This command sets the light source type that the identified token is using, and changes the Roll20 Dynamic Lighting settings of the token to the relevant value shown under section 5.1, or turn off all lighting effects for the selected token if NONE is specified.</p>
<p><b>Note:</b> the most effective use of the --dance command is when combined with the RoundMaster effect management system, to count down rounds of use, automatically call the --dance command at the appropriate time, and stop the dancing automatically after the appropriate duration.</p>
+
===Manage weapon statistics===
+
<pre>--mod-weapon [token_id] | weapon | MELEE / RANGED / DMG / AMMO | adjustments
+
--quiet-modweap [token_id] | weapon | MELEE / RANGED / DMG / AMMO | adjustments</pre>
+
<p>Each command takes an optional token ID (if not specified uses selected token), a mandatory weapon name, and a mandatory data type.</p>
+
<p>These commands allow the specifications of any weapon currently in-hand to be adjusted programmatically.  E.g. the magical plus on to-hit and damage can be adjusted round by round (as for a Sword of Dancing.  The type of data to be adjusted must be identified using the data type parameter: MELEE & RANGED alter To-Hit data, and DMG & AMMO alter Damage.</p>
+
<p>The weapon parameter can name a specific weapon name, a type of weapon (e.g. bow, long-blade, club etc), a changed weapon name (previously changed by this command), or even ‘all’ for all currently held weapons.  All data of the specified data type for all weapons that match the weapon parameter may then be altered, using the comma-separated adjustments parameter.  Each adjustment is of the format <i><pre>field_id:[=][+/-]value</pre></i> where the field_ids are:</p>
+
<table><tr><td>w:</td><td>weapon name</td><td>t:</td><td>weapon type</td><td>st:</td><td>weapon super-type</td></tr>
+
<tr><td>sb:</td><td>strength bonus</td><td>db:</td><td>dexterity bonus</td><td>+:</td><td>magical plus</td></tr>
+
<tr><td>n:</td><td>number of attacks per round</td><td>pl:</td><td>proficiency level</td><td>pd:</td><td>dancing proficiency level</td></tr>
+
<tr><td>ch:</td><td>critical hit roll</td><td>cm:</td><td>critical miss roll</td><td>sz:</td><td>size</td></tr>
+
<tr><td>r:</td><td>range (can be #/#/#)</td><td>ty:</td><td>damage type</td><td>sp:</td><td>speed in segments</td></tr>
+
<tr><td>sm:</td><td>damage vs small & medium</td><td>l:</td><td>damage vs large</td></tr></table>
+
<br>
+
<p>Numeric values can be preceeded by + or -, which will adjust rather than replace the current value.  To set a value as negative, precede the minus by an equals thus =-value. For attributes that are relevant to multiple data types, only the specified data type will be adjusted.  Multiple attributes can be adjusted using one command call by concatenating comma-delimited adjustments. E.g. </p>
+
<pre>--mod-weap @{selected|token_id}|Sword-of-Dancing|MELEE|sb:0,+:+1,sp:-1</pre>
+
<p>If the weapon is not found, the GM receives an error message, but no other issues occur.</p>
+
===Adding & removing weapons and ammunition===
+
<pre>--edit-weapons [token_id]</pre>
+
<p>Takes an optional token ID – if not specified uses selected token.</p>
+
<p>The very best way for the Character, NPC or creature to acquire weapons (or any other items including magic items) is to use the <b>MagicMaster API</b> and its commands and databases.  However, AttackMaster provides a small subset of those facilities to allow the DM and/or Players to add weapons, ammo & armour to their Character Sheet item bags.  Once added, these items can be taken ‘in-hand’ by the Character (using the <b>--weapon</b> command) and then used to attack.</p>
+
<p>The advantage of doing this over just typing the item names into the Character Sheet tables is that the items are assured to exist in the weapon, ammo & armour databases that come with the API and so all other aspects of the API will work properly.</p>
+
<p>This command and <b>--edit-armour</b> are identical, and call the same menu.</p>
+
<br>
+
==Ammunition Management==
+
===Ammunition recovery===
+
<pre>--ammo [token_id]</pre>
+
<p>Takes an optional token ID – if not specified uses selected token.</p>
+
<p>This command displays a chat menu of ammunition that the Character has on their person (not just the ammo that they have in their quiver or in-hand) including any ammunition that has run-out but might still be recoverable.  The Player can ask the DM if they can retrieve any ammunition of the types displayed that they have recently used and, once the DM responds with the amount recovered, click on the type of ammunition in the list and enter the amount recoveredBoth the amount on their person, and any amount in their quiver or in-hand are updated.</p>
+
<p><b>Note:</b> enter the amount recovered <em>not</em> the new total.  The amount entered will be added to the current amount held, and then this new value set as the new maximumA negative amount can also be entered, which will be removed from the current quantity and will also set the new maximum.</p>
+
<p><b>Note:</b> after a Long Rest (see <b>MagicMaster API</b>) all ammunition maximum totals are set to current quantities at that time.  It is assumed that during the period of a long rest, some creature will have found any loose ammo, or it will otherwise have been broken or lost.</p>
+
<p><b>Note:</b> ammunition that has the item-type of <i>‘charged’</i> will appear on the menu with a grey box which cannot be selected, indicating that the ammo cannot be recovered – such ammunition always breaks on contact: e.g. glass arrows.</p>
+
===Ammunition quantity amendment===
+
<pre>--setammo [token_id] | ammo_name | [ [+/-]cur_qty / = ] | [ [+/-]max_qty / = ] | [ SILENT ]</pre>
+
<p>Takes an optional token ID (if not specified uses selected token), the unique name of the ammunition, an optional value for the current quantity, optionally preceded by +/- or replaced by an =, an optional value for the maximum quantity with the same +/- & = possibilities, and an optional parameter of “Silent” (case insensitive).</p>
+
<p>This command allows programmatic or macro alteration of the quantity of a type of ammo:</p>
+
<ul><li>The current quantity and/or the maximum held (i.e. the amount to which ammunition can be recovered up to – see section 4.1 Ammunition Recovery, above) can be set to absolute values just by entering numbers for the parameters.</li>
+
<li>Either parameter can be preceded by a + or -, in which case the parameter will modify the corresponding current value, rather than replacing it.</li>
+
<li>Either parameter can be an = by itself.  In this instance, the corresponding value is set to the other corresponding value (after any modification) i.e. putting = for cur_qty sets the current quantity held to be the maximum possible, or putting = for max_qty sets the maximum possible to be the current quantity.  Putting = for both does nothing.</li>
+
<li>No value can go below 0, and the current quantity will be constrained at or below the maximum quantity.</li></ul>
+
<p>So, for example, this command will set the maximum quantity to 10 and set the current quantity to be equal to it:</p>
+
<pre>!attk –setammo @{selected|token_id}|Flight-Arrow+1|=|10|silent</pre>
+
<p>If the “Silent” parameter is not specified, then the Ammunition Recovery chat menu will display with the amended values once complete, and a message is displayed with the changes that occurred.</p>
+
<p><b>Note:</b> if more than one ammo item of the same name is listed in the backpack table (see section 7 on Character Sheet Setup), only the first item found will be amended.  If no item of that name is found, nothing happens and no menus or messages are displayed.</p>
+
<br>
+
==Armour Class and Saving Throws==
+
===Edit Armour===
+
<pre>--edit-armour [token_id]
+
--edit-armor [token_id]</pre>
+
<p>Takes an optional token ID – if not specified uses selected token.</p>
+
<p>The very best way for the Character, NPC or creature to acquire armour (or any other items including magic items) is to use the <b>MagicMaster API</b> and its commands and databases.  However, AttackMaster provides a small subset of those facilities to allow the DM and/or Players to add weapons, ammo & armour to their Character Sheet item bags.  Once added, these items can be taken ‘in-hand’ by the Character (using the <b>--weapon</b> command), and improve the Armour Class of the Character appropriately.</p>
+
<p>The advantage of doing this over just typing the item names into the Character Sheet tables is that the items are assured to exist in the weapon, ammo & armour databases that come with the API and so all other aspects of the API will work properly (see section 5.2 below).</p>
+
<p>This command is identical to the <b>--edit-weapons</b> command and uses the same menu.</p>
+
===Review Armour Class===
+
<pre>--checkac [token_id] | [ SILENT ] | [SADJ / PADJ / BADJ]</pre>
+
<p>Takes an optional token ID (if not specified uses selected token), an optional “Silent” command, and an optional damage type which can be “SADJ”, “PADJ” or “BADJ” (the “Silent” and damage type parameters are not case sensitive).</p>
+
<p>This command analyses the items in the Character’s backpack table (see section 7 on Character Sheet Setup) using the information in the various item databases supplied / created by the API(s), and taking into account the current Dexterity bonuses calculates the current Armour Class of the CharacterIt then displays a chat message with its results and an explanation of how it came to them.  If the optional damage type is provided, the calculation takes this into account.</p>
+
<p>The system can use the information in the databases to take into account magical armour plusses, combined effects of armour that can work together (like Armour and Shields), exclude combinations that are not allowed (like Rings of Protection with magical armour), and the armour types allowed for various character classes and races including specialist variations.</p>
+
<p>The system automatically updates this information any time the Character changes what is in their hands (e.g. if they pick up or put down a shield) using the <b>--weapon</b> command.  If using the InitMaster API, the command is also run every time the character does an Initiative roll.  If using the MagicMaster API, the command is also run any time items are looted from a chest or NPC, or stored away or given to another character.</p>
+
<p>The system remembers on the Character Sheet what its calculations are each time.  If the most recent calculation results in a change in Armour Class for the character, the character’s token AC (if displayed) will be modified by the difference between the old and new valuesThis modified value will be shown on the Armour Class Review message in the chat window if it is different from the calculated value.</p>
+
<p><b>Note:</b> the token displayed AC is only modified by the difference between the previous and current calculations.  This allows magical and other effects (such as those managed by the RoundMaster API) to alter the token displayed AC and not be overwritten by a change in calculated AC, but still take into account the change.  The token AC can be manually updated at any time without impact on this functionality, to overcome any errors.</p>
+
<p><b>Note:</b> if the token is configured following the Master Series API standard (see CommandMaster API documentation), the token bar for the displayed AC is normally hidden.  if the calculated AC and token displayed AC are different (see above) then the AC token bar appears, representing the difference between the two.  This acts as a visual reminder to the DM and Player that the token is the subject of some effect on AC – it also helps to identify if there is a difference in error, so that this can be manually rectified (by manually altering the token displayed AC).  Once the two are again the same and the <b>–check-ac</b> command run, the token AC bar will again be hidden.</p>
+
===Saving Throws===
+
<pre>--save [token_id] | [ situation-mod ]
+
--save [token_id] | [ situation-mod ] | save-type | saving-throw</pre>
+
<p>Takes an optional token ID (if not specified uses selected token), and different forms of the command take an optional situational modifier to the saving throw, a type of save (which can be one of ‘paralysis’, ‘poison’, ‘death’, ‘rod’, ‘staff’, ‘wand’, ‘petrification’, ‘polymorph’, ‘breath’, or ‘spell’, not sensitive to case), and the base, unmodified saving throw achieved on a dice.</p>
+
<p>This command can either display a menu from which to display and manage the saving throw table, and make saving throws or, in its second form, to make a saving throw and check the result against the saving throw table.</p>
+
<p>The first form shows all the possible saves that can be made, the saving through that needs to be achieved to make the save, and any modifiers that apply to this particular character.  There are buttons to modify the saving throw table and the modifiers, and/or to apply a “situational modifier” to immediate saving throws (the “situational modifier” only applies to current rolls and is not remembered). Also, each type of saving throw can actually be made by clicking the buttons provided.  Doing so effectively runs the second form of the command.</p>
+
<p>The situational modifier can optionally be passed in as a value with the command call if so desired, instead of selecting via the button on the menu.</p>
+
<p>Running the second form of the command (or selecting to make a saving throw from the first form’s menu) will execute the saving throw (as a dice roll if this is specified instead of a straight value) of the specified type, using the data in the character’s saving throw table to assess success or failure, displaying the outcome and the calculation behind it in the chat window.</p>
+
 
<br>
 
<br>
 
==Other commands==
 
==Other commands==
 
===Display help on these commands===
 
===Display help on these commands===
 
<pre>--help</pre>
 
<pre>--help</pre>
<p>This command does not take any arguments.  It displays a very short version of this document, showing the mandatory and optional arguments, and a brief description of each command.</p>
+
<p>This command does not take any arguments.  It displays the mandatory and optional arguments, and a brief description of each command.</p>
===Check database completeness & integrity===
+
===Check database completeness & integrity (GM only)===
 
<pre>--check-db [ db-name ]</pre>
 
<pre>--check-db [ db-name ]</pre>
<p>Takes an optional database name or part of a database name: if a partial name, checks all character sheets with the provided text in their name that also have -db’ as part of their name.  If omitted, checks all character sheets with -db’ in the name.  Not case sensitive.  Can only be used by the GM.</p>
+
<p>Takes an optional database name or part of a database name: if a partial name, checks all character sheets with the provided text in their name that also have '-db' as part of their name.  If omitted, checks all character sheets with '-db' in the name.  Not case sensitive.  Can only be used by the GM.</p>
<p>This command finds all databases that match the name or partial name provided (not case sensitive), and checks them for completeness and integrity.  The command does not alter any ability macros, but ensures that the casting time (‘ct-) attributes are correctly created, that the item lists are sorted and complete, and that any item-specific power & spell specifications are correctly built and saved.</p>
+
<p>This command finds all databases that match the name or partial name provided (not case sensitive), and checks them for completeness and integrity.  The command does not alter any ability macros, but ensures that the casting time ('ct-') attributes are correctly created, that the item lists are sorted and complete, and that any item-specific power & spell specifications are correctly built and saved.</p>
 
<p>This command is very useful to run after creating/adding new items as ability macros to the databases (see section 8 below).  It does not check if the ability macro definition itself is valid, but if it is then it ensures all other aspects of the database consistently reflect the new ability(s).</p>
 
<p>This command is very useful to run after creating/adding new items as ability macros to the databases (see section 8 below).  It does not check if the ability macro definition itself is valid, but if it is then it ensures all other aspects of the database consistently reflect the new ability(s).</p>
===Handshake with other APIs===
 
<pre>–hsq from|[command]
 
–handshake from|[command]</pre>
 
<p>Either form performs a handshake with another API, whose call (without the ‘!’) is specified as <i>from</i> in the command parameters (the response is always an <b>–hsr</b> command).  The command calls the <i>from</i> API command responding with its own command to confirm that RoundMaster is loaded and running: e.g. </p>
 
'''Received:''' <code>!attk –hsq init</code><br>
 
'''Response:''' <code>!init –hsr attk</code>
 
<p>Optionally, a command query can be made to see if the command is supported by RoundMaster if the <i>command</i> string parameter is added, where <i>command</i> is the RoundMaster command (the ‘--’ text without the ‘--‘).  This will respond with a <i>true/false</i> response: e.g.</p>
 
'''Received:''' <code>!attk –handshake init|menu</code><br>
 
'''Response:''' <code>!init –hsr attk|menu|true</code>
 
 
===Switch on or off Debug mode===
 
===Switch on or off Debug mode===
 
<pre>--debug (ON/OFF)</pre>
 
<pre>--debug (ON/OFF)</pre>
 
<p>Takes one mandatory argument which should be ON or OFF.</p>
 
<p>Takes one mandatory argument which should be ON or OFF.</p>
<p>The command turns on a verbose diagnostic mode for the API which will trace what commands are being processed, including internal commands, what attributes are being set and changed, and more detail about any errors that are occurring.  The command can be used by the DM or any Player so the DM or a technical advisor can play as a Player and see the debugging messages.</p>
+
<p>The command turns on a verbose diagnostic mode for the API which will trace what commands are being processed, including internal commands, what attributes are being set and changed, and more detail about any errors that are occurring.  The command can be used by the DM or any Player - so the DM or a technical advisor can play as a Player and see the debugging messages.</p>
 +
===Forcing a database reset to the API version===
 +
<p>A database can be rebuilt as the version that came with the current version of the API if you have accidentally altered one of the Ability macros or an attribute and caused functions not to work as expected.  The easiest way to achieve this is to find the offending database Character Sheet and delete it, then exist the campaign and re-enter.  If and only if the database Character Sheet is one of the following, it will be automatically re-written as the version distributed with the API:</p>
 +
<p><i>MI-DB, MI-DB-Weapons, MI-DB-Ammo, MI-DB-Armour, MI-DB-Potions, MI-DB-Scrolls-Books, MI-DB-Wands-Staves-Rods, MI-DB-Rings, MI-DB-Light, MU-Spells-DB, PR-Spells-DB, Powers-DB.</i></p>
 
<br>
 
<br>
=Configuring the Token and Character Sheet for use with the API=
+
==Using Character Sheet Ability/Action buttons==
==Token configuration==
+
<p>The most common approach for the Player to run these commands is to use Ability macros on their Character Sheets which are flagged to appear as Token Action Buttons: Ability macros & Token Action Buttons are standard Roll20 functionality, refer to the Roll20 Help Centre for information on creating and using these.</p>
The API can work with any Token configuration but requires tokens that are going to participate in attacks to represent a Character Sheet, so that actions relevant to the token can be selected.<br>
+
<p>In fact, the simplest configuration is to provide only Token Action Buttons for the menu commands: --spellmenu and   mimenuFrom these, most other commands can be accessed.</p>
A single Character Sheet can have multiple Tokens representing it, and each of these are able to do individual attacks using the actions made possible by the data on the Character Sheet jointly represented.  However, if such multi-token Characters / NPCs / creatures are likely to encounter spells that will affect the Character Sheet (such as Haste and Slow) they must be split with each Token representing a separate Character Sheet, or else the one spell will affect all tokens associated with the Character Sheet, whether they were targeted or not!  In fact, ''it is recommended'' that tokens and character sheets are 1-to-1 to keep things simple.<br>
+
The recommended Token Bar assignments for all APIs in the Master Series are:<br>
+
{| class="wikitable"
+
|+
+
|-
+
! scope="row"| Bar1 (Green Circle):
+
|| Armour Class (AC field) – only current value
+
|-
+
! scope="row"| Bar2 (Blue Circle):
+
|| Base Thac0 (thac0-base field) before adjustments – only current value
+
|-
+
! scope="row"| Bar3 (Red Circle):
+
|| Hit Points (HP field) – current & max
+
|}
+
It is recommended to use these assignments, and they are the bar assignments set by the CommandMaster API if its facilities are used to set up the tokens.  All tokens must be set the same way, whatever way you eventually choose.<br>
+
These assignments can be changed in the APIs that use them, by changing the ''fields'' object near the top of the API script.<br>
+
 
+
==Use with various game system character sheets==
+
The API issued is initially set up to work with the AD&D 2E character sheet (as this is what the author mostly plays).  However, it can be set up for any character sheet.  In each API script, right at the top, is an object definition called ''fields'': see the next section for details.  This can be altered to get the API to work with other character sheets.<br>
+
The AttackMaster API, as with all the other RPGMaster series APIs, use Roll20 Roll Templates extensively.  This is sometimes the only way to get Roll20 to roll 3D animated dice (using a Character Sheet ability macro triggered by a Player), as 3D animated dice do not work when commanded by an API via a sendchat() call, due to a reported bug. Of course, there is a default Roll Template provided by the Roll20 system, but it is a bit clunky and Roll Templates provided by Character Sheet coders are often better.  AttackMaster and other RPGMaster APIs use these Character Sheet-defined Roll Templates, by default from the AD&D 2e Character Sheet.  As with every other field, the Roll Templates used can be altered in the ''fields'' object.<br>
+
The coding of the API is designed to use the AD&D 2E system of attack systems and calculations.  If you use another system, future developments might support additional approaches.  Contact the author for information and to pass on ideas (see the link in the sidebar at the top).<br>
+
 
+
==Matching the API to a type of Character Sheet==
+
The API has an object definition called ''fields'', which contains items of the form<br>
+
''Internal_api_name: [sheet_field_name, field_attribute, optional_default_value, optional_set_with_worker_flag]''<br>
+
A typical example might be:<br>
+
<pre> Fighter_level:['level-class1','current'],
+
Or
+
MUSpellNo_memable:['spell-level-castable','current','',true],</pre>
+
In order to change the field that the API uses on the character sheet for a different one, you can change the ''sheet_field_name'' and/or ''field_attribute'' for the one you want to use.  <u>'''However, the ''Internal_api_name'' and the other values should not be changed'''</u> as otherwise the system will not work.<br>
+
Table names are slightly different: always have an internal_api_name ending in ‘_table’ and their definition specifies the repeating table name and the index of the starting row of the table or -1 for a static field as the 1st row, with the 2nd row starting at repeating row number 0.<br>
+
''Internal_api_table: [sheet_repeating_table_name,starting_index]''<br>
+
An example is:<br>
+
<pre>MW_table:['repeating_weapons',0],</pre>
+
<u>'''The ''Internal_api_table'' must not be altered!'''</u> Doing so will cause the system not to work.  However, the ''sheet_repeating_table_name'' and ''starting_index'' can be altered to match any character sheet.<br>
+
Each character sheet must have repeating tables to hold weapons, ammo, spells and magic items.  By default, melee weapons ‘in hand’ are held in sections of the repeating_weapons table, melee weapon damage in the repeating_weapons-damage table, ranged weapons in the repeating_weapons2 table, ammo in the repeating_ammo table, spells in the repeating_spells table and magic items are held in the repeating_potions table.  Other repeating tables are also used, some of which are intended to be hidden and not visible in the Character Sheet.  The table management system provided by the API creates, expands and writes to repeating attributes automatically, and the DM & Players do not need to worry about altering or updating any of these tables on the Character Sheet.<br>
+
 
+
==Character Attributes, Races, Classes and Levels==
+
Character Attributes of Strength, Dexterity, Constitution, Intelligence, Wisdom and Charisma are not directly important to the AttackMaster API, but the resulting bonuses and penalties are.  All Attributes and resulting modifiers should be entered into the Character Sheet in the appropriate places (that is in the Character Sheet fields identified in the ''fields'' API object as noted in the section above).<br>
+
The Character’s race is also important for calculating saves and ability to use certain items.  The race should be set in the appropriate Character Sheet field.  Currently, the races ‘dwarf’, ‘elf’, ‘gnome’, ‘halfelf’, ‘halfling’, ‘half-orc’, and ‘human’ are implemented (not case sensitive, and spaces, hyphens and underscores are ignored).  If not specified, human is assumed.  The race impacts saves, some magic items and armour, and bonuses on some attacks.<br>
+
The system supports single-class and multi-class characters.  Classes must be entered in the appropriate fields on the Character Sheet.  Classes and levels affect spell casting ability, weapon multiple attack numbers per round, ability to do two-weapon attacks with or without penalty, and the ability to backstab and the related modifiers among other things.  Class and level also determine valid armour, shields, some magic items and saves.<br>
+
'''Note:''' on the Advanced D&D 2e Character Sheet, Fighter classes '''must''' be in the ''first'' class column, Wizard classes in the ''second'' column, Priest classes in the ''third'', Rogues in the ''fourth'', and Psions (or any others) in the ''fifth''.  It is important that these locations are adhered to.<br>
+
'''Note:''' classes of Fighter and Rogue (such as Paladins, Rangers and Bards) that can use clerical &/or wizard spells will automatically be allowed to cast spells once they reach the appropriate level by AD&D 2e rules, but not before.  They '''do not''' also need an entry under a spellcaster column.<br>
+
The following Classes are currently supported, and the class name must be entered into the class field.  If missing, the top row is assumed in each case:<br>
+
{| class="wikitable"
+
|+
+
|-
+
! Fighter classes !! Wizard Classes !! Priest Classes !! Rogue Classes !! Psion Classes
+
|-
+
| Warrior || Wizard || Priest || Rogue || Psion
+
|-
+
| Fighter || Mage || Cleric || Thief ||
+
|-
+
| Ranger || Abjurer || Druid || Bard ||
+
|-
+
| Paladin || Conjurer || Healer || Assassin ||
+
|-
+
| Beastmaster || Diviner || Priest of Life ||  ||
+
|-
+
| Barbarian || Enchanter || Priest of War || ||
+
|-
+
| Defender (Dwarven) || Illusionist || Priest of Light || ||
+
|-
+
| || Invoker || Priest of Knowledge || ||
+
|-
+
| || Necromancer || Shaman || ||
+
|-
+
| || Transmuter || || ||
+
|}
+
The level for each class must be entered in the corresponding field.  Multiple classes and levels can be entered, and will be dealt with accordingly.  Generally, the most beneficial outcome for any combination will be used.  If not entered, 0 (zero) is assumed (i.e. a commoner)<br>
+
 
+
==Spells and Powers==
+
The best (and easiest) way to give a Character or NPC spells and powers is to use the MagicMaster API.  However, for the purposes of just doing initiative and selecting which spell to cast in the round, the spells and powers can be entered manually onto the character sheetSpells are held in the relevant section of the Spells table, which by default is set to the character sheet spells table, repeating_spells.  As with other fields, this can be changed in the ''fields'' object.  Note that on the Advanced D&D 2e character sheet Wizard spells, Priest spells & Powers are all stored in various parts of this one very large table.<br>
+
If you are just using the character sheet fields to type into, add spells (or powers) to the relevant “Spells Memorised” section (using the [+Add] buttons to add more as required) a complete row at a time (that is add columns before starting the next row).  Enter the spell names into the “Spell Name” field, and “1” into each of the “current” & “maximum” “Cast Today” fields – the API suite counts down to zero on using a spell, so in order for a spell to appear as available (not greyed out) on the relevant menus, the “current” number left must be > 0.  This makes spells consistent with other tables in the system (e.g. potion dose quantities also count down as they are consumed, etc).<br>
+
Then, you need to set the “Spell Slots” values on each level of spell to be correct for the level of caster.  Just enter numbers into each of the “Level”, “Misc.” and “Wisdom” (for Priests) fields, and/or tick “Specialist” for the Wizard levels as relevant.  This will determine the maximum number of spells memorised each day, that will appear in the relevant spells  menus.  Do the same for Powers using the “Powers Available” field.  As with other fields on the character sheet, each of these fields can be re-mapped by altering the ''fields'' object in the APIs.<br>
+
 
+
==Magic Items and Equipment==
+
All magic items and standard equipment, including weapons, armour, lanterns etc, are held in the Items table, which by default is set to the potions table, repeating_potions, on the Character Sheet.  As with other fields, this can be changed in the ''fields'' object.  The best way to put items into this table is by using the MagicMaster API.  However, it generally is possible to enter item names and quantities directly into the table and use them within the system.  Only items that also exist in the supplied databases will actually work fully with the API (i.e. be recognised by the API as weapons, armour, ammo, etc).  Initial weapon, ammunition and armour databases are provided with the AttackMaster API, and in addition to these Initial magic item, spell and power databases are provided with the MagicMaster API.  Other items can be in the table and used for undertaking initiative actions but will not otherwise be effective.  New databases and database items can be added using the specifications and instructions contained in the AttackMaster and MagicMaster API documentation.<br>
+
 
+
==Weapons and Ammo==
+
For the AttackMaster API to support weapon attack actions melee weapons, damage, ranged weapons and ammo must be entered directly into the melee weapon, damage, ranged weapon and ammo tables on the Character Sheet.  This is best done using the AttackMaster commands ''--edit-weapons'' (to load from the database) and ''--weapon'' (to take weapons ''in-hand''), which will ensure all the right values are entered in the right fields, including taking into account the impact of weapon proficiencies, specialisation, mastery, character races and class/level.  However, manual entry will generally work to the extent to allow weapon attack actions to be selected.<br>
+
 
<br>
 
<br>
=Character Sheet data fields =
 
As stated in the previous section, the Character Sheet field mapping to the API script can be altered using the definition of the ''fields'' object.  You can find the complete mapping for all APIs in the RPGMaster series, with an explanation of each, in a separate document.<br>
 
<br>
 
=Weapon, Ammo & Armour Databases=
 
==General Database information==
 
<p>The RPGMaster APIs use a number of Character Sheets as databases to hold Ability Macros defining weapons, ammo, and items of armour and their specifications.  The API is distributed with many weapon, ammo and armour definitions and it also checks for, creates and updates these Character Sheet databases on start-up.  DMs can add their own weapons, ammo and armour to additional databases, but the databases provided are totally rewritten when new updates are released so the DM must add their own database sheets.  If the <i>provided</i> databases are accidentally deleted, they will be automatically recreated the next time the Campaign is opened. Additional databases should be named as follows:</p>
 
<table><tr><td>Weapons:</td><td>additional databases: ''MI-DB-Weapons-[added name]'' where ''[added name]'' can be replaced with anything you want.</td></tr>
 
<tr><td>Ammo:</td><td>additional databases: ''MI-DB-Ammo-[added name]'' where ''[added name]'' can be replaced with anything you want.</td></tr>
 
<tr><td>Armour:</td><td>additional databases: ''MI-DB-Armour-[added name]'' where ''[added name]'' can be replaced with anything you want.</td></tr></table>
 
<p><b>However:</b> the system will ignore any database with a name that includes a version number of the form “v#.#” where # can be any number or group of numbers e.g. MI-DB v2.13 will be ignored.  This is so that the DM can version control their databases, with only the current one (without a version number) being live.</p>
 
<p>There can be as many additional databases as you want.  Other Master series APIs come with additional databases, some of which overlap - this does not cause a problem as version control and merging unique macros is managed by the APIs.</p>
 
<p><b>Important Note:</b> all Character Sheet databases <b><u><i>must</i></u></b> have their <i>‘ControlledBy’</i> value (found under the [Edit] button at the top right of each sheet) set to <i>‘All Players’</i>.  This must be for all databases, both those provided (set by the API) and any user-defined ones.  Otherwise, Players will not be able to run the macros contained in them.</p>
 
<p>Each database has a similar structure, with:</p>
 
<ul><li>Ability Macros named as the weapon, ammo or armour specified, and used to describe and provide specifications for using the commands with the AttackMaster API;</li>
 
<li>Custom Attributes with the attribute name “ct-ability-macro-name”, one per Ability Macro, which defines the speed and type for each item;</li>
 
<li>An entry in a list on the character sheet in the spell book of the relevant Character Sheet tab (various spell books for different items – see entry below);</li>
 
<li>Optionally, some entries come also with attributes that define Powers and Spells delivered by or stored on the item.</li></ul>
 
<p><b>Note:</b> a DM only needs to program the Ability Macro using the formats shown in the next section, and then run the <b>!attk --check-db</b> or <b>!magic --check-db</b> command, which will correctly parse the ability macro and set the rest of the database entries as needed.</p>
 
<p>Ability Macros can be whatever the DM wants and can be as simple or as complex as desired. Roll Templates are very useful when defining ability macros.  When a Player or an NPC or Monster views the specifications of a weapon, ammunition or piece of armour, the APIs run the relevant Ability Macro from the databases as if it had been run by the Player from the chat window.  All Roll20 functions for macros are available.</p>
 
==Weapon & Ammunition Databases==
 
<p>Weapon databases are all character sheets that have names that start with MI-DB-Weapon (though in fact, weapons can be in any database starting with MI-DB- if desired), and can have anything put at the end, though those with version numbers of the form v#.# as part of the name will be ignored.  Ammunition databases are similar, with the root database MI-DB-Ammo.</p>
 
<p>As previously stated, each weapon definition has 3 parts in the database (see Section 1): an Ability Macro with a name that is unique and matches the weapon, an Attribute with the name of the Ability Macro preceded by “ct-“, and a listing in the database character sheet of the ability macro name separated by ‘|’ along with other weapons. The quickest way to understand these entries is to examine existing entries.  Do go to the root databases and take a look (but be careful not to alter anything unless you know what you’re doing!)</p>
 
<p><b>Note:</b> The DM creating new weapons does not need to worry about anything other than the Ability Macro in the database, as running the <b>AttackMaster</b> or <b>MagicMaster –check-db MI-DB-Weapons</b> command will update all other aspects of the database appropriately for all databases that have a name starting with or including <i>‘MI-DB-Weapons’</i>, as long as the <i>Specs</i> and <i>Data</i> fields are correctly defined. Use the parameter <i>'MI-DB-Ammo'</i> to check and update the ammunition databases.  Running the command <b>–check-db</b> with no parameters will check and update all databases.</p>
 
<p>Ability macros can be added to a database just by using the [+Add] button at the top of the Abilities column in the Attributes and Abilities tab of the Database Character Sheet, and then using the edit “pencil” icon on the new entry to open it for editing.  Ability macros are standard Roll20 functionality and not dependent on the API.  Refer to the Roll20 Help Centre for more information.</p>
 
<p>Here are some examples:</p>
 
===Longsword===
 
<pre><nowiki>/w "@{selected|character_name}" &{template:2Edefault} {{name=Longsword}} {{subtitle=Sword}} {{Speed=[[5]]}} {{Size=Medium}} {{Weapon=1-handed melee long-blade}} Specs=[Longsword,Melee,1H,Long-blade] {{To-hit=+0 + Str bonus}} ToHitData=[w:Longsword, sb:1, +:0, n:1, ch:20, cm:1, sz:M, ty:S, r:5, sp:5] {{Attacks=1 per round + level & specialisation, Slashing}} {{Damage=+0, vs SM:1d8, L:1d12, + Str bonus}} DmgData=[w:Longsword, sb:1, +:0, SM:1d8, L:1d12] {{desc=This is a normal sword. The blade is sharp and keen, but nothing special.}}</nowiki></pre>
 
<p>The ability specification for this Longsword uses a Roll20 Roll Template, in this case defined by the Advanced D&D 2e Character Sheet by Peter B (see the documentation for the Character Sheet on Roll20 for specifications of this Roll Template), but any Roll Template you desire can be used.  The entries in the Roll Template itself can be anything you desire, giving as much or as little information as you want.  However, the important elements for the APIs are those highlighted.  Each of these elements are inserted <i>between</i> the elements of the Roll Template, meaning they will not be seen by the player when the macro is run.  Generally spaces, hyphens and underscores in the data elements are ignored, and case is not significant.  Each element is described below:</p>
 
<pre>Specs = [Type, Class, Handedness, Weapon Group]</pre>
 
<p>The Specs section describes what weapon type and proficiency groups this weapon belongs to.  These fields must be in this order.  This format is identical for all database items, whether in these databases or others used by the Master series of APIs.</p>
 
<table><tr><td><b>Type</b></td><td>is the type of the weapon, often the same as the ability macro name without magical plusses.</td></tr>
 
<tr><td><b>Class</b></td><td>is one of Melee, Ranged, or Ammo.</td></tr>
 
<tr><td><b>Handedness</b></td><td>is #H, where # is the number of hands needed to wield the weapon.</td></tr>
 
<tr><td><b>Weapon Group</b></td><td>is the group of related weapons that the weapon belongs to.</td></tr></table>
 
<pre>ToHitData = [w:Longsword, sb:1, +:0, n:1, ch:20, cm:1, sz:M, ty:S, r:5, sp:5]</pre>
 
<p>The ToHitData section specifies the data relating to an attack with the weapon.  These fields can be in any order.</p>
 
<table><tr><td><b>w:</b></td><td>&lt;text&gt; the name to display for attacks with this weapon</td></tr>
 
<tr><td><b>sb:</b></td><td><0/1> strength bonus flag - specifies if the strength bonus is applicable to the To-Hit roll</td></tr>
 
<tr><td><b>+:</b></td><td><[+/-]#> the magical attack bonus/penalty - an integer of any size</td></tr>
 
<tr><td><b>n:</b></td><td><#[/#]> the basic number of attacks per round: the API will modify to account for specialisation and level</td></tr>
 
<tr><td><b>ch:</b></td><td><1-20> the roll for a Critical Hit, shown in the API with a green border to the attack AC achieved</td></tr>
 
<tr><td><b>cm:</b></td><td><1-20> the roll for a Critical Miss, shown in the API with a red border to the attack AC achieved</td></tr>
 
<tr><td><b>sz:</b></td><td><T/S/M/L/H/G> the size of the weapon</td></tr>
 
<tr><td><b>ty:</b></td><td><SPB> the type of damage done by the weapon - Slashing, Piercing and/or Bludgeoning</td></tr>
 
<tr><td><b>sp:</b></td><td><#> the speed of the weapon in segments</td></tr>
 
<tr><td><b>r:</b></td><td><[+/-/=]# [/#/#/#] > the range or range modifier of the weapon.  Ranged weapons use PB / S / M / L</td></tr></table>
 
<p>The number of attacks per round, <b>n:</b>, can be an integer or a fraction such as 3/2 meaning 3 attacks every 2 rounds.  If using the InitMaster API the Tracker will have the correct number of entries for the Character relating to the number of attacks in the current round.</p>
 
<p>The range for the weapon, <b>r:</b>, can be a single integer (representing the range of a melee weapon or simple ranged weapon) or a range modifier, starting with +, -, or =.  The range modifier will amend the range of the ammo for a ranged weapon - ranged weapons vary their range with the ammo used.  The weapon can use that range or modify it.  Ranged weapon range modifiers can be of the form [[+/-]#/][+/-]#/[+/-]#/[+/-]# which will add or subtract a different modifier for each range ([Point Blank] / Short / Medium / Long – Point Blank range is optional)</p>
 
<pre>DmgData = [w:Longsword, sb:1, +:0, SM:1d8, L:1d12]</pre>
 
<p>The DmgData section specifies the data relating to the damage done by the weapon, and relates to melee weapons only (not ranged weapons).  These fields can be in any order.</p>
 
<table><tr><td><b>w:</b></td><td>&lt;text&gt; the name to display for damage calculations for this weapon</td></tr>
 
<tr><td><b>sb:</b></td><td><0/1> strength bonus flag - specifies if the strength bonus is applicable to the Damage roll</td></tr>
 
<tr><td><b>+:</b></td><td><[+/-]#> the magical damage bonus/penalty - an integer of any size</td></tr>
 
<tr><td><b>sm:</b></td><td><dice roll spec> the base dice roll vs. small/medium creatures excluding any magical bonus</td></tr>
 
<tr><td><b>l:</b></td><td><dice roll spec> the base dice roll vs. large/huge creatures excluding any magical bonus</td></tr></table>
 
<br>
 
===Bastardsword+1===
 
<pre><nowiki>/w "@{selected|character_name}" &{template:2Edefault} {{name=Bastard Sword+1}} {{subtitle=Magic Sword}} {{Speed=[[5]]}} {{Size=Medium}} {{Weapon=1 or 2-handed melee long blade}} Specs=[Bastard-Sword,Melee,1H,Long-blade], [Bastard-Sword,Melee,2H,Long-blade] {{To-hit=+1 + Str Bonus}} ToHitData=[w:Bastard Sword+1, sb:1, +:1, n:1, ch:20, cm:1, sz:M, ty:S, r:5, sp:6,rc:uncharged],[w:Bastard Sword 2H+1, sb:1, +:1, n:1, ch:20, cm:1, sz:M, ty:S, r:5, sp:8,,rc:uncharged] {{Attacks=1 per round + specialisation & level, Slashing}} {{Damage=+1, 1-handed SM:1d8 L:1d12, 2-handed SM:2d4 L:2d8}} DmgData=[w:Bastard Sword+1,sb:1,+:1,SM:1d8,L:1d12],[w:Bastard Sword 2H+1,sb:1,+:1,SM:2d4,L:2d8] {{desc=This is a normal magical sword. The blade is sharp and keen, and is a +[[1]] magical weapon at all times.}}</nowiki></pre>
 
<p>The Bastardsword can be used either single handed or two handed with different to-hit and damage outcomes.  This can be represented in the macro as shown here, with multiple specification sections.  When using the <b>AttackMaster API !attk --weapon</b> command to take the Bastardsword in hand, choosing 1 hand (either left or right) will use the 1-handed specifications, and choosing to take it in Both Hands will use the 2-handed specifications.</p>
 
<p>All the field definitions are the same as for the Longsword example above, but there are (in this case) two sets of data for each section, the first set for 1-handed, the second set for 2-handed (as defined by the <b>handedness</b> entry in the <b>Specs</b> section data sets.</p>
 
<br>
 
===Longbow===
 
<pre><nowiki>/w "@{selected|character_name}" &{template:2Edefault} {{name=Longbow}} {{subtitle=Bow}} {{Speed=[[8]]}} {{Size=Medium}} {{Weapon=Ranged 2-handed Bow}} Specs=[Longbow,Ranged,2H,Bow] {{To-hit=+0 + Dex Bonus}} ToHitData=[w:Longbow,sb:0,db:1,+:0,n:2,ch:20,cm:1,sz:L,ty:P,sp:8] {{Attacks=Piercing, 2 per round}} {{desc=This is a normal longbow. The wood is polished, the string taut, but nothing special.}}</nowiki></pre>
 
<p>A ranged weapon like a Longbow uses the same data section definitions as melee weapons except for the following additions and differences.</p>
 
<pre>ToHitData=[w:Longbow,sb:0,db:1,+:0,n:2,ch:20,cm:1,sz:L,ty:P,sp:8]</pre>
 
<p>The To-Hit section has an extra option:</p>
 
<table><tr><td><b>db:</b></td><td><0/1> dexterity bonus flag - specifies if the dexterity bonus is applicable to the To-Hit roll.</td></tr>
 
<tr><td><b>r:</b></td><td>the range data is not provided because this weapon does not modify the range of its ammo, but could be provided if required.</td></tr></table>
 
<p>There is no DmgData section, as damage is defined by the ammo.</p>
 
<br>
 
===Flight-Arrow+2 (Ammunition Database)===
 
<pre><nowiki>/w "@{selected|character_name}" &{template:2Edefault} {{name=Flight Arrow+2}} {{subtitle=Magic Weapon}} {{Speed=As per bow}} {{Size=Small}} Specs=[Flight-Arrow,Ammo,1H,Arrow],[Flight-Arrow,Ammo,1H,Arrow] {{Ammo=+2,<br>
 
<b>**Warbow**</b> vs. SM:1d8, L:1d8,<br>
 
<b>**Other Bows**</b> vs. SM:1d6, L:1d6, Piercing}} AmmoData=[w:Flight Arrow+2, st:Bow, sb:1, +:2, SM:1d6, L:1d6],[w:Warbow Flight Arrow+2, t:warbow, sb:1, +:2, SM:1d8,L:1d8] {{Range=PB:30, others vary by bow<br>
 
<b>**Shortbow:**</b><br>
 
S:50, M:100, L150,<br>
 
<b>**Longbow:**</b><br>
 
S:60, M:120, L:210,<br>
 
<b>**Warbow:**</b><br>
 
S90, M:160, L:250,<br>
 
<b>**Composite Sbow:**</b><br>
 
S:50, M:100, L:180,<br>
 
<b>**Composite Lbow:**</b><br>
 
S:70, M:140, L:210}} RangeData=[t:longbow, +:2, r:3/6/12/21],[t:shortbow, +:2, r:3/5/10/15],[t:warbow, +:2, r:3/9/16/25],[t:compositelongbow, +:2, r:3/7/14/21],[t:compositeshortbow, +:2, r:3/5/10/18] {{desc=A magical Flight Arrow of very fine quality}}</nowiki></pre>
 
<p>Ammo has a different specification, as the To-Hit data sections are obviously part of the ranged weapon data.  Instead it provides data on which weapons this can be ammo for, and what ranges it has for each.  To determine this, it uses the weapon type and group-type set in the weapon <b>Specs</b> section.</p>
 
<pre>AmmoData=[w:Flight Arrow+2, st:Bow, sb:1, +:2, SM:1d6, L:1d6],[w:Warbow Flight Arrow+2, t:warbow, sb:1, +:2, SM:1d8,L:1d8]</pre>
 
<p>The AmmoData section has mostly the same as the DmgData sections (order of fields is immaterial and spaces, hyphens and underscores ignored in type and supertype names), but repeated data sets relate to the data for different types of weapon, and in addition:</p>
 
<table><tr><td><b>t:</b></td><td><weapon-type> the specific type of ranged weapon this data matches - takes priority over <b>st:</b>.  An example is ''Longbow''</td></tr>
 
<tr><td><b>st:</b></td><td><group-type> the group-type of ranged weapon this data can be used for.  An example is <i>Bow</i>, which means all bows</td></tr></table>
 
<pre>RangeData=[t:longbow, +:2, r:3/6/12/21],[t:shortbow, +:2, r:3/5/10/15],[t:warbow, +:2, r:3/9/16/25], [t:compositelongbow, +:2, r:3/7/14/21],[t:compositeshortbow, +:2, r:3/5/10/18],[st:bow, +:2, r:3/5/10/15]</pre>
 
<p>The RangeData section has one or more data sets relating to weapons that result in different ranges. The range specifications can have 3 or 4 parts: if 4, the first is for Point Blank range which is only relevant for specialists; the remaining 3 are always short, medium & long ranges.</p>
 
===Self-ammoed weapons e.g. Warhammer===
 
<pre><nowiki>/w "@{selected|character_name}" &{template:2Edefault} {{name=Warhammer}} {{subtitle=Hammer/Club}} {{Speed=[[4]]}} {{Size=Medium}} {{Weapon=1-handed melee or thrown club}} Specs=[Warhammer,Melee,1H,Club],[Warhammer,Ranged,1H,Club] {{To-hit=+0 + Str & Dex bonus}} ToHitData=[w:Warhammer, sb:1, +:0, n:1, ch:20, cm:1, sz:M, ty:B, r:5, sp:4],[ w:Warhammer, sb:1, db:1,  +:0, n:1, ch:20, cm:1, sz:M, ty:B, sp:4] {{Attacks=1 per round + level & specialisation, Bludgeoning}} {{Damage=+0, vs SM:1d4+1, L:1d4, + Str bonus}} DmgData=[ w:Warhammer, sb:1, +:0, SM:1+1d4, L:1d4][] {{Ammo=+0, vs SM:1d4+1, L:1d4, + Str bonus}} AmmoData=[w:Warhammer,t:Warhammer,st:Throwing-club,sb:1,+:0,SM:1+1d4,L:1d4] {{Range=S:10, M:20, L:30}} RangeData=[t:Warhammer,+:0,r:1/2/3] {{desc=This is a normal warhammer. The blade is sharp and keen, but nothing special.}}</nowiki></pre>
 
<p>A melee weapon that can also be thrown, and is its own ammunition, is termed a “self-ammoed” weapon.  Its definition combines the data elements of both melee weapons, ranged weapons and ammunition.</p>
 
<pre>Specs=[Warhammer,Melee,1H,Club],[Warhammer,Ranged,1H,Club]</pre>
 
<p>Has two data sets, one as a melee weapon and one as a ranged weapon.</p>
 
<pre>ToHitData=[w:Warhammer, sb:1, +:0, n:1, ch:20, cm:1, sz:M, ty:B, r:5, sp:4],[ w:Warhammer, sb:1, db:1,  +:0, n:1, ch:20, cm:1, sz:M, ty:B, sp:4]</pre>
 
<p>Also has two sets of data, each of which relates to the corresponding Specs set.</p>
 
<pre>DmgData=[ w:Warhammer, sb:1, +:0, SM:1+1d4, L:1d4],[]</pre>
 
<p>Does have two data sets, but the one corresponding to the ranged data is empty, as this data is in the Ammo data set.</p>
 
<pre>AmmoData=[w:Warhammer,t:Warhammer,st:Throwing-club,sb:1,+:0,SM:1+1d4,L:1d4]</pre>
 
<p>There is only 1 Ammo data set, as it only relates to the one weapon, itself.</p>
 
<pre>RangeData=[t:Warhammer,+:0,r:1/2/3]</pre>
 
<p>And only 1 Range data set, as it only relates to itself.</p>
 
<br>
 
===Artifact sword===
 
<pre><nowiki>/w "@{selected|character_name}" &{template:2Edefault} {{name=Jim the Sun Blade<br>
 
Intelligent, Neutral}} {{subtitle=Magic Sword}} {{Speed=[[3]]}} WeapData=[w:Jim the Sun Blade,ns:5][cl:PW,w:Jims-Locate-Object,sp:100,lv:6,pd:1],[cl:PW,w:Jims-Find-Traps,sp:5,lv:6,pd:2],[cl:PW,w:Jims-Levitation,sp:2,lv:1,pd:3],[cl:PW,w:Jims-Sunlight,sp:3,lv:6,pd:1],[cl:PW,w:Jims-Fear,sp:4,lv:6,pd:2] {{Size=Special (feels like a Shortsword)}} {{Weapon=1 or 2 handed melee Long or Short blade}} Specs=[Bastard-sword|Short-sword,Melee,1H,Long-blade|Short-blade],[Bastard-sword|Short-sword,Melee,1H,Long-blade|Short-blade],[Bastard-sword,Melee,2H,Long-blade],[Bastard-sword,Melee,2H,Long-blade] {{To-hit=+2, +4 vs Evil + Str Bonus}} ToHitData=[w:Jim +2,sb:1,+:2,n:1,ch:20,cm:1,sz:M,ty:S,r:5,sp:3],[w:Jim vs Evil+4,sb:1,+:4,n:1,ch:20,cm:1,sz:M,ty:S,r:5,sp:3],[w:Jim 2H +2,sb:1,+:2,n:1,ch:20,cm:1,sz:M,ty:S,r:5,sp:3],[w:Jim 2H vs Evil+4,sb:1,+:4,n:1,ch:20,cm:1,sz:M,ty:S,r:5,sp:3] {{Attacks=1 per round}} {{Damage=+2, +4 vs Evil, + 1-handed SM:1d8 L:1d12, 2-handed SM:2d4 L:2d8}} DmgData=[w:Jim+2,sb:1,+:2,SM:1d8,L:1d12],[w:Jim vs Evil+4,sb:1,+:4,SM:2d4,L:2d8],[w:Jim 2H +2,sb:1,+:2,SM:1d8,L:1d12],[w:Jim 2H vs Evil+4,sb:1,+:4,SM:2d4,L:2d8] {{desc=An intelligent weapon: A Sun Blade called Jim (DMs Guide Page 185). It is Neutral. It needs its owner to be proficient with either a Short or Bastard Sword or promise to get such proficiency as soon as possible. It cannot be used by someone who is not proficient. It requires its owner to be Neutral on at least one of its axis, and may not be Evil. NG LN CN and of cause true N are all ok. Abilities:<br>
 
<b>**1:**</b> It is +2 normally, or +4 against evil creatures, and does Bastard sword damage.<br>
 
<b>**2:**</b> It feels and react as if it is a short sword and uses short sword striking time.<br>
 
<b>**3:**</b> [Locate Object](!magic --mi-power @{selected|token_id}|Jims-Locate-Object|Jim-the-Sun-Blade|6) at [[6]]th Level in 120’ radius (1x day).<br>
 
<b>**4:**</b> [Detect traps](!magic --mi-power @{selected|token_id}|Jims-Find-Traps|Jim-the-Sun-Blade|6) of large size in 10’ radius (2xday).<br>
 
<b>**5:**</b> [Levitation](!magic --mi-power @{selected|token_id}|Jims-Levitation|Jim-the-Sun-Blade|1) 3x a day for 1 turn (cast at 1st Level).<br>
 
<b>**6:**</b> [Sunlight](!magic --mi-power @{selected|token_id}|Jims-Sunlight|Jim-the-Sun-Blade|6) Once a day, upon command, the blade can be swung vigorously above the head, and it will shed a bright yellow radiance that is like full daylight. The radiance begins shining in a 10-foot radius around the sword-wielder, spreading outward at 5 feet per round for 10 rounds thereafter, creating a globe of light with a 60-foot radius. When the swinging stops, the radiance fades to a dim glow that persists for another turn before disappearing entirely.<br>
 
<b>**7:**</b> It has a special purpose namely Defeat Evil. <br>
 
<b>**8:**</b> On hitting an Evil being it causes [Fear](!magic --mi-power @{selected|token_id}|Jims-Fear|Jim-the-Sun-Blade|6) for 1d4 rounds (unless saving throw is made). It can do this **twice a day** when the wielder desires.<br>
 
<b>**9:**</b> It speaks Common and its name is Jim. It will talk to the party.<br>
 
<b>**10:**</b> It has an ego of 16 and is from Yorkshire. <br>
 
<b>**11:**</b> It will insist on having a Neutral wielder. (See Intelligent weapons on page 187 in DMG).<br>
 
<b>**12:**</b> If picked by a player, it will be keen to become the players main weapon.<br>
 
<b>**13:**</b> If picked up by a player who is not Neutral it will do them 16 points of damage}}</nowiki></pre>
 
<p>An artefact such as an intelligent sword with powers introduces data sets that specify the powers that the artefact has and how often they can be used.  These match the API Buttons with calls to the <b>MagicMaster API</b> to enact the powers.</p>
 
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;">WeapData=[w:Jim the Sun Blade,ns:5][cl:PW,w:Jims-Locate-Object,sp:100,lv:6,pd:1],[cl:PW,w:Jims-Find-Traps,sp:5,lv:6,pd:2],[cl:PW,w:Jims-Levitation,sp:2,lv:1,pd:3],[cl:PW,w:Jims-Sunlight,sp:3,lv:6,pd:1],[cl:PW,w:Jims-Fear,sp:4,lv:6,pd:2]</p>
 
<p>The WeapData data sets can be used to define the powers that an artefact has (or stored spells - see MagicMaster API for more information on spell storing)</p>
 
<p>1<sup>st</sup> data set:</p>
 
<table><tr><td><b>w:</b></td><td>&lt;text&gt;  The name of the weapon (not currently used)</td></tr>
 
<tr><td><b>ns:</b></td><td><#>  The number of spells or powers for which the specifications follow</td></tr></table>
 
<p>Subsequent data sets:</p>
 
<table><tr><td><b>cl:</b></td><td>< MU / PR / PW >  The type of data: MU=Wizard, PR=Priest, PW=Power</td></tr>
 
<tr><td><b>w:</b></td><td>&lt;text&gt;  Name of the spell or power: must be the same as the corresponding database definition</td></tr>
 
<tr><td><b>sp:</b></td><td><#>  Speed of the spell/power casting in segments (1/10ths of a round)</td></tr>
 
<tr><td><b>lv:</b></td><td><#>  The level at which the artefact will cast the spell/power (if omitted will use character’s level)</td></tr>
 
<tr><td><b>pd:</b></td><td><-1 / #>  Number per day, or -1 for “use at will”  </td></tr></table>
 
<br>
 
==Armour Databases==
 
<p>Armour databases are all character sheets that have names that start with MI-DB-Armour (as with weapons, this can be in any database starting with MI-DB- if desired), and can have anything put at the end, though those with version numbers of the form v#.# as part of the name will be ignored.</p>
 
<p>As previously stated and as per the weapon and ammunition databases, each armour definition has 3 parts in the database (see Section 1): the Ability Macro, the ct- attribute, and the listing (and occasionally attributes for powers and spells).  The quickest way to understand these entries is to examine existing entries.  Do go to the root databases and take a look (but be careful not to alter anything unless you know what you’re doing!)</p>
 
<p><b>Note:</b>The DM creating new armour entries does not need to worry about anything other than the Ability Macro in the database, as running the <b>!attk --check-db MI-DB-Armour</b> or <b>!magic --check-db MI-DB-Armour</b> command will update all other aspects of the database appropriately for all databases that have a name starting with or including ‘MI-DB-Armour’, as long as the Specs and Data fields are correctly defined.  Running the command <b>–check-db</b> with no parameters will check and update all databases.</p>
 
<p>Here are some examples:</p>
 
===Chain Mail===
 
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;">/w "@{selected|character_name}" &{template:2Edefault}{{name=Chain Mail}}{{subtitle=Armour}}{{Armour=Chain Mail}}<mark style="color:green">Specs=[Chain Mail,Armour,0H,Mail]</mark>{{AC=[[5]] vs all attacks}}<mark style="color:blue">ACData=[a:Chain Mail,st:Mail,+:0,ac:5,sz:L,wt:40]</mark>{{Speed=[[0]]}}{{Size=Large}}{{Immunity=None}}{{Saves=No effect}}{{desc=This armor is made of interlocking metal rings. It is always worn with a layer of quilted fabric padding underneath to prevent painful chafing and to cushion the impact of blows. Several layers of mail are normally hung over vital areas. The links yield easily to blows, absorbing some of the shock. Most of the weight of this armor is carried on the shoulders and it is uncomfortable to wear for long periods of time.}}</p>
 
<p>The ability specification for this suit of Chain Mail uses a Roll20 Roll Template, in this case defined by the Advanced D&D 2e Character Sheet by Peter B.  The entries in the Roll Template itself can be anything you desire, giving as much or as little information as you want.  However, the important elements for the AttackMaster API are those highlighted.  Each of these elements are inserted between the elements of the Roll Template, meaning they will not be seen by the player when the macro is run.  Generally spaces, hyphens and underscores in the data elements are ignored, and case is not significant.  Each element is described below:</p>
 
<pre>Specs=[Chain Mail,Armour,0H,Mail]</pre>
 
<p>The Specs section of the specification has exactly the same format as for weapons and ammunition (and indeed all database items).  See section 9 for the definition of the fields.</p>
 
<p><b>Note:</b>The armour Type (the 1<sup>st</sup> parameter) and Group-Type (the 4<sup>th</sup> parameter) are used to determine if the character is of a class that can use the armour.  Currently implemented types are listed in Section 9.</p>
 
<p><b>Note:</b> Armour that fits on the body generally does not take any hands to hold, and so the third field, <i>Handedness</i>, is set to “0H”.</p>
 
<pre>ACData=[a:Chain Mail,st:Mail,+:0,ac:5,sz:L,wt:40]</pre>
 
<p>The Armour Class Data (ACData) section holds data specific to the armour.  As with other data sections, fields can be in any order, and spaces, hyphens, underscores and case are ignored.</p>
 
<table><tr><td><b>a:</b></td><td>< text > the name of the armour to be displayed.  Often the same as the Ability.</td></tr>
 
<tr><td><b>st:</b></td><td>< group-type > the supertype of the armour, often the same as the fourth parameter of the Specs section.</td></tr>
 
<tr><td><b>+:</b></td><td><[+/-]#> the magical bonus or penalty of the armour (defaults to 0 if not supplied).</td></tr>
 
<tr><td><b>ac:</b></td><td><[-]#> the base armour class (excluding magical bonuses) for this type of armour.</td></tr>
 
<tr><td><b>sz:</b></td><td><[T/S/M/L/H]> The size of the item (not necessarily indicating its fit).</td></tr>
 
<tr><td><b>wt:</b></td><td><#> The weight of the item in lbs (could be considered kg - or any measure - if everything is the same).</td></tr></table>
 
<p>Other possible fields are:</p>
 
<table><tr><td><b>t:</b></td><td>< armour-type > The specific armour type, often the same as the first parameter of the Specs section.</td></tr>
 
<tr><td><b>db:</b></td><td><[-/+]#> The dexterity bonus or penalty that wearing the armour bestowes.</td></tr>
 
<tr><td><b>+m:</b></td><td><[-/+]#> The adjustment that the armour gives vs. missiles and ammunition of ranged weapons.</td></tr>
 
<tr><td><b>+s:</b></td><td><[-/+]#> The magical adjustment specifically against slashing damage.</td></tr>
 
<tr><td><b>+p:</b></td><td><[-/+]#> The magical adjustment specifically against piercing damage.</td></tr>
 
<tr><td><b>+b:</b></td><td><[-/+]#> The magical adjustment specifically against bludgeoning damage.</td></tr>
 
<tr><td><b>rc:</b></td><td><recharging/curse type> Armour can be “cursed”, but generally does not have charges. Default is “uncharged”.  See MagicMaster API documentation for more information on charges and curses.</td></tr></table>
 
<br>
 
===Shield+2===
 
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;">/w "@{selected|character_name}" &{template:2Edefault}{{name=Shield+2}}{{subtitle=Shield}}{{Shield=1-handed +2 Medium Shield made of wood & metal}}<mark style="color:green">Specs=[Medium Shield,Shield,1H,Shield]</mark>{{AC=+[[2]] against all attacks from the front}}<mark style="color:blue">ACData=[a:Medium Shield+2, st:Shield, +:2,sz:M, wt:10]</mark> {{Speed=[[0]]}} {{Size=M}} {{Immunity=None}} {{Saves=No effect}} {{desc=All shields improve a character\'s Armor Class by 1 or more against a specified number of attacks. A shield is useful only to protect the front and flanks of the user. Attacks from the rear or rear flanks cannot be blocked by a shield (exception: a shield slung across the back does help defend against rear attacks). The reference to the size of the shield is relative to the size of the character. Thus, a human\'s small shield would have all the effects of a medium shield when used by a gnome.<br>
 
*The medium shield* is carried on the forearm and gripped with the hand. Its weight prevents the character from using his shield hand for other purposes. With a medium shield, a character can protect against any frontal or flank attacks.}}</p>
 
<p>As can be seen here, the specification for a Shield is almost identical in structure to that of any other armour, the major difference being in the Specs section type field.</p>
 
<p><b>Note:</b> The <b>ac:</b> field in the data section for a shield is always assumed to be “+1”, meaning a shield adds 1 to the base AC before magical adjustments are taken into account.  However, it can be specified as a different value, if desired.</p>
 
<p><b>Note:</b> All shields except a <i>Buckler</i> must be taken in hand using the <b>!attk --weapon</b> command before the Armour Class system of the AttackMaster API adds it to the AC for the character.  A <i>buckler</i> is a special type of very small shield that is strapped to the arm and can counter only 1 blow per melee round, but allows both (all) hands to be free.  In fact, any shield can have this functionality if desired, by setting the handedness field of the Specs section to be “0H”, meaning it take no hands to hold it.</p>
 
<br>
 
===Armour-of-Vulnerability+-3===
 
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;">/w "@{selected|character_name}" &{template:2Edefault}{{name=Field Plate Armour of Vulnerability+/-3}}{{subtitle=Cursed Armour}}{{Armour=+/-3 selectively magical Field Plate}}<mark style="color:green">Specs=[Armour-of-Vulnerability|Armour-of-Resistance,Armour,0H,Plate]</mark>{{AC=[[2]][[0-3]] better AC against Slashing damage
 
+[[3]] worse AC against any other type}}<mark style="color:blue">ACData=[a:Armour-of-Vulnerability+-3,st:Mail,+S:3,+P:-3,+B:-3,ac:2,sz:L,wt:60,sp:0,rc:cursed]</mark>{{Speed=0}}{{Size=Large}}{{Immunity=None}}{{Saves=No effect}}{{desc=***Curse.*** This armor is cursed, a fact that is revealed only when an identify spell is cast on the armor or you attune to it. Attuning to the armor curses you until you are targeted by the remove curse spell or similar magic; removing the armor fails to end the curse. While cursed, you have vulnerability to two of the three damage types associated with the armor (not the one to which it grants resistance).}}{{desc1=This armour provides resistance to Slashing damage only, but vulnerability to Piercing and Bludgeoning damage.<br>
 
This armor is a combination of chain or brigandine with metal plates (cuirass, epaulettes, elbow guards, gauntlets, tasets, and greaves) covering vital areas. The weight is distributed over the whole body and the whole thing is held together by buckles and straps. This is the most common form of heavy armor.<br>
 
For each +1 bonus to armor, regardless of the type of armor, the wearer\'s Armor Class moves downward (toward AC 2 . . . to 1 . . . to 0, -1, -2, and so on). Note, however, that Armor Class can never be improved beyond -10}}</p>
 
<p>This is a slightly more complex type of armour.  It is a cursed item, and generally appears initially as <i>Armour-of-Resistance+3</i>, hence the <b>Specs</b> first parameter of armour type having two possible values, separated by ‘|’.</p>
 
<p>The use of the damage type specific magical adjustment fields can be seen in the data section, along with the use of the <b>rc:</b> field tag with the value <i>‘cursed’</i>.  See section 9 for a complete list of <b>rc:</b> field values.</p>
 
<br>
 
==Specs & Data field values==
 
<p>Below are lists of the current possible values for the item database Ability macro sections.</p>
 
===Specs sections===
 
<pre>Specs=[Type, Item-Class, Handedness, Group-Type]</pre>
 
====Weapon Types====
 
<p>There is an infinite list of weapon types: generally the type is the weapon name without any reference to magical plusses, so the Type of a Longsword+2 is Longsword.  This Type is used to check for Proficiency.</p>
 
====Weapon Item-Classes====
 
<table><tr><td>Melee</td><td>Melee weapon which strikes while in hand</td></tr>
 
<tr><td>Ranged</td><td>Weapon that causes damage when thrown or with ammunition</td></tr>
 
<tr><td>Ammo</td><td>Ammunition for a ranged weapon of a specific Type or Group-Type</td></tr></table>
 
====Weapon Handedness====
 
<table><tr><td> 0H</td><td>A weapon that does not take a hand (e.g. spike on helm)</td></tr>
 
<tr><td> 1H</td><td>A weapon that is 1-handed, such as a short sword</td></tr>
 
<tr><td> 2H</td><td>A weapon that takes 2 hands to wield, such as a longbow</td></tr>
 
<tr><td> 3H</td><td>A weapon that takes 3 hands…</td></tr>
 
<tr><td> 4H</td><td>Etc (e.g. a siege weapon that needs 2 people to operate it)</td></tr>
 
<tr><td> …</td><td>…</td></tr></table>
 
<br>
 
====Weapon Group-Types====
 
<p>Weapon Group-Types determine related weapons for weapon proficiency, and whether it can be used by a Character of a specific class.  The APIs use the definitions in the AD&D2e Fighter’s Handbook section on ‘Tight Groups’, extended to cover certain additional weapons and weapon types.  Those implemented so far for the Weapon databases are:</p>
 
<table><tr><td>Arrow</td><td>Club</td><td>Great-Blade</td><td>Long-Blade</td><td>Short-Blade</td><td>Whip</td></tr>
 
<tr><td>Axe</td><td>Crossbow</td><td>Hook</td><td>Medium-Blade</td><td>Sling</td></tr>
 
<tr><td>Blowgun</td><td>Dart</td><td>Horeshoes</td><td>Pick</td><td>Spear</td></tr>
 
<tr><td>Bow</td><td>Fencing-Blade</td><td>Innate</td><td>Polearm</td><td>Staff</td></tr>
 
<tr><td>Bullet</td><td>Flail</td><td>Lance</td><td>Quarrel</td><td>Throwing-Blade</td></tr></table>
 
<p>Types and Group-Types that can be used by various Character Classes are:</p>
 
<table><tr><td>Warrior</td><td>Any</td></tr>
 
<tr><td>Fighter</td><td>Any</td></tr>
 
<tr><td>Ranger</td><td>Any</td></tr>
 
<tr><td>Paladin</td><td>Any</td></tr>
 
<tr><td>Beastmaster</td><td>Any</td></tr>
 
<tr><td>Barbarian</td><td>Any</td></tr>
 
<tr><td>Defender</td><td>"axe", "club", "flail", "long-blade", "fencing-blade", "medium-blade", "short-blade", "polearm"</td></tr>
 
<tr><td>Wizard</td><td>(all types) "dagger", "staff", "dart", "knife", "sling"</td></tr>
 
<tr><td>Priest / Cleric</td><td>"club", "mace", "hammer", "staff"</td></tr>
 
<tr><td>Druid</td><td>"club", "sickle", "dart", "spear", "dagger", "scimitar", "sling", "staff"</td></tr>
 
<tr><td>Healer</td><td>"club", "quarterstaff", "mancatcher", "sling"</td></tr>
 
<tr><td>Priest of Life</td><td>"club", "quarterstaff", "mancatcher", "sling"</td></tr>
 
<tr><td>Priest of War</td><td>Any</td></tr>
 
<tr><td>Priest of Light</td><td>"dart", "javelin", "spear"</td></tr>
 
<tr><td>Priest of Knowledge</td><td>"sling", "quarterstaff"</td></tr>
 
<tr><td>Shaman</td><td>"long-blade", "medium-blade", "short--blade", "blowgun", "club", "staff", "shortbow", "horsebow", "hand-xbow"</td></tr>
 
<tr><td>Rogue / Thief</td><td>"club", "short-blade", "dart", "hand-xbow", "lasso", "shortbow", "sling", "broadsword", "longsword", "staff"</td></tr>
 
<tr><td>Bard</td><td>Any</td></tr>
 
<tr><td>Assassin</td><td>Any</td></tr></table>
 
<br>
 
====Armour Types====
 
<p>There is an infinite list of armour types: generally the type is the armour name without any reference to magical plusses, so the Type of Plate-Mail+2 is Plate-Mail.  This Type is used to check for Proficiency.</p>
 
<br>
 
====Armour Item-Classes====
 
<p> Armour Any type of armour that does not need to be held to work
 
Shield A barrier that is held in hand(s) and defends against one or more attacks from the front</p>
 
<br>
 
====Armour Handedness====
 
<p> 0H Armour and Shields that are not held in the hand (e.g. a Buckler or a Helm)
 
1H Generally a type of Shield that must be held in a hand
 
2H Armour and Shields that use two hands, and/or prevent use of those hands for other things
 
3H Generally siege engines that shield against attacks… (not yet implemented)
 
… etc.</p>
 
<br>
 
====Armour Group-Types====
 
<p>Armour Types and Group Types determine whether the armour can be used by various Character Classes.  Here are the currently implemented restrictions:</p>
 
<table><tr><td>Warrior Any</td></tr>
 
<tr><td>Fighter</td><td>Any</td></tr>
 
<tr><td>Ranger</td><td>Any</td></tr>
 
<tr><td>Paladin</td><td>Any</td></tr>
 
<tr><td>Beastmaster</td><td>Any</td></tr>
 
<tr><td>Barbarian</td><td>"padded", "leather", "hide", "brigandine", "ring-mail", "scale-mail", "chain-mail", "shield", "ring",  "magic-item","cloak"</td></tr>
 
<tr><td>Defender</td><td>Any</td></tr>
 
<tr><td>Wizard (all types)</td><td>"magic-item", "ring", "cloak"</td></tr>
 
<tr><td>Priest / Cleric</td><td>Any</td></tr>
 
<tr><td>Druid</td><td>"leather", "padded", "hide", "wooden-shield", "magic-item", "ring", "cloak"</td></tr>
 
<tr><td>Healer</td><td>Any</td></tr>
 
<tr><td>Priest of Life</td><td>Any</td></tr>
 
<tr><td>Priest of War</td><td>Any</td></tr>
 
<tr><td>Priest of Light</td><td>"studded-leather", "ring-mail", "chain-mail", "shield", "ring", "magic-item", "cloak"</td></tr>
 
<tr><td>Priest of Knowledge</td><td>"magic-item", "ring", "cloak"</td></tr>
 
<tr><td>Shaman</td><td>"padded", "leather", "hide", "brigandine", "ring-mail", "scale-mail", "chain-mail", "splint-mail", "banded-mail", "shield", "ring", "magic-item", "cloak"</td></tr>
 
<tr><td>Rogue / Thief</td><td>Any</td></tr>
 
<tr><td>Bard</td><td>"padded", "leather", "hide", "brigandine", "ring-mail", "scale-mail", "chain-mail", "ring", "magic-item", "cloak"</td></tr>
 
<tr><td>Assassin</td><td>Any</td></tr></table>
 
<br>
 
===Data Sections===
 
<table>
 
<thead>
 
<tr>
 
<th scope="col" rowspan="2">Field</th>
 
<th scope="col" rowspan="2">Format</th>
 
<th scope="col" rowspan="2">Default Value</th>
 
<th scope="col" rowspan="2">Description</th>
 
<th scope="col" colspan="6">Can be used in</th>
 
</tr>
 
<tr>
 
<th scope="col">ToHit<br>Data</th>
 
<th scope="col">Dmg<br>Data</th>
 
<th scope="col">Ammo<br>Data</th>
 
<th scope="col">Range<br>Data</th>
 
<th scope="col">Weapon<br>Data</th>
 
<th scope="col">AC<br>Data</th>
 
</tr>
 
</thead>
 
<tr><td>w:</td><td>< text ></td><td>\'-\'</td><td>Name to be displayed</td> <td>X</td><td>X</td><td>X</td><td> </td><td> </td><td> </td></tr>
 
<tr><td>w:</td><td>< text ></td><td>\'-\'</td><td>Name of spell or power</td> <td> </td><td> </td><td> </td><td> </td><td>X</td><td> </td></tr>
 
<tr><td>a:</td><td>< text ></td><td>\'-\'</td><td>Name to be displayed</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td>X</td></tr>
 
<tr><td>t:</td><td>< text ></td><td>\'\'</td><td>Type</td> <td> </td><td> </td><td>X</td><td>X</td><td> </td><td>X</td></tr>
 
<tr><td>st:</td><td>< text ></td><td>\'\'</td><td>Group Type (aka Tight-Group)</td> <td> </td><td> </td><td>X</td><td>X</td><td> </td><td>X</td></tr>
 
<tr><td>sb:</td><td>0 / 1</td><td>0</td><td>Strength Bonus</td> <td>X</td><td>X</td><td>X</td><td> </td><td> </td><td> </td></tr>
 
<tr><td>db:</td><td>0 / 1</td><td>1</td><td>Dexterity Bonus</td> <td>X</td><td> </td><td> </td><td> </td><td> </td><td>X</td></tr>
 
<tr><td>+:</td><td>[ + / - ] #</td><td>0</td><td>Magical adjustment</td> <td>X</td><td>X</td><td>X</td><td>X</td><td> </td><td>X</td></tr>
 
<tr><td>+m:</td><td>[ + / - ] #</td><td>0</td><td>Missile attack adjustment</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td>X</td></tr>
 
<tr><td>+s:</td><td>[ + / - ] #</td><td>0</td><td>Slashing damage adjustment</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td>X</td></tr>
 
<tr><td>+p:</td><td>[ + / - ] #</td><td>0</td><td>Piercing damage adjustment </td> <td> </td><td> </td><td> </td><td> </td><td> </td><td>X </td></tr>
 
<tr><td>+b:</td><td>[ + / - ] #</td><td>0</td><td>Bludgeoning damage adjustment</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td>X</td></tr>
 
<tr><td>n:</td><td># [ / # ]</td><td>1</td><td>Attacks per round</td> <td>X</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
 
<tr><td>dp:</td><td>#</td><td>0</td><td>Dancing proficiency adjustment</td> <td>X</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
 
<tr><td>ch:</td><td>1 - 20</td><td>20</td><td>Critical Hit roll value</td> <td>X</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
 
<tr><td>cm:</td><td>1 - 20</td><td>1</td><td>Critical Miss roll value</td> <td>X</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
 
<tr><td>sz:</td><td>[ t / s / m / l / h ]</td><td>\'\'</td><td>Size of item</td> <td>X</td><td> </td><td>X</td><td> </td><td> </td><td>X</td></tr>
 
<tr><td>r:</td><td>[# /] # / # / #</td><td>\'\'</td><td>Range</td> <td>X</td><td> </td><td> </td><td>X</td><td> </td><td> </td></tr>
 
<tr><td>r:</td><td>[+/-]# [ / [+/-]# / [+/-]# / [+/-]# ]</td><td>0</td><td>Range Modifier</td><td>X</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
 
<tr><td>ty:</td><td>SPB any combination</td><td>\'\'</td><td>Type of damage</td> <td>X</td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
 
<tr><td>sp:</td><td>[-]#</td><td>0</td><td>Speed in segments (1/10 round)</td> <td>X</td><td> </td><td> </td><td> </td><td>X</td><td> </td></tr>
 
<tr><td>sm:</td><td>dice roll format</td><td>0</td><td>Damage roll for Small & Medium opponents</td><td> </td><td>X</td><td>X</td><td> </td><td> </td><td> </td></tr>
 
<tr><td>l:</td><td>dice roll format</td><td>0</td><td>Damage roll for Large & Huge opponents</td><td> </td><td>X</td><td>X</td><td> </td><td> </td><td> </td></tr>
 
<tr><td>ac:</td><td>[-]#</td><td>\'\'</td><td>Armour class</td> <td> </td><td> </td><td> </td><td> </td><td> </td><td>X</td></tr>
 
<tr><td>wt:</td><td>#</td><td>1</td><td>Weight of item in lbs</td> <td>X</td><td> </td><td> </td><td> </td><td> </td><td>X</td></tr>
 
<tr><td>ns:</td><td>#</td><td>0</td><td>Number of spells & powers defined for item</td><td> </td><td> </td><td> </td><td> </td><td>X</td><td>X</td></tr>
 
<tr><td>cl:</td><td>MU / PR / PW</td><td>\'\'</td><td>Type of spell or power</td> <td> </td><td> </td><td> </td><td> </td><td>X</td><td> </td></tr>
 
<tr><td>lv:</td><td>#</td><td>1</td><td>Level at which spell/power is cast</td> <td> </td><td> </td><td> </td><td> </td><td>X</td><td> </td></tr>
 
<tr><td>pd:</td><td>-1 / #</td><td>1</td><td>Number per day (power only)</td> <td> </td><td> </td><td> </td><td> </td><td>X</td><td> </td></tr>
 
<tr><td>rc:</td><td>Charged /<br>Uncharged /<br> Rechargeable /<br>Recharging /<br>Self-charging /<br>Cursed /<br>Charged-Cursed /<br>Recharging-Cursed /<br>Self-charging-Cursed</td><td>Uncharged</td><td>Initial charged and Cursed status of item when found</td><td>X</td><td> </td><td> </td><td> </td><td> </td><td>X</td></tr>
 
</table>
 
<br>
 
===Character Sheet data fields===
 
<p>As stated in section 7, the Character Sheet field mapping to the API script can be altered using the definition of the fields object.  You can find the complete mapping for all APIs in the RPGMaster series, with an explanation of each, in a separate document.</p>
 
 
 
= Changelog =
 
{{changelog version|1.037|2021-12-14|* First version for public release}}
 

Revision as of 15:25, 9 January 2022

The MagicMaster API provides functions to manage all types of magic, including Wizard & Priest spell use and effects; Character, NPC & Monster Powers; and discovery, looting, use and cursing of Magic Items. All magical aspects can work with the RoundMaster API to implement token markers that show and measure durations, and produce actual effects that can change character sheet attributes temporarily for the duration of the spell or permanently if so desired. They can also work with the InitiativeMaster API to provide menus of initiative choices and correctly adjust individual initiative rolls, including effects of Haste and Slow and similar spells. Spells can summon weapons to hand via the AttackMaster API and change bonuses on attacks and damage, by weapon or for one or more party members. This API can also interact with the MoneyMaster API (under development) to factor in the passing of time, the cost of spell material use, the cost of accommodation for resting, and the cost of training for leveling up as a spell caster (Wizard, Priest or any other).

Specification for spells, magic items, weapons, armour & shields are implemented as ability macros in specific database character sheets. This API comes with a wide selection of such specifications, held in databases that are created and updated automatically when the API is run. The GM can add to the provided items in the databases using standard Roll20 Character Sheet editing, following the instructions provided in section 8.

API ScriptAuthor: Richard E
Version: 2.044
Last Modified: 2022-01-09
Code: MagicMaster
Dependencies: ChatSetAttr, Tokenmod, RoundMaster, InitiativeMaster, AttackMaster
Conflicts: None

Contents

What MagicMaster does

Item, Spell and Power databases

MagicMaster uses a large range of items held in databases. The current versions of these databases are distributed with the API, will be automatically created in any campaign the API is installed in and updated as new versions are released via Roll20. Spell, Power and Item Databases are implemented as ability macros in specific library character sheets. These macros can do anything that can be programmed in Roll20 using ability macros and calls to APIs, and are found and called by the MagicMaster API when the Player selects them using the menus provided by the MagicMaster functions. The GM can add to the provided items in the databases using standard Roll20 Character Sheet editing, following the instructions provided in the Magic Database Handout.

Spells and Powers

The Ability Macros for spells and powers include descriptions of the spell they represent (limited, I'm afraid, to avoid copyright issues), and also can optionally have API Buttons embedded in them which, if selected by the Player, can enact the actions of the spell or power. The API Buttons call one or more of the API commands listed in this document, or commands provided by other APIs. This is most powerful when combined with the RoundMaster API to implement token statuses and status markers with durations and effect macros, enabling the spells & powers to make temporary (or permanent, if desired) changes to the targeted creature's token and character sheet attributes.

The best way to learn about these capabilities is to look at example spell definitions in the databases and use those spells or powers to see what they do.

Adding Spells & Powers to the Character

Spells need to be added in two steps: 1. adding to a Character's or NPC's spell book; and 2. Memorising the spells each day.

The simplest way to add spells to a Character's spell books is to use the CommandMaster API functions that set up Character Sheets from scratch. However, spells can be added to the Character Sheet manually: see the RPG Master CharSheet Setup handout (created by the API) for details of how to do this. Either approach results in the Character having a list of spells at each spell level they can use that they have available to memorise.

Spells can be memorised using the --mem-spell MagicMaster command. This limits the number of spells memorised at each level to the number that is valid for the Character, with their specific characteristics, class, level and other valid adjustments (though it is possible to add a “fudge factor” if needed via the menu). Once memorised, they can be rememorised or changed at any time, though the DM usually limits this in game play to once each in-game day. If a Player is happy with the spells a Character has, the Character just needs to rest at the end of the day to regain their spells (and powers, and recharging magic item charges) automatically.

Powers are added in exactly the same way as Spells. The difference between the two is that Powers are granted to a Character, either as a function of the class they have adopted, or from being granted powers in game-play. Of course, NPCs and creatures also have many various powers. Some Powers can be used more than once a day, or even 'at will' (an example is Priests turning undead).

Casting spells and using powers

Spells memorised by the Character can be cast using MagicMaster menus. As with items, when used with the InitiativeMaster API the action for the next round can be the casting of a specific spell, with the speed of the Casting Time. Casting a spell will remove it from memory for the rest of the day, but a rest will bring it back. Like items, spells use Roll20 ability macros and thus can perform any function a macro or an API call can achieve. The same capability to affect tokens and Character Sheets is available if used with the RoundMaster API.

Types of Item Provided

The Item database is split into nine parts: Weapons, Ammunition, Armour, Lights, Potions, Scrolls & Spellbooks, Wands Staves & Rods, Rings, and Miscellaneous. More might be added in future releases, and any DM can add more databases with their own items.

Armour can be used by the AttackMaster API to automatically set the Character's Armour Class, including altering AC as a shield is taken in hand or put away, and taking into account items such as Rings of Protection and Bracers of Defense. Weapons and Ammunition can also be taken in hand to attack with. Weapons can dance, and thrown weapons and ammunition can be magically self-returning (they don't have to be retrieved by the AttackMaster Recover Ammo function).

Many magic items have actions that they can perform in the same way as Spells & Powers, using API Buttons in their macros that call MagicMaster API commands, or commands from other APIs. As with spells & powers, this is most powerful when combined with the capabilities of the RoundMaster API.

Items can have stored spells (like Rings of Spell Storing) and the spells can be cast from them, and/or can have powers that can be consumed and are refreshed each day. The spells and powers can have temporary or permanent effects on Tokens and Character Sheets, if desired, via RoundMaster functions.

Adding Items to the Character

The MagicMaster API provides commands to perform menu-driven addition of items to the Character Sheet. Using these commands will set up all the necessary fields so that the Player can use the items with the other APIs - if using MagicMaster then items should not be added directly to the Character Sheet.

Items can also be acquired by finding them in chests or on tables (tokens with images of chests & tables that represent Character Sheets with items added to them) that can be looted, or even dead bodies of NPCs that have been killed in battle. MagicMaster provides commands that support a menu-driven way to perform looting. Characters, especially Rogues, can even try to Pick Pockets to take items from NPCs (or even other Characters…), though failure may alert the DM (or other Player) to the attempt. Containers can even be trapped, with magical consequences if the trap goes off! On the other hand, Characters can also put items away into chests or onto tables or other storage places, or give them to other Characters or NPCs, all using easy menus and button clicks.

Using Items

Items possessed by the Character can be used to perform their functions, using MagicMaster menus. When used with the InitiativeMaster API, the action for the next round can be the use of a specific item the Character has on them, with the speed of that item. This may use charges or consume quantities of the item, and these charges may or may not be regained overnight, or through other means. The items use Roll20 ability macros that can be as simple as putting text in the chat window explaining what the item does, through to much more complex targeting of effects on the user, a single other target, or all tokens in a defined area. When used with the RoundMaster API, targeted tokens can have a status marker applied with a pre-determined duration and associated effects at the start, each round and when it finishes. Items that are totally consumed will automatically disappear from the Character Sheet.

Dynamic lighting for tokens

MagicMaster API provides commands to change the lighting settings of the token to reflect illumination, as if holding various light sources. This includes both radiant light sources such as hooded lanterns, torches, continual light gems, magic items and magic armour, and also directed light sources such as beacon lanterns and bullseye lanterns which only illuminate in beams.

DM tools

The DM is provided with tools to be able to add items to chests, NPCs, Characters etc. These tools allow the DM to also change certain aspects of the items, including the displayed name and the cursed status of the item. Items that are cursed are not obvious to Characters and Players, and such items can be 'hidden' and appear to be other items until revealed as the cursed item by the DM.

The tools also allow the DM to increase or restrict the number of items Characters can have on their person: it is then possible to give each Character a 'backpack' token/character sheet, which the Character can store items to and get items from - of course, retrieving an item from the backpack takes a round… They can even have horses with saddlebags that can hold items.

DMs can also add their own items, spells and powers to additional databases (the provided databases should not be added to, but entries can be replaced by new entries in your own databases - updates will not overwrite items you create in your own databases). This requires some knowledge of Roll20 macro programming and use of APIs. See the Roll20 Help Centre for information, and the information in Section 8 of this document.


Syntax

The MagicMaster API is called using !magic (or the legacy command !mibag).

!magic --help

Commands to be sent to the MagicMaster API must be preceded by two hyphens '--' as above for the --help command. Parameters to these commands are separated by vertical bars '|', for example:

!magic --mi-power token_id|power_name|mi_name|[casting-level]

If optional parameters are not to be included, but subsequent parameters are needed, use two vertical bars together with nothing between them, e.g.

!magic --cast-spell MI|[token_id]||[casting_name]

Commands can be stacked in the call, for example:

!magic --spellmenu [token_id]|[MU/PR/POWER] --mimenu [token_id]

When specifying the commands in this document, parameters enclosed in square brackets [like this] are optional: the square brackets are not included when calling the command with an optional parameter, they are just for description purposes in this document. Parameters that can be one of a small number of options have those options listed, separated by forward slash '/', meaning at least one of those listed must be provided (unless the parameter is also specified in [] as optional): again, the slash '/' is not part of the command. Parameters in UPPERCASE are literal, and must be spelt as shown (though their case is actually irrelevant).

Command Index

Spell and Power management

--spellmenu [token_id]|[MU/PR/POWER]<br>
--mem-spell (MU/PR/POWER)|[token_id]<br>
--view-spell (MU/PR/POWER)|[token_id]<br>
--cast-spell (MU/PR/POWER/MI)|[token_id]|[casting_level]|[casting_name]<br>
--cast-again (MU/PR/POWER)|token_id|[spell_name]

Magic Item management

--mimenu [token_id]<br>
--edit-mi [token_id]<br>
--view-mi [token_id]<br>
--use-mi [token_id]<br>
--mi-charges token_id|value|[mi_name]|[maximum]<br>
--mi-power token_id|power_name|mi_name|[casting-level]<br>
--mem-spell (MI-MU/MI-PR)|[token_id]<br>
--view-spell (MI-MU/MI-PR/MI-POWER)|[token_id]<br>
--cast-spell MI|[token_id]|[casting_level]|[casting_name]|[CHARGED]|[mi-name]

Spell, power & magic item effects and resting

!rounds --target CASTER|token_id|spell_name|duration|increment|[msg]|[marker]<br>
!rounds --target (SINGLE/AREA)|token_id|target_token_id|spell_name|duration|increment|[msg]|[marker]<br>
--touch token_id|effect-name|duration|per-round|message|marker<br>
--rest [token_id]|[SHORT/LONG]|[MU/PR/MU-PR/POWER/MI/MI-POWER]|[timescale]

Treasure & Item container management

--gm-edit-mi [token_id]<br>
--search token_id|pick_id|put_id<br>
--pickorput token_id|pick_id|put_id|[SHORT/LONG]

Light source management

--lightsources [token_id]<br>
--light token_id|(NONE/WEAPON/TORCH/HOODED/CONTLIGHT/BULLSEYE/BEACON)<br>
--changelight token_id|(NONE/WEAPON/TORCH/HOODED/CONTLIGHT/BULLSEYE/BEACON)

Other commands

--help<br>
--check-db [ db-name ]<br>
--debug (ON/OFF)


Spell management

Display a menu to do actions with spells

--spellmenu [token_id]|[MU/PR/POWER]

Takes an optional token ID and an optional menu type as arguments. If token ID is not specified, uses the selected token.

MU:displays buttons for Magic User/Wizard spells for casting, resting (short or long), memorising spells from the character's spell book, or viewing the memorised spells.
PR:displays buttons for Priest spells for casting, resting (short or long), memorising spells from the character's spell book, or viewing the memorised spells.
POWER:displays buttons for using powers, doing a long rest, changing/resetting powers from the character's granted powers, or viewing the granted powers.
None of the above:the system will check the class(es) of the character and display the appropriate menu, or if a multi-class character including both a Wizard and a Priest, ask if the player wants to display Magic User or Priest menus.

If the specified token is not associated with a character that has a spell book of the chosen type, or any granted powers, an error message is displayed.

Display a menu to memorise spells from the Character's spell book

--mem-spell (MU/PR/POWER/MI-MU/MI-PR)|[token_id]

Takes a mandatory spell book type and an optional token ID as arguments. If token ID is not specified, uses the selected token.

The Character Sheet associated with the token must have spell books specified for the relevant types of spells or powers. These are lists of spells from the spell macro databases (see Section 7) specified by level (powers are all 1 level) and as lists separated by '|'. E.g. Charm-Person|Light|Sleep. If the CommandMaster API is installed, the GM can use its menus to set up character spell books and granted powers.

Initially displays a menu for memorising Level 1 spells (the only level for powers), with a button to choose a spell from the Level 1 spell book on the character sheet, Review the chosen spell, and all the memorising slots the Character has at this level. Other buttons to memorise or remove spells become available when spells or slots are chosen. Another button goes to the next available level with slots. When a granted power is memorised to a slot, a quantity per day can be specified: -1 will grant unlimited uses of the power per day. Memorising any other type of spell is limited to 1 use per slot.

MI-MU and MI-PR have a special function: these are used to cast memorised spells into a spell-storing magic item (which should be the last item selected by the Character running the command), such as a Ring of Spell Storing. Magic Item spells are stored in an unused level of the Character Sheet. This command displays both all memorised spells and all spell-storing magic item spell slots, and allows a memorised spell to be selected, a slot (for the same spell name) to be selected, and the spell cast from one to the other.

View the memorised spells or granted powers

--view-spell (MU/PR/POWER/MI-MU/MI-PR/MI-POWER)|[token_id]

Takes a mandatory spell type and an optional token ID. If token ID is not specified, uses the selected token.

Displays a menu of all levels of memorised spells of the selected type (there is only 1 level of powers). Spells that have already been cast appear as greyed out buttons, and can't be selected. Spells that are still available to cast that day can be selected and this runs the spell or power macro from the relevant database without consuming the spell, so that the Player can see the specs.

Adding MI- before any of the types of spell views the spells or powers available for the last Magic Item used by the Character using the command. Generally this version of the command is only called from API Buttons from the magic item's ability macro.

Cast a memorised spell or use a granted power

--cast-spell (MU/PR/POWER/MI)|[token_id]|[casting_level]|[casting_name]|[CHARGED]

Takes a mandatory spell type, an optional token ID (if not specified, uses the selected token), an optional casting level, and an optional caster name, and an optional 'CHARGED' command.

This displays a menu of all levels of the memorised spells/powers of the relevant type. MI displays the spell book for all stored spells (both MU & PR), and MI-POWER all stored powers in the last selected magic item, (this version of the command is generally called using an API Button in the magic item ability macro). The player can select a spell/power and then a button becomes available to cast it, using up that slot/deducting a power charge until the next long rest.

If a casting_level is specified, the spell will be cast as if by a caster of that level, and if a casting_name is specified, that name will be displayed in the spell macro information. These functions are often used for magic items that cast at specific levels of use, or magic artefacts that are named and/or sentient. If these are not specified, the caster name and relevant class level are used. In either case, specified or not, the character's Character Sheet Attributes called @{Casting-name} and @{Casting-level} are set to the values used, and can be used in spell, power, or magic item macros.

If the optional CHARGED parameter is specified (only relevant to spells and powers stored on magic items), this specifies that the Magic Item from which the spell or power is cast is charged, and looses one charge when that cast is made. This is generally the case when the spell or power is on a Scroll. When the charge quantity reaches zero, the item will follow the behaviour determined by its charge type (charged, uncharged, rechargeable, recharging, self-charging) - see section 4.1 for more information on charges and charge types.

Cast the last used spell or power again

--cast-again (MU/PR/POWER)|token_id|[spell_name]

Takes a mandatory spell type, a mandatory token ID and an optional spell name.

This command is used for certain spells and powers that, once cast, allow continuing effects in the same or subsequent rounds, without using additional charges. If the optional spell name is not used, the command just casts again the same spell as the last spell cast by the character associated with the selected token, at the same casting level and casting name. If a spell name is specified, this spell is cast instead as if it were the same spell: this is used where different spell macros are required to specify subsequent spell effects.


2. Magic Item management

Display a menu of possible Magic Item actions

--mimenu [token_id]

Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.

Displays a menu with the following actions: Use a magic item, Search for magic items & treasure, Store magic items in a container, Edit the contents of a character's magic item bag, and View the contents of a character's magic item bag.

Searching & Storing are explained in section 4.

Edit a Magic Item bag

--edit-mi [token_id]

Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.

Displays a menu similar to editing memorised spells. At the top are buttons to choose different types of magic items which have macros in the magic item databases. The slots available in the bag are shown (with their current contents) and, when magic items and/or slots are chosen buttons become selectable below to store, review, or remove magic items in/from the bag.

Storing a magic item will ask for a number - either a quantity or a number of charges. Magic Items can be of various types: Charged (is used up when reaches 0), Uncharged (a number is a pure quantity that is not consumed), Recharging (regains charges after each long rest), Rechargable (is not used up when reaches 0, stays in bag and can be recharged when the DM allows), Self-charging (recharge at a rate per round determined by the item) and can also be Cursed - more under section 4.

This menu is generally used when Magic Item & treasure containers (such as Treasure Chests and NPCs/monsters with treasure) have not been set up in a campaign as lootable as a means of giving found magic items to characters, and the DM just tells the Player that they have found a magic item.

View a character's Magic Item Bag

--view-mi [token_id]

Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.

Displays a menu of items in the character's magic item bag, with the quantity possessed or the number of charges. Pressing a button displays the named Magic Item specs without using any charges so that the Player can review the specifications of that item. Items for which all charges have been consumed are greyed out, and cannot be viewed as the character can no longer use them. They will become viewable again if they gain charges.

Use a Magic Item from the bag

--use-mi [token_id]

Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.

Displays a similar menu as for viewing the contents of the Magic Item Bag, but when an item is selected, a button is enabled that uses the Magic Item and consumes a charge. Other buttons specified in the item macro might use additional charges to perform additional effects. See section 3.

Items with 0 quantity or charges left are greyed out, and cannot be selected. When a Charged Item reaches 0 charges left, it is removed from the character's Magic Item Bag automatically.

Add, set or deduct Magic Item charges

--mi-charges token_id|[+/-]value|[mi_name]|[maximum]

Takes a mandatory token ID, a mandatory value preceeded by an optional + or -, and an optional magic item name and optional maximum value as arguments.

Does not display anything but alters the number of current or recoverable charges on an item. By default, alters the last magic item used by the character, or will affect the named magic item. Warning: a character can have two items of the same name, and there is no guarantee which will be affected if the name is used.

Remember: using a Charged, Recharging, Rechargeable or Self-Charging Magic Item will automatically use 1 charge on use. This command is not required in order for that to happen. In addition, that one charge deduction always happens - if an effect of a Magic Item uses 2 charges, only 1 more needs to be deducted.

Note: '-' reduces current remaining charges, '+' adds to the maximum recoverable charges, and no + or - sets the maximum recoverable charges. This command cannot be used to increase the current remaining charges.

Using minus '-' before the value will deduct charges from the current quantity/charges: e.g. if using an optional power of the item that uses more than 1 charge. Using + before the value will add the value to the number of recoverable charges (either overnight or rechargeable), up to any specified maximum (often used for magic items that regain variable numbers of charges overnight). Just using the value without + or - will just set the number of recoverable charges to the given value. This command is not required to recharge self-charging items but can be used to change the maximum number of charges they will self-charge up to.

Use a Magic Item power

--mi-power token_id|power_name|mi_name|[casting-level]

Takes a mandatory token ID, mandatory power name, mandatory magic item name, and an optional casting level as parameters.

Magic Items, especially artefacts, can have their own powers that can be used a specified number of times a day, or at will. This command can be used in API buttons in the Magic Item macro to call on that power. The power name and the magic item name must be specified to select the right power. If a casting level is specified, any relevant impacts on use of the power will be taken into account: it is often the case that magic items use powers at specific levels. If not specified, the item using Character's level is used (user does not need to be a spell caster).

Generally, magic item powers have unique names, though they do not have to. Such magic items require specific setting up by the DM - see later sections.

Store spells in a spell-storing Magic Item

--mem-spell (MI-MU/MI-PR)|[token_id]

Takes a mandatory spell type, an optional Token ID for the character, and an optional magic item name. If token ID is not provided, it uses the selected token. If the magic item name is not provided, uses the last magic item selected, viewed or used by the character represented by the token.

MI-MU and MI-PR mem-spell types are used to cast memorised spells into a spell-storing magic item, such as a Ring of Spell Storing. Magic Item spells are stored in an unused spell level of the Character Sheet (by default Wizard Level 15 spells). This command displays both all the character's memorised spells and the spell-storing magic item spell slots in the last magic item selected by the Character, and allows a memorised spell to be selected, a slot (for the same spell name - limiting the item to only store certain defined spells) to be selected, and the spell cast from one to the other.

Unlike some other menus, however, magic item spell slots that are full are greyed out and not selectable - their spell is intact and does not need replacing. Spell slots that need replenishing are displayed as selectable buttons with the spell name that needs to be cast into the slot.

The level of the caster at the time of casting the spell into the magic item is stored in the magic item individually for each spell - when it is subsequently cast from the spell-storing magic item it is cast as if by the same level caster who stored it.

A spell-storing magic item can hold spells from one or both of Wizard and Priest spells. The database where the spell is defined is also stored in the magic item with the spell, so the correct one is used when at some point in the future it is cast. If, when cast, the system can't find the database or the spell in that database (perhaps the character has been moved to a different campaign with different databases) the system will search all databases for a spell with the same name - this does not guarantee that the same spell will be found: the definition used by a different DM could be different - or the DM may not have loaded the database in question into the campaign for some reason. In this case, an error will occur when the spell is cast.

See Section 8.3 for how spell-storing magic items are defined.

Casting a spell from a spell-storing magic item

--cast-spell MI|[token_id]|[casting_level]|[casting_name]|[CHARGED]|[mi-name]

Takes a mandatory casting type of 'MI', an optional Token ID (if token ID is not provided, it uses the selected token), an optional casting level (which will be ignored in favour of the level of the caster of the spell who cast it into the item), an optional casting name which, if not specified, will be the name of the wielder of the magic item, and an optional magic item name (if not provided, uses name of the last magic item the character selected, viewed or used).

This command works in the same way as for casting other spells. However, spells cast from a spell-storing magic item are not regained by resting - either short or long rests. The only way to regain spells cast from such an item is to cast them back into the item from the character's own memorised spells: see the -mem-spell command above. If the character does not have these spells in their spell book or is not of a level able to memorise them, then they will not be able to replace the spells and will have to get another spell caster to cast them into the item (by giving the item to the other Character and asking nicely for it back again) or wait until they can get the spells.

If the optional parameter 'CHARGED' is used, spells on the magic item are not re-storable. The spells will be deleted after they are all used up and the magic item will not be able to store any more spells. This is mainly used for Scrolls with multiple spells.


Spell, power & magic item effects and resting

If this API is used in conjunction with the RoundMaster API, Magic Items, Spells & Powers can all place status markers on tokens, and also cause real Effects to alter token & character sheet attributes and behaviours: when cast; during each round of their duration; and when they expire. See the RoundMaster documentation for further information, especially on Effects and the Effects Database.

Target spell effects on a token (with RoundMaster API only)

!rounds --target CASTER|token_id|spell_name|duration|[+/-]increment|[msg]|[marker]<br>
!rounds --target (SINGLE/AREA)|token_id|target_token_id|spell_name|duration|increment|[msg]|[marker]

Takes mandatory CASTER, SINGLE or AREA command, a mandatory caster token ID, for SINGLE/AREA a mandatory target token ID, mandatory spell name, duration & increment (preceeded by an optional +/-), and an optional message and optional token marker name.

If using the RoundMaster API, this command targets one, or a sequential set of tokens and applies a token marker to the token for the specified duration number of rounds, with the increment applied each round. The optional message will be shown below that token's turn announcement each round. The marker used will either be the one specified or if not specified a menu to choose one will be shown.

CASTERwill just take one Token ID and apply the marker to that token.
SINGLEwill take both the Token ID of the caster, and the Token ID of a target of the spell/power/MI. The marker will be applied to that of the target.
AREAwill take the Token ID of the caster, and one Token ID of the first token in the area of effect. As each token is specified the command will ask the Player to select subsequent tokens in the area of effect.

If the Player is not the DM/GM, the system will ask the DM/GM to approve the marker/effect for each token - this allows the DM to make saving throws for monsters/NPCs affected where appropriate.

See the RoundMaster API documentation for full details.

Cast a spell that requires a “touch” attack roll

--touch token_id|effect-name|duration|per-round|[message]|[marker]

Takes mandatory token ID, effect name, duration of the effect, an increment to the duration per round (often -1), an optional message each round for the targeted token, and an optional status marker to use (if not supplied, the DM or user will be asked to select one).

Note: this command requires RoundMaster API to also be loaded, but is a !magic command.

Sets up the Character represented by the specified token ready for an “Attack Roll” to deliver a touch attack for a spell or power or magic item use that requires an attack. The parameters are those that will be passed to the !rounds -target command if the attack is successful (see above).

To use this command, add it as part of a spell, power or MI macro in the appropriate database, before or after the body of the macro text (it does not matter which, as long as it is on a separate line in the macro - the Player will not see the command). Then include in the macro (in a place the Player will see it and be able to click it) an API Button call [Button name](~Selected|To-Hit-Spell) which will run the Ability “To-Hit-Spell” on the Character's sheet (which has just been newly written there or updated by the -touch command).

Thus, when the Player casts the Character's spell, power or MI, they can then press the API Button when the macro runs and the attack roll will be made. If successful, the Player can then use the button that appears to mark the target token and apply the spell effect to the target.

See the RoundMaster API documentation for further information on targeting, marking and effects.

Perform Short or Long Rests

--rest [token_id]|[SHORT/LONG]|[MU/PR/MU-PR/POWER/MI/MI-POWER]|[timescale]

Takes an optional token ID (if not specified, uses the selected token), an optional rest type, short or long, an optional magic type to regain charges for, and an optional timescale for days passing.

Most magic requires the character to rest periodically to study spell books, rememorise spells, and regain powers and charges of magic items. This command implements both Short and Long rests.

The type of rest (short or long) can be specified or, if not specified, the system will ask the Player what type of rest is to be undertaken - though Long Rests will be disabled if the Timescale (either the optional value or the character sheet attribute) is not 1 or more days (see below). The type of magic to be affected can also be specified or, if not specified, all types of magic are affected.

A Short rest is deemed to be for 1 hour (though this is not a restriction of the system and is up to the DM), and allows spell casters (such as Wizards and Priests, as well as others) to regain their 1st level spells only. This can happen as often as the DM allows.

A Long rest is considered to be an overnight activity of at least 8 hours (though again this is not a restriction of the system and is up to the DM). A Long rest allows spell casters to regain all their spells, all character and magic item powers to be regained to full uses per day, and for recharging magic items to regain their charges up to their current maximum. After a long rest, ammunition that has been used but not recovered can no longer be recovered using the Ammunition Management command (see AttackMaster API documentation): it is assumed that other creatures will have found the ammo, or it has been broken or otherwise lost in the 8 hours of the long rest.

A Long rest can only be undertaken if certain conditions are met: either the optional Timescale (in days) must be specified as 1 or more days, or the Character Sheet must have a Roll20 attribute called Timescale, current, set to a value of 1 or more (can be set by InitiativeMaster API --end-of-day command). An internal date system is incremented: an attribute on the Character Sheet called In-Game-Day is incremented by the Timescale, and Timescale is then set to 0.

If the InitMaster API is being used, the system will interact with the “End of Day” command to allow rests to be coordinated with the choice of accommodation (and its cost…!).


Treasure & Item container management

DM/GM version of Magic Item management

--gm-edit-mi [token_id]

Takes an optional token ID. If token ID is not specified, uses the selected token.

This command opens a menu showing all the items in the Backpack of the character sheet associated with the specified token. Unlike the Player version of the command (--edit-mi), this command shows all attributes of every magic item, including those of hidden and cursed items, and also offers an additional list of “DM Only” magic items from the magic item databases.

The following functions are available once both a magic item is selected from the lists, and a slot to store it in are selected:

Store item:Select a magic item from the databases and store it in a slot - this is the same as the Player version.
Hide item as different item:The magic item already in the selected bag slot is given the displayed name of the magic item selected from the databases - the Player will only see the Magic Item selected (Displayed Name), and not the hidden actual name. The MI will behave exactly like the selected, displayed item until the DM reverts the item to the hidden version using the [Reset Single MI] button. This is generally used for Cursed items in containers, so that the real nature of the item is hidden until the character discovers the curse.
Remove MI:Blanks the selected Bag slot, removing all details, both displayed & actual.
Change MI Type:This allows the type of the item in the selected Bag slot to be changed. It can be one of the following - Charged, Uncharged, Recharging, Rechargeable, Self-chargeable, Cursed, Cursed-Charged, Cursed-Self-chargeable, Cursed-Recharging (cursed rechargeable items behave in exactly the same way as Cursed-Charged items). Cursed versions of items cannot be removed from the character's MI Bag, given away, stored or deleted by the Player, even when all their charges are depleted. Otherwise, they act in the same way as other magic items.
Change Displayed Charges:Changes the number of displayed/current charges for the item in the selected Bag slot. This can be used to set the quantity of Uncharged items, or the current charges of other types. It also allows charged items in containers to be stored as a single item, for instance single Wands with multiple charges - see the pickorput command below.
Change Actual Charges:Setting this allows the actual quantity of Uncharged items in containers to be hidden, or the maximum number of charges to be set for other types. When the item is picked up from a container, the actual number of charges will be set as the current value.
Change Item Cost:Items can have a cost in GP (fractions allowed which get converted to SP & CP). When an item is picked up from a container, the cost will be multiplied by the quantity picked up and the Player will be asked if they want the character to pay the cost. If confirmed, the cost will be deducted from the money values on the character sheet. 0 and negative values are allowed. This supports merchants and shops to be created in the campaign.
Reset Single MI:Allows the DM to reset the item in the selected Bag slot to the actual values, revealing any hidden name, and resetting the displayed quantity to be the actual quantity. From that point on, the item will behave as the revealed item. This is mostly used to reveal cursed items.
Edit Treasure:Mainly for use on Magic Item containers, such as Treasure Chests, but also useful for NPCs and Monsters. Allows the DM to add text only treasure descriptions to the container. The displayed menu allows [Add], [Edit], and [Delete] functions to manage multiple lines/rows of treasure description.
Container Type:Sets the type of the Magic Item container or Bag. Available choices are: Empty Inanimate object, Inanimate object with stuff, Sentient Being with empty Bag, Sentient Being with items, Trapped container. If searched, Inanimate objects can be looted without penalty; Sentient beings require a Pick Pockets check; Trapped containers call a Trap ability macro on the container's character sheet to determine the effect. See -search command below.
Container Size:Sets the maximum number of items that can be stored in the selected Character's/containers bag. The default is 18 items, though identical items can be stacked.

Search tokens for Magic Items and Treasure

--search token_id|pick_id|put_id

Takes a mandatory token ID, mandatory token ID of the token to search and pick up items from, mandatory token ID of the token to put picked up items in.

This command can be used to pick the pockets of an NPC or even another Player Character, as well as to loot magic item and treasure containers such as Chests and dead bodies. It can also be used for putting stuff away, storing items from the character's Magic Item Bag into a container, for instance if the MI Bag is getting too full (it is limited to the number of items specified via the --gm-edit-mi menu, though similar items can be stacked). The effect of this command when looting (i.e. the Character's token_id is also the put_id) depends on the Container Type of the searched token set by the DM using the -gm-edit-mi command menu:

Inanimate without items:a message is shown to the Player saying the container is empty or, if there are no Magic Items but there is text describing contained treasure, this will be displayed.
Inanimate with items:the items in the container are displayed, and the character doing the search (associated with the put_id token ID) can pick them up and store them in their own Magic Item Bag.
Sentient being without items:a Pick Pockets check is undertaken - the Player is asked to roll a dice and enter the result (or Roll20 can do it for them), which is compared to the Pick Pockets score on their character sheet. If successful, a message is displayed in the same way as an Inanimate object. If unsuccessful, a further check is made against the level of the being targeted to see if they notice, and the DM is informed either way. The DM can then take whatever action they believe is needed.
Sentient being with items:the Pick Pockets check is done the same way as above, but if successful, the items in the target's Magic Item Bag are displayed and the Player can pick them up and store them in their character's Magic Item Bag.
Trapped container:Traps can be as simple or as complex as the DM desires. Traps may be nothing more than a lock that requires a Player to say they have a specific key, or a combination that has to be chosen from a list, and nothing happens if it is wrong other than the items in the container not being displayed. Or setting it off can have damaging consequences for the character searching or the whole party. It can just be a /whisper gm message to let the DM know that the trapped container has been searched. Searching a trapped container with this command calls an ability macro called “Trap-@{container_name|version}” on the container's character sheet: if this does not exist, it calls an ability macro just called “Trap”. The first version allows the Trap macro to change the behaviour on subsequent calls to the Trap functionality (if using the ChatSetAttr API to change the version attribute), for instance to allow the chest to open normally once the trap has been defused or expended. This functionality requires confidence in Roll20 macro programming.
Important Note: all Character Sheets representing Trapped containers must have their 'ControlledBy' value (found under the [Edit] button at the top right of each sheet) set to 'All Players'. Otherwise, Players will not be able to run the macros contained in them that operate the trap!

Looting without searching, and storing items in a container

--pickorput token_id|pick_id|put_id|[SHORT/LONG]

Takes a mandatory token ID for the Player's character, a mandatory token ID for the token to pick items from, a mandatory token ID for the token to put items in to, and an optional argument specifying whether to use a long or a short menu.

This command displays a menu from which items in the Backpack Bag on the character sheet associated with the Pick token can be selected to put in the Bag of the character sheet associated with the Put token. The Player's character's token can be either the Put token (if picking up items from a container) or the Pick token (if storing items from their Bag into the container). The other token can be another Player Character (useful for one character giving a magic item to another character) or any other selectable token with a character sheet. No traps or sentient being checks are made by this command - this allows the DM to allow Players to bypass the searching functionality when looting a container or storing items in it. Note: the Player's Magic Item menu (accessed via the -mimenu command) does not have an option to loot without searching, but the Store function on that menu does not use Search.

There are two forms of this menu - the Long form displays all items in the container as individual buttons for the Player to select from, and a single button to store the item: this is generally OK when looting containers with not much in them. The Short form of the menu shows only two buttons: one button which, when clicked, brings up a pick list of all the items in the Pick container, and another button to store the item in the Put container: this is generally best for when a character is storing something from their MI Bag into a chest or other container, or giving an MI to another character, as a character's MI Bag often has many items in it which can make a Long menu very long. Each type of menu has a button on it to switch to the other type of menu without re-issuing the command. If not specified in the command, the type of menu the Player last used in this campaign is remembered and used by the system.


Light source management

These functions use Roll20 Dynamic Lighting to provide a token with a light source. If your campaign does not use Dynamic Lighting, they will not function. They can also be accessed through the menu displayed by the AttackMaster API -other-menu command.

Show a menu of Light Sources to select from

--lightsources [token_id]

Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.

This command brings up a menu showing a selection of various light sources that a character can use. Selecting one will change the Roll20 Dynamic Lighting values on the Token identified to provide this lighting effect. These are:

  • Magic Weapon or Magical Armour (5ft radius circle),
  • Torch (15ft radius circle),
  • Hooded Lantern (30ft radius circle),
  • Continual Light lantern (60ft radius circle),
  • Bullseye Lantern (cone of light, 20 degrees wide and 60ft long),
  • Beacon Lantern (cone of light, 20 degrees wide and 240ft long).

The menu shows [ON] and [OFF] buttons for each type. Only one type can be ON for each Token: selecting an ON button for any light source turns OFF the others for that Token. Turning the current light source off will turn off all lighting effects on the identified token.

Set a lightsource for a token

--changelight token_id|(NONE/WEAPON/TORCH/HOODED/CONTLIGHT/BULLSEYE/BEACON)

Takes a mandatory token ID, and a mandatory type of light source.

This command sets the light source type that the identified token is using, and changes the Roll20 Dynamic Lighting settings of the token to the relevant value shown under section 5.1, or turn off all lighting effects for the selected token if NONE is specified.


Other commands

Display help on these commands

--help

This command does not take any arguments. It displays the mandatory and optional arguments, and a brief description of each command.

Check database completeness & integrity (GM only)

--check-db [ db-name ]

Takes an optional database name or part of a database name: if a partial name, checks all character sheets with the provided text in their name that also have '-db' as part of their name. If omitted, checks all character sheets with '-db' in the name. Not case sensitive. Can only be used by the GM.

This command finds all databases that match the name or partial name provided (not case sensitive), and checks them for completeness and integrity. The command does not alter any ability macros, but ensures that the casting time ('ct-') attributes are correctly created, that the item lists are sorted and complete, and that any item-specific power & spell specifications are correctly built and saved.

This command is very useful to run after creating/adding new items as ability macros to the databases (see section 8 below). It does not check if the ability macro definition itself is valid, but if it is then it ensures all other aspects of the database consistently reflect the new ability(s).

Switch on or off Debug mode

--debug (ON/OFF)

Takes one mandatory argument which should be ON or OFF.

The command turns on a verbose diagnostic mode for the API which will trace what commands are being processed, including internal commands, what attributes are being set and changed, and more detail about any errors that are occurring. The command can be used by the DM or any Player - so the DM or a technical advisor can play as a Player and see the debugging messages.

Forcing a database reset to the API version

A database can be rebuilt as the version that came with the current version of the API if you have accidentally altered one of the Ability macros or an attribute and caused functions not to work as expected. The easiest way to achieve this is to find the offending database Character Sheet and delete it, then exist the campaign and re-enter. If and only if the database Character Sheet is one of the following, it will be automatically re-written as the version distributed with the API:

MI-DB, MI-DB-Weapons, MI-DB-Ammo, MI-DB-Armour, MI-DB-Potions, MI-DB-Scrolls-Books, MI-DB-Wands-Staves-Rods, MI-DB-Rings, MI-DB-Light, MU-Spells-DB, PR-Spells-DB, Powers-DB.


Using Character Sheet Ability/Action buttons

The most common approach for the Player to run these commands is to use Ability macros on their Character Sheets which are flagged to appear as Token Action Buttons: Ability macros & Token Action Buttons are standard Roll20 functionality, refer to the Roll20 Help Centre for information on creating and using these.

In fact, the simplest configuration is to provide only Token Action Buttons for the menu commands: --spellmenu and mimenu. From these, most other commands can be accessed.