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 1: Line 1:
 
{{revdate}}
 
{{revdate}}
<p>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 ItemsAll magical aspects can work with the <b>RoundMaster API</b> 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 <b>InitiativeMaster API</b> 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 <b>AttackMaster API</b> and change bonuses on attacks and damage, by weapon or for one or more party members.  This API can also interact with the <b>MoneyMaster API</b> (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).</p>
+
<p>The CommandMaster API is part of the RPGMaster suite of APIs for Roll20, which includes RoundMaster, InitiativeMaster, AttackMaster, MagicMaster and CommandMasterIt manages the initialisation of a Campaign to use the RPGMaster APIs, communication and command syntax updates between the APIs and, most importantly for the DM, easy menu-driven setup of Tokens and Character Sheets to work with the APIs.</p>
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 11.<br>
+
 
{{script overview
 
{{script overview
|name=MagicMaster
+
|name=CommandMaster
 
|author={{user profile|6497708|Richard E}}
 
|author={{user profile|6497708|Richard E}}
|version=2.044
+
|version=1.020
 
|lastmodified=2022-01-09
 
|lastmodified=2022-01-09
|code=MagicMaster
+
|code=CommandMaster
|dependencies=ChatSetAttr, Tokenmod, RoundMaster, InitiativeMaster, AttackMaster
+
|dependencies=RoundMaster, InitiativeMaster, AttackMaster
 
|conflicts=None}}
 
|conflicts=None}}
  
=What MagicMaster does=
+
=How CommandMaster Works=
==Item, Spell and Power databases==
+
<p>The CommandMaster API coordinates other APIs in the RPGMaster API series and provides the DM with facilities to set the Campaign up to use themIt will initialise a Campaign in Roll20 to use the RPGMaster series APIs.  APIs can register their commands with CommandMaster and, should they change in the future, CommandMaster will search all Character Sheets and databases for that command and offer the DM the option to automatically update any or all of those found to the new command structure of that API.  Selected Tokens and their associated Character Sheets can be set up with the correct Token Action Buttons, with spell-users given spells in their spell book, fighters given weapon proficiencies, setting saving throws correctly, and linking token circles to standard Character Sheet fields.</p>
<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 Roll20Spell, 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 functionsThe 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>
+
==Initialising a Campaign==
==Spells and Powers==
+
<p>Using the <b>--initialise</b> command will add a number of Player Macros for the DM that will run the most-used RPGMater DM commands, which can be flagged to appear in the Macro Bar at the bottom of the DM’s screen for ease of access.</p>
<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 APIsThis 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>
+
==Setting up tokens & character sheets==
<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>
+
<p>Selecting one or multiple tokens and running the <b>--abilities</b> command will allow token action buttons and RPGMaster API capabilities to be set up for all the represented Character Sheets at the same time, though all Character Sheets will be set up the same way.</p>
==Adding Spells & Powers to the Character==
+
==Registering API commands==
<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>Any API command can be registered with CommandMaster using the <b>--register</b> commandThis will allow the command registered to be added as a Token Action Button to Character Sheets by the   abilities command, and to be optionally updated in all Character Sheets wherever used should the details of the registration change.</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>
+
==Editing Character Sheet abilities==
<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><b>Danger:</b> this command is very powerful, and can ruin your campaign if mis-used! The <b>--edit</b> command can be used to change any string in Character Sheet ability macros to any other string, using ‘escaped’ characters to replace even the most complex stringsHowever, use with care!</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 dayThe 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 11 of this document.</p>
+
 
<br>
 
<br>
== Syntax ==
+
==Syntax of CommandMaster calls==
<p>The MagicMaster API is called using <code>!magic</code> (or the legacy command <code>!mibag</code>).</p>
+
<p>The CommandMaster API is called using !cmd.</p>
<pre>!magic --help</pre>
+
<pre>!cmd --initialise</pre>
<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>
+
<p>Commands to be sent to the CommandMaster API must be preceded by two hyphens --as above for the --initialise command.  Parameters to these commands are separated by vertical bars |, for example:</p>
<pre>!magic --mi-power token_id|power_name|mi_name|[casting-level]</pre>
+
<pre>!cmd --register action|description|api-call|api-command|parameters</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>
+
<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>!magic --spellmenu [token_id]|[MU/PR/POWER] --mimenu [token_id]</pre>
+
<pre>!cmd --initialise --abilities</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>
 +
<br>
 
=Command Index=
 
=Command Index=
 
==Commands==
 
==Commands==
===Spell and Power management===
+
===Campaign setup===
<pre>--spellmenu [token_id]|[MU/PR/POWER]
+
<pre>--initialise
--mem-spell (MU/PR/POWER)|[token_id]
+
--abilities</pre>
--view-spell (MU/PR/POWER)|[token_id]
+
===Character Sheet configuration===
--cast-spell (MU/PR/POWER/MI)|[token_id]|[casting_level]|[casting_name]
+
<pre>--add-spells [POWERS/MUSPELLS/PRSPELLS] | [level]
--cast-again (MU/PR/POWER)|token_id|[spell_name]</pre>
+
--add-profs
===Magic Item management===
+
--set-prof  [NOT-PROF/PROFICIENT/SPECIALIST/MASTERY] | weapon | weapon-type
<pre>--mimenu [token_id]
+
--set-all-prof</pre>
--edit-mi [token_id]
+
===Command and Ability maintenance===
--view-mi [token_id]
+
<pre>--register action|description|api-call|api-command|parameters
--use-mi [token_id]
+
--edit old-string | new-string</pre>
--mi-charges token_id|value|[mi_name]|[maximum]
+
--mi-power token_id|power_name|mi_name|[casting-level]
+
--mem-spell (MI-MU/MI-PR)|[token_id]
+
--view-spell (MI-MU/MI-PR/MI-POWER)|[token_id]
+
--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]
+
!rounds --target (SINGLE/AREA)|token_id|target_token_id|spell_name|duration|increment|[msg]|[marker]
+
--touch token_id|effect-name|duration|per-round|message|marker
+
--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]
+
--search token_id|pick_id|put_id
+
--pickorput token_id|pick_id|put_id|[SHORT/LONG]</pre>
+
===Light source management===
+
<pre>--lightsources [token_id]
+
--light token_id|(NONE/WEAPON/TORCH/HOODED/CONTLIGHT/BULLSEYE/BEACON)
+
--changelight token_id|(NONE/WEAPON/TORCH/HOODED/CONTLIGHT/BULLSEYE/BEACON)</pre>
+
 
===Other commands===
 
===Other commands===
 
<pre>--help
 
<pre>--help
--check-db [ db-name ]
+
--debug [ON/OFF]</pre>
--debug (ON/OFF)</pre>
+
 
<br>
 
<br>
==Spell management==
+
==Campaign setup==
===Display a menu to do actions with spells===
+
===Initialise for RPGMaster APIs===
<pre>--spellmenu [token_id]|[MU/PR/POWER]</pre>
+
<pre>--initialise</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>
+
<p>This command creates a number of Player Macros which can be found under the Player Macro tab in the Chat window (the tab that looks like three bulleted lines, next to the cog).  These macros hold a number of DM commands that are useful in setting up and running a campaign.  It is recommended that the “Show in Bar” flags for these macros are set, and the “Show Macro Bar” flag is set (the macro bar is standard Roll20 functionality - see Roll20 Help Centre for more information).</p>
 +
<p>The buttons added are:</p>
 +
<ul>
 +
<li><i>Maint-menu:</i> Runs the <b>!init --maint</b> command</li>
 +
<li><i>Token-setup:</i> Runs the <b>!cmd --abilities</b> command</li>
 +
<li><i>Add-items:</i> Runs the <b>!magic --gm-edit-mi</b> command</li>
 +
<li><i>End-of-Day:</i> Runs the <b>!init --end-of-day</b> command</li>
 +
<li><i>Initiative-menu:</i> Runs the <b>!init --init</b> command</li>
 +
</ul>
 +
<p>The DM can drag Macro Bar buttons around on-screen to re-order them, or even right-click them to change their name and colour of the button.  Feel free to do this to make the Macro Bar as usable for you as you desire.</p>
 +
===Setup Tokens & Character Sheets===
 +
<pre>--abilities</pre>
 +
<p>Displays a menu with which one or more selected tokens and the Character Sheets they represent can be set up with the correct Token Action Buttons and data specific to the RPGMaster APIs, to work with the APIs in the best way.  The menu provides buttons to add any command registered with CommandMaster (see <b>--register</b> command) as a Token Action Button, add spells to spell books, add granted powers, add or change weapon proficiencies and proficiency levels for each weapon, set the correct saving throws based on race, class & level of character / NPC / creature, and optionally clear or set the Token ‘circles’ to represent AC (bar 1), base Thac0 (bar 2) and HP (bar 3).  Essentially, using this menu accesses the commands in section 2 without the DM having to run them individually.</p>
 +
<p>All tokens selected when menu items are used will be set up the same way: exceptions to this are using the Set Saves button (sets saves for each selected token/character sheet correctly for the specifications of that sheet), and the Set All Profs button (sets weapon proficiencies to proficient based on the weapons in each individual token/character sheet’s item bag).  Different tokens can be selected and set up differently without having to refresh the menu.</p>
 +
==Character Sheet configuration==
 +
<p>The commands in this section can be accessed using the --abilities command menu.  The individual commands below are used less frequently.</p>
 +
===Add spells to spell book===
 +
<pre>--add-spells [POWERS/MUSPELLS/PRSPELLS] | [level]</pre>
 +
<p>Displays a menu allowing spells in the Spells Databases to be added to the Character Sheet(s) represented by the selected Token(s).  If no spell type and/or spell level is specified, the initial menu shown is for Level 1 Wizard spells (MUSPELLS). Buttons are shown on the menu that allow navigation to other levels, spell types and powers.</p>
 +
<p><b>Note:</b> adding spells / powers to a sheet does not mean the Character can immediately use them.  They must be <i>memorised</i> first.  Use the commands in the <b>MagicMaster API</b> to memorise spells and powers.</p>
 +
===Choose weapon proficiencies===
 +
<pre>--add-profs</pre>
 +
<p>Displays a menu from which to select proficiencies and level of proficiency for any weapons in the Weapon Databases.  Also provides a button for making the Character proficient in all weapons carried (i.e. those currently in their Item table).</p>
 +
<p>All current proficiencies are displayed, with the proficiency level of each, which can be changed or removed.</p>
 +
<p><b>Note:</b> this does more than just entering the weapon in the proficiency table.  It adds the <i>weapon group</i> that the weapon belongs to as a field to the table (see weapon database help handouts for details), which is then used by the <b>AttackMaster API</b> to manage <i>related weapon</i> attacks and give the correct proficiency bonuses or penalties for the class and weapon used.</p>
 +
===Add weapon proficiencies===
 +
<pre>--set-prof  [NOT-PROF/PROFICIENT/SPECIALIST/MASTERY] | weapon | weapon-type </pre>
 +
<p>Sets a specific weapon proficiency to a named level.  If the proficiency level is omitted, PROFICIENT is assumed.  If the weapon already exists in the proficiencies table, the existing proficiency level is updated to that specified.  Otherwise, the weapon (and its weapon group) are added to the table at the specified level.</p>
 +
<p><b>Note:</b> this does more than just entering the weapon in the proficiency table.  It adds the weapon group that the weapon belongs to as a field to the table (see weapon database help handouts for details), which is then used by the AttackMaster API to manage related weapon attacks and give the correct proficiency bonuses or penalties for the class and weapon used.</p>
 +
===Add proficiencies for all carried weapons===
 +
<pre>--set-all-prof</pre>
 +
<p>Adds all currently carried weapons (those in the Items table) to PROFICIENT, saving them and their <i>weapon group</i> to the weapon proficiency table.  Those weapons found that are already in the table are reset to PROFICIENT (overwriting any existing different proficiency level).  Any other proficiencies already in the table are not altered.</p>
 +
<p><b>Note:</b> this command always adds a weapon proficiency called <i>innate</i>.  This proficiency is used for attacks with innate weapons, such as claws and bites, but also for spells that require a <i>touch attack</i>.  Indeed, to make this even more specific, the weapons database distributed with the AttackMaster and MagicMaster APIs includes a weapon called <i>Touch</i>.</p>
 +
<p><b>Tip:</b> if using the <b>MagicMaster API</b> then running the <b>!magic --gm-edit-mi</b> command and adding weapons before running this command can speed up setting up character sheets.</p>
 +
==Command and Ability maintenance==
 +
===Register an API command===
 +
<pre>--register action|description|api-call|api-command|parameters</pre>
 +
<p>Register an API command with the CommandMaster API to achieve two outcomes: allow the command to be set up as a Token Action Button, and/or automatically maintain & update the syntax of the commands in Character Sheet ability macros and the RPGMaster API databases.</p>
 +
<p>This is a powerful and potentially hazardous command.  Registry of an API command is remembered by the system in the state variable, which is preserved throughout the life of the Campaign in Roll20.  If a subsequent registration of the same <b>action</b> has different parameters, the system detects this and searches all Character Sheet ability macros for the <i>old version</i> of the command and replaces all of them with the new command.  It also changes the parameters, using a syntax including a range of character \‘escapes\’ to substitute characters that Roll20 might otherwise interpret as commands itself.  In detail, the --register command takes:</p>
 
<table>
 
<table>
<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">action:</th><td>the unique name given to this command in the whole system.  This can be any legal text name including A-Z, a-z, 1-9, -, _ only.  Must start with an alpha.  Case is ignored.</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>
+
<tr><th scope="row">description:</th><td>a short description of the command, which is displayed in the menu that allows the command to be added as a Token Action Button.</td></tr>
<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>
+
<tr><th scope="row">api-call:</th><td>the API call <i>without</i> the !, e.g. cmd, or magic, etc</td></tr>
<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>
+
<tr><th scope="row">api-command:</th><td>the command to be passed to the specified API, with the hyphens replaced by ~~ or plusses replaced by **, e.g. ~~cast-spell or **menu.</td></tr>
 +
<tr><th scope="row">parameters:</th><td>the parameters (or initial parameters) to be passed as part of this command to replace the matching existing command parameters.  This string  is \‘escaped\’ using the following character replacements:</td></tr>
 
</table>
 
</table>
<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>
+
{| class="wikitable"
===Display a menu to memorise spells from the Character's spell book===
+
|+
<pre>--mem-spell (MU/PR/POWER/MI-MU/MI-PR)|[token_id]</pre>
+
|-
<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>
+
! scope="row" | Character
<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 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.  Otherwise refer to the <b>RPGMaster CharSheet Setup</b> handout (created by the API) for how to create these manually.</p>
+
|| Parameter separator || ? || [ || ] || &lt; || &gt; || @ || - || &#124; || : || & || { || }
<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>
+
|-
<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 for the item, 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.  Generally, this command is called from an API button in the Magic Item macro.</p>
+
! scope="row" | Substitute
===View the memorised spells or granted powers===
+
|| %% || ^ || &lt;&lt; || &gt;&gt; || || || ` || ~ || ¦ || || &amp;amp; || &amp;#123; || &amp;#125;
<pre>--view-spell (MU/PR/POWER/MI-MU/MI-PR/MI-POWER)|[token_id]</pre>
+
|-
<p>Takes a mandatory spell type and an optional token ID. If token ID is not specified, uses the selected token.</p>
+
! scope="row" | Alternative<br>(no ; )
<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>
+
|| \vbar || \ques || \lbrak || \rbrak || \lt || \gt || \at || \dash || \vbar || \clon || \amp || \lbrc || \rbrc
<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>
+
|}
===Cast a memorised spell or use a granted power===
+
<p>Commands cannot have a CR (carrage return/new line) in the middle of them, but CR can separate commands in multi-command sequences.</p>
<pre>--cast-spell (MU/PR/POWER/MI)|[token_id]|[casting_level]|[casting_name]|[CHARGED]</pre>
+
<p>If the parameter string ends with $$, this will ensure that a complete command up to the next CR is to be replaced (including everything up to the CR even if not part of the command).  If there is not a $$ on the end of the parameter string, then only the command and parameters that are matched are replaced (using a parameter count of each old and new parameter separated by ‘%%’) - the rest of the line (including any remaining parameters not so matched) will be left in place.</p>
<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>
+
<p>Here are some examples of registration commands:</p>
<p>This displays a menu of all levels of the memorised spells/powers of the relevant type.  MI displays the spell book for spells stored on the last magic item selected by the Character (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>--register Spells_menu|Open a menu with spell management functions|magic|~~spellmenu |\`{selected|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>
+
--register Use_power|Use a Power|magic|~~cast-spell|POWER%%\`{selected|token_id}
<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 (i.e. all the spells on it have been cast), 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>
+
--register Attack_hit|Do an attack where Roll20 rolls the dice|attk|~~attk-hit|\`{selected|token_id}</pre><br>
===Cast the last used spell or power again===
+
===Edit ability macros===
<pre>--cast-again (MU/PR/POWER)|token_id|[spell_name]</pre>
+
<pre>--edit existing-string | new-string</pre>
<p>Takes a mandatory spell type, a mandatory token ID and an optional spell name.</p>
+
<p style="background-color:yellow;"><b>Danger:</b> use this command with extreme care!  It can destroy your Campaign! It is recommended that you make a backup copy of your Campaign before using this command--register is more controlled, as it has been tested with the RPGMaster command strings, and any future releases that change the API commands will be fully tested before release for their effect on Campaigns, with accompanying release notesUsing the --edit function directly can have unintended consequences!</p>
<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>
+
<p>Replaces an existing ‘escaped’ string with a new replacement string in all ability macros on all Character Sheets including the API character sheet databases.  These strings both use the same escape sequence replacements as for the <b>--register</b> command (see section 3.1) as in fact <b>--register</b> and <b>--edit</b> use the same functionality.</p>
<br>
+
<p>Examples of its use are to change API command calls, or Character Sheet field name access in macros should the field names change.</p>
==Magic Item management==
+
===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 7.</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 7.</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, the DM just tells the Player that they have found a magic item, and the Player uses this menu to give an item to the Character.</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.</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.  Recharging, Rechargeable and Self-Charging items remain, even when they reach 0 charges.  Cursed items also remain.</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 section 11.4.</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 11.4 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>
+
==Spell, power & magic item effects and resting==
+
<p>If this API is used in conjunction with the <b>RoundMaster API</b>, 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>
+
==Treasure & Item container management==
+
===DM/GM version of Magic Item management===
+
<pre>--gm-edit-mi [token_id]</pre>
+
<p>Takes an optional token ID. If token ID is not specified, uses the selected token.</p>
+
<p>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.</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>
+
<table>
+
<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">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">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>
+
===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 wayThe 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 tokenThe 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 longEach 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>
+
==Light source management==
+
<p>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.</p>
+
===Show a menu of Light Sources to select from===
+
<pre>--lightsources [token_id]</pre>
+
<p>Takes an optional token ID as an argument. If token ID is not specified, uses the selected token.</p>
+
<p>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:</p>
+
<ul>
+
<li>Magic Weapon or Magical Armour (5ft radius circle),</li>
+
<li>Torch (15ft radius circle),</li>
+
<li>Hooded Lantern (30ft radius circle),</li>
+
<li>Continual Light lantern (60ft radius circle),</li>
+
<li>Bullseye Lantern (cone of light, 20 degrees wide and 60ft long),</li>
+
<li>Beacon Lantern (cone of light, 20 degrees wide and 240ft long).</li>
+
</ul>
+
<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 Token.  Turning the current light source off will turn off all lighting effects on the identified token.</p>
+
===Set a lightsource for a token===
+
<pre>--changelight token_id|(NONE/WEAPON/TORCH/HOODED/CONTLIGHT/BULLSEYE/BEACON)</pre>
+
<p>Takes a mandatory token ID, and a mandatory type of light source.</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 the previous section, or turn off all lighting effects for the selected token if NONE is specified.</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 the mandatory and optional arguments, and a brief description of each command.</p>
+
<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>
===Check database completeness & integrity (GM only)===
+
<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>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 11 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>
+
 
===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>
==Using Character Sheet Ability/Action buttons==
+
=Character Sheet and Token setup for use with RPGMaster APIs=
<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>
+
==Token configuration==
<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>
+
<p>The API can work with any Token configuration but requires tokens that are going to participate in API actions to represent a Character Sheet, so that actions relevant to the token and the character it represents can be selected. </p>
 +
<p>A single Character Sheet can have multiple Tokens representing it, and each of these are able to do individual 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 <i>Haste</i> and <i>Slow</i>) 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, <b>it is recommended that tokens and character sheets are 1-to-1 to keep things simple.</b></p>
 +
<p>The recommended Token Bar assignments for all APIs in the Master Series are:</p>
 +
<pre>Bar1 (Green Circle): Armour Class (AC field) - only current value
 +
Bar2 (Blue Circle): Base Thac0 (thac0-base field) before adjustments - only current value
 +
Bar3 (Red Circle): Hit Points (HP field) - current & max</pre>
 +
<p>It is recommended to use these assignments, and they are the bar assignments set by the <b>CommandMaster API</b> if its facilities are used to set up the tokensAll tokens must be set the same way, whatever way you eventually choose.</p>
 +
<p>These assignments can be changed in each API, by changing the fields object near the top of the API script (<b>note:</b> no underscore, and 'bar#' and 'value' or 'max' are separate entries in an array of 2 elements).  <b><i><u>All APIs must use the same field definitions</u></i></b>:</p>
 +
<pre>fields.Token_AC: defines the token field for the AC value (normally ['bar1','value'])
 +
fields.Token_MaxAC: defines the token field for the AC max (normally ['bar1','max'])
 +
fields.Token_Thac0: defines the token field for the Thac0 value (normally ['bar2','value'])
 +
fields.Token_MaxThac0: defines the token field for the Thac0 max (normally ['bar2','max'])
 +
fields.Token_HP: defines the token field for the HP value (normally ['bar3','value'])
 +
fields.Token_MaxHP: defines the token field for the HP max (normally ['bar3','max'])</pre>
 +
<p>Alter the bar numbers appropriately or, <b><u><i>if you are not wanting one or more of these assigned</i></u></b>: leave the two elements of the array as ['',''].  The system will generally work fine with reassignment or no assignment, but not always.  Specifically, some effects in the Effects-DB, which implement spell effects on Character Sheets and Tokens, may not set the right values if no assignment of one or more of HP, AC & Thac0 are made to the Token.</p>
 
<br>
 
<br>
=Configuring the Token and Character Sheet for use with the API=
 
==Token configuration==
 
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>
 
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==
 
==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>
+
<p>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 the AttackMaster API code, right at the top, is an object definition called 'fields': see section 3 for details.  This can be altered to get the API to work with other character sheets.</p>
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>
+
<p>The coding of the API is designed to use the AD&D 2E system of attack calculations, armour class values and saving throw management.  If you use another system (e.g. the D&D 5e system) the API coding will need to change.  This might be a future enhancement.</p>
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==
 
==Matching the API to a type of Character Sheet==
The API has an object definition called ''fields'', which contains items of the form<br>
+
<p>The API has an object definition called 'fields', which contains items of the form </p>
''Internal_api_name: [sheet_field_name, field_attribute, optional_default_value, optional_set_with_worker_flag]''<br>
+
<pre>Internal_api_name: [sheet_field_name, field_attribute, optional_default_value, optional_set_with_worker_flag]</pre>
A typical example might be:<br>
+
<p>A typical example might be:</p>
<pre> Fighter_level:['level-class1','current'],
+
<pre>Fighter_level:['level-class1','current'],
Or
+
Or
MUSpellNo_memable:['spell-level-castable','current','',true],</pre>
+
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>
+
<p>The <i>internal_api_name</i> <b><u>must not be altered!</u></b> Doing so will cause the system not to work. However, the <i>sheet_field_name</i> and <i>field_attribute</i> can be altered to match any character sheet.</p>
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>
+
<p>Table names are slightly different: always have an <i>internal_api_name</i> 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 1<sup>st</sup> row.</p>
''Internal_api_table: [sheet_repeating_table_name,starting_index]''<br>
+
<p><i>Internal_api_table: [sheet_repeating_table_name,starting_index]</i></p>
An example is:<br>
+
<p>An example is:</p>
 
<pre>MW_table:['repeating_weapons',0],</pre>
 
<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>
+
<p>The <i>internal_api_table</i> <b><u>must not be altered!</u></b> Doing so will cause the system not to work.  However, the <i>sheet_repeating_table_name</i> and <i>starting_index</i> can be altered to match any character sheet.</p>
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>
+
<p>Each character sheet must have repeating tables to hold weapons, ammo and magic items, as well as other data.  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, and magic items are held in the repeating_potions table.  The table management system provided by the API 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. </p>
 +
==Character Attributes, Races, Classes and Levels==
 +
<p>Character Attributes of <i>Strength, Dexterity, Constitution, Intelligence, Wisdom</i> and <i>Charisma</i> are generally not directly important to the RPGMaster Series APIs, 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 section 2 above).</p>
 +
<p>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 <i>'dwarf', 'elf', 'gnome', 'halfelf', 'halfling', 'half-orc'</i> and <i>'human'</i> are implemented (not case sensitive, and spaces, hyphens and underscores are ignored).  If not specified, <i>human</i> is assumed.  The race impacts saves, some magic items and armour, and bonuses on some attacks.</p>
 +
<p>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, 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 weapons, armour, shields, some magic items and saves.</p>
 +
<p><b>Important Note:</b> 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.</p>
 +
<p><b>Note:</b> classes of Fighter and Rogue (such as 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 <b><u>do not</u></b> need to have levels set in the corresponding spell-caster columns - the casting ability & level is worked out by the system</p>
  
==Character Attributes, Races, Classes and Levels==
+
<p>The following Classes are currently supported:</p>
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"
 
{| class="wikitable"
 
|+  
 
|+  
Line 348: Line 197:
 
| || Transmuter || || ||  
 
| || 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>
+
<p>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.  </p>
 
+
==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 sheet.  Spells 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==
 
==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>
+
<p>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, <i>repeating_potions</i>, on the Character Sheet.  As with other fields, this can be changed in the <i>'fields'</i> object.  The best way to put items into this table is by using the <b>MagicMaster API</b> commands <b>--edit-mi</b> or the GM-only command <b>--gm-edit-mi</b>Alternatively, the <b>AttackMaster --edit-weapons</b> command can be used to load weapons, ammunition and armour into the Items table.  It is generally possible to enter item names and quantities directly into the table and use them within the system, but 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).  Other items can be in the table but will not otherwise be effective.</p>
 
+
<p>Items can be added to the databases.  See the Database Handouts for more information on the databases.</p>
 
==Weapons and Ammo==
 
==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/levelHowever, manual entry will generally work to the extent to allow weapon attack actions to be selected.<br>
+
<p>For the APIs to work fully the melee weapons, damage, ranged weapons and ammo must be selected using the <b>AttackMaster --weapon</b> command to take the weapon 'in hand'.  This will display a menu to take weapons and shields from the Items table and take them in hand, ready to use. This automatically fills all the correct fields for the weapons and ammo to make attacks, including many fields that are not displayedEntering weapon data directly into the melee weapon, damage, ranged weapon and ammo tables will generally work, but will be overwritten if the --weapon command is usedAlso, some API functions may not work as well or at all.</p>
<br>
+
<p>For the <b>InitiativeMaster API</b> to support weapon attack actions weapon name, speed and number of attacks are the most important fieldsFor the <b>AttackMaster API</b> to support attack rolls, proficiency calculations, ranged attacks, strength and dexterity bonuses, and other aspects of functionality, fill in as many fields as are visible on the character sheet.  When entering data manually, ensure that the row a melee or ranged weapon is in matches the row damage or ammo is entered in the respective tables (there is no need to do this if using AttackMaster functions to take weapons in-hand, as the relevant lines are otherwise linked).</p>
==Character Sheet data fields==
+
==Weapon Proficiencies==
<p>The Character Sheet field mapping to the API script can be altered using the definition of the fields object, the definition for which can be found at the top of each API.  You can find the complete mapping for all APIs in the RPGMaster series, with an explanation of each, in a separate document - as the Author for a copy.</p>
+
<p>Weapon Proficiencies must be set on the Character Sheet.  This is best done by using the <b>CommandMaster API</b> character sheet management functions, but can be done manuallyBoth specific weapons and related weapon groups can be entered in the table, and when a Player changes the character's weapons in-hand the table of proficiencies will be consulted to set the correct bonuses and penaltiesWeapon specialisation and mastery (otherwise known as double specialisation) are supported by the CommandMaster functions, but can also be set by ticking/selecting the relevant fields on the Character Sheet weapon proficiencies table. If a weapon or its related weapon group does not appear in the list, it will be assumed to be not proficient.</p>
<br>
+
==Spell books and memorisable spells==
 
+
<p>The best (and easiest) way to give a Character or NPC spells and powers is to use <b>CommandMaster API</b> to add spells and powers to the Character's spellbooks, and <b>MagicMaster API</b> to memorise and cast spells and use powersHowever, for the purposes of just doing initiative and selecting which spell to cast in the next 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, <i>repeating_spells</i>. As with other fields, this can be changed in the <i>'fields'</i> 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.</p>
=MagicMaster Databases=
+
<p>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) <b>a complete row at a time</b> (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 <i>counts down</i> to zero on using a spell, so in order for a spell to appear as available (not greyed out) on the initiative menus, the “current” number left must be > 0This makes spells consistent with other tables in the system (e.g. potion dose quantities also count down as they are consumed, etc).</p>
==General Database information==
+
<p>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 relevantThis will determine the maximum number of spells memorised each day, that will appear in the spells Initiative MenuDo the same for Powers using the “Powers Available” fieldAs with other fields on the character sheet, each of these fields can be re-mapped by altering the <i>'fields'</i> object in the APIs.</p>
<p>The MagicMaster API uses a number of Character Sheets as databases to hold Ability Macros defining spells, powers and magic items and their effectsThe API is distributed with many spell, power & magic item definitions, and 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 provided databases are accidentally deleted, they will be automatically recreated the next time the Campaign is opened. Additional databases should be named as follows:</p>
+
<p>Spells can only be cast if they have macros defined in the spell databases (see Spell Database Handout).  If the <b>CommandMaster API</b> is loaded, the DM can use the tools provided there to manage Character, NPC & creature spell books and granted powers from the provided spell & power databases.</p>
<table>
+
<p>The spells a spell caster can memorise (what they have in their spell books, or what their god has granted to them) is held as a list of spell names separated by vertical bars '|' in the character sheet attribute defined in <i>fields.Spellbook</i> (on the AD&D2E character sheet 'spellmem') of each level of spell.  On the AD&D2E sheet, the spell books are the large Spell Book text fields at the bottom of each spell level tab.  The spell names used must be identical (though not case sensitive) to the spell ability macro names in the spell databases (hence the hyphens in the names).   So, for example, a 1<sup>st</sup> level Wizard might have the following in their large Wizard Level 1 spell book field:</p>
<tr><th scope="row">Wizard Spells:</th><td>additional databases: MU-Spells-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
+
<pre>Armour|Burning-Hands|Charm-Person|Comprehend-Languages|Detect-Magic|Feather-fall|Grease|Identify|Light|Magic-Missile|Read-Magic|Sleep</pre>
<tr><th scope="row">Priest Spells:</th><td>additional databases: PR-Spells-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
+
<p>Only these spells will be listed as ones they can memorise at level 1. When they learn new spells and put them in their spell book, this string can be added to just by typing into itWhen they reach 3<sup>rd</sup> level and can have 2<sup>nd</sup> level spells, the following string might be put in the spell book on the Level 2 Wizard spells tab:</p>
<tr><th scope="row">Powers:</th><td>additional databases: Powers-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
+
<pre>Alter-Self|Invisibility|Melfs-Acid-Arrow|Mirror-Image|Ray-of-Enfeeblement</pre>
<tr><th scope="row">Magic Items:</th><td>additional databases: MI-DB-<i>[added name]</i> where <i>[added name]</i> can be replaced with anything you want.</td></tr>
+
<p>Again, as they learn more spells and put them in their spell book, just edit the text to add the spells.</p>
</table>
+
<p>Once these spell books are defined, the DM or Player can use the <b>MagicMaster -mem-spell</b> command (or an action button and associated ability macro on the Character Sheet) to memorise the correct number of these spells in any combination and store those on the Character Sheet.</p>
<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 ignoredThis is so that the DM can version control their databases, with only the current one (without a version number) being live.</p>
+
==Powers==
<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>Powers can only be used if they are defined in the Powers database - see Database handoutsIf the <b>CommandMaster API</b> is also loaded, the DM can use the tools provided there to manage Character, NPC & creature spellbooks and granted powers.</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 onesOtherwise, Players will not be able to run the macros contained in them.</p>
+
<p>Powers work in an almost identical way to Wizard & Priest spells, except that there is only 1 level of powersPowers that the character has are added to the spell book on the Powers tab in the same way as spells, and then memorised using the <b>--mem-spell</b> command (which also works for powers with the right parameters).</p>
<p>Each database has a similar structure, with:</p>
+
<ul>
+
<li>Ability Macros named as the spell, power or magic item specified, and used to describe and provide effects for spells, powers and magic items using the commands in the Magic Master API;</li>
+
<li>Custom Attributes with the attribute name “ct-ability-macro-name”, one per Ability Macro, which defines the casting time and casting cost for spells & powers, and speed and MI type for magic items;</li>
+
<li>An entry in a list on the character sheet in the spell book of the relevant Character Sheet tab (Spell Level of the spell defined, Powers tab, or various spell books for different Magic Items - see MI entry below).</li>
+
</ul>
+
<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 spell, power and magic item ability macros.  When a Player or an NPC or Monster views or casts a spell, power or uses a magic item the Magic Master API runs 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>
+
===Replacing Spells & Items===
+
<p>If you want to replace any spell or item provided in any of the databases, you can do so simply by creating an Ability Macro in one of your own databases with exactly the same name as the provided item to be replaced.  The API gives preference to Ability Macros in user-defined databases, so yours will be selected in preference to the one provided with the APIs.</p>
+
<br>
+
==Spells and Powers Databases==
+
<p>Spells/Powers databases are all character sheets that have names that start with</p>
+
<p> <b>Wizard Spells:</b> MU-Spells-DB-[added name]<br>
+
<b>Priest Spells:</b> PR-Spells-DB-[added name]<br>
+
<b>Powers:</b> Powers-DB-[added name]</p>
+
<p>Those with version numbers of the form v#.# as part of the name will be ignored.</p>
+
<p>As previously stated, each spell or power definition has 3 parts in the database (see Section 11.1): an Ability Macro with a name that is unique and matches the spell or power, 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 others of the same level in the spell book of the level of the spell or power.  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 spells and powers does not need to worry about anything other than the Ability Macro in the database, as running the command <b><i>--check-db</i></b> will update all other aspects of the database appropriately for all databases, as long as the Specs and Data fields are correctly defined. Use the name of the particular database as a parameter to check and update just that database.  Running the command <b><i>--check-db</i></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 editingAbility macros are standard Roll20 functionality and not dependent on the API.  Refer to the Roll20 Help Centre for more information.</p>
+
<p><b>The Ability Macro</b> for a spell may look something like this:</p>
+
===Sleep===
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: black;">/w "@{selected|character_name}" <nowiki>&{template:2Espell}{{title=@{selected|casting-name} casts Sleep as a level @{selected|casting-level} caster}}{{splevel=Level 1 Wizard}}{{school=Enchantment/Charm}}</nowiki><span style="color:green; background-color=white">Specs=[Sleep,MUspellL1,1H,Enchantment-Charm]</span><nowiki>{{range=90 ft}}{{components=V, S, M}}{{duration=[[5*({10,@{selected|casting-level}}kl1)]] Rounds}}{{time=1}}{{aoe=[30ft Cube](</nowiki><span style="color:red">!rounds --aoe @{selected|token_id}|square|feet|90|30||dark</span>)}}<nowiki>{{save=None}}{{damage=[Sleep them](</nowiki><span style="color:red">!rounds --target area|@{selected|token_id}|&#64;{target|Select who to sleep|token_id}|Sleep|[[5*({10,@{selected|casting-level}}kl1)]]|-1|Snoring away, shake to awaken|sleepy</span>)}}<span style="color:blue; background-color=white">SpellData=[w:Sleep,lv:1,sp:1,gp:0.01,cs:VSM]</span><nowiki>{{effects=Up to [2d4](!\&#13;\&#47;r 2d4) Hit Dice of creatures with 4 HD or less are put to sleep beginning with the lowest HD creatures in the Area of Effect.}}{{materials=a pinch of fine sand, rose petals, or a live cricket.}}</nowiki></p>
+
<p>The ability specification for this Sleep spell 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, or none and just plain textThe 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 MagicMaster API are those highlighted.  In red, two API buttons grant the player access to run RoundMaster API commands to show the Area of Effect of the spell, and then to mark affected tokens with a "Sleepy" status.  Each of the elements important to the database are inserted between the elements of the Roll Template, meaning they will not be seen by the player when the macro is runGenerally 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, Spell School]</pre>
+
<p>The Specs section describes what spell type and school this spell 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><th scope="row">Type</th><td>the type of the spell, often the same as the ability macro name.</td></tr>
+
<tr><th scope="row">Class</th><td>one of MUSpellL#, PRSpellL#, or Power, where # is replaced by the spell level number.</td></tr>
+
<tr><th scope="row">Handedness</th><td>#H, where # is the number of hands needed to cast the spell - i.e. does it have a somatic component.</td></tr>
+
<tr><th scope="row">Spell School</th><td>the group of related spells that the spell belongs to.</td></tr>
+
</table>
+
<pre>SpellData=[w:Sleep,lv:1,sp:1,gp:0.01,cs:VSM]</pre>
+
<p>The SpellData section specifies the data relating to the use of the spell.  These fields can be in any order.</p>
+
<table>
+
<tr><th scope="row">w:</th><td>&lt;text&gt;</td><td>the name of the spell</td></tr>
+
<tr><th scope="row">st:</th><td>&lt;text&gt;</td><td>the sphere of a priest spell (not used for wizard spells)</td></tr>
+
<tr><th scope="row">lv:</th><td>&lt;#&gt;</td><td>the level of the spell</td></tr>
+
<tr><th scope="row">sp:</th><td>&lt;[-]# or dice roll spec&gt;</td><td>the casting time in segments for the spell.  Can be >10 e.g. 20 for 2 rounds, or negative, or even a dice roll</td></tr>
+
<tr><th scope="row">gp:</th><td>&lt;#[.#]&gt;</td><td>the cost of the material components of the spell in GP: fractions converted to SP & CP</td></tr>
+
<tr><th scope="row">cs:</th><td>&lt;VSM&gt;</td><td>the component of the spell (Verbal, Somatic, Material) - can be any combination</td></tr>
+
</table>
+
<p>The casting time (or speed) <b>sp:</b> can be negative, meaning it gives a negative modifier to individual initiative (if <b>InitMaster API</b> is being used).  It can also be greater than 10 segments, meaning it takes longer than 1 Round to cast.  Multiply the number of Rounds it will take to cast by 10, or the number of Turns it will take to cast by 100 (if using the <b>InitMaster API</b> the rounds will be automatically counted down and the spell actually cast in the appropriate round, unless the casting is interrupted).  It can also be a dice roll specification, which will be rolled at the point that a character selects the spell, power or item to use in a particular round, which means the speed can vary from round to roundPotions are always of this nature (see the AD&D2e DMG p141).</p>
+
<p>The cost of material components, <b>gp:</b>, is deducted from the Caster's money on their Character Sheet each time the spell is cast.  The GM is informed of the spell being cast, by whom, and how much money it cost and how much money the Caster has left for each casting.</p>
+
<p>The components of the spell, <b>cs:</b>, is currently not used and is for future expansion capabilities.</p>
+
<p><b>The Ability Macro</b> for a Power may look something like this:</p>
+
===Turn Undead===
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: black">/w "@{selected|character_name}" <nowiki>&{template:2Espell}{{title=@{selected|token_name} attempts to Turn Undead as a level @{selected|pr-casting-level} @{selected|class3}}}{{splevel=Power}} {{school=Necromancy}}</nowiki><span style="color:green">Specs=[Turn-Undead,Power,1H,Necromancy]</span><nowiki>{{components=V,S}}{{time=[[10]]}}{{range=0}}{{duration=Until broken}}{{aoe=Undead within line of sight}}{{save=See turning table}}{{reference=PHB p103}}{{damage=[Turn It](</nowiki><span style="color:red">!rounds --target area|@{selected|token_id}|&#64;{target|Select undead|token_id}|Turned|99|0|Turned undead, flee if free-willed, stand aside if controlled|screaming</span><nowiki>)}}</nowiki><span style="color:blue">SpellData=[w:Turn Undead, sp:10, cs:VS]</span><nowiki>{{</nowiki>effects=<b>Remember that Paladins turn as a Priest of 2 levels lower.</b><br>
+
Attempting to turn counts as an action, requiring one round and occurring during the character's turn in the initiative order (thus, the undead may get to act before the character can turn them). The mere presence of the character is not enough--a touch of drama from the character is important. Speech and gestures are important, so the character must have his hands free and be in a position to speak. However, turning is not like spellcasting and is not interrupted if the character is attacked during the attempt. <br>
+
To resolve a turning attempt, look on Table 61. Cross-index the Hit Dice or type of the undead with the level of the character (two levels lower for a paladin). If there is a number listed, roll 1d20. If the number rolled is equal to or greater than that listed, the attempt is successful. If the letter "T" (for "turned") appears, the attempt is automatically successful without a die roll. If the letter "D" (for "dispel") is given, the turning utterly destroys the undead. A dash (--) means that a priest or paladin of that level cannot turn that type of undead. A successful turn or dispel affects 2d6 undead. If the undead are a mixed group, the lowest Hit Dice creatures are turned first.<br>
+
Only one die is rolled regardless of the number of undead the character is attempting to turn in a given round. The result is read individually for each type of undead.<nowiki>}}{{material=The Priest's holy symbol}}</nowiki></p>
+
<p>Essentially, Powers are just Spells by another name, that can be cast multiple times per day, and are innate to the Character's class, or to a creature.  The specification is, therefore, almost identical to a spell.  In the author's campaigns, Powers do not consume material components and therefore do not cost money to use (except in rare circumstances) hence there being no <b>gp:</b> specification (it defaults to 0gp), but other DMs can add material costs for Powers if desired.  Powers are all 1 level, hence no <b>lv:</b> specification.</p>
+
<br>
+
==Magic Item Databases==
+
<p>Magic Item databases are all character sheets that have names such as</p>
+
<p> <b>Magic Items:</b> MI-DB-[added name]</p>
+
<p>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 for other magic, each magic item definition has 3 parts in the database (see Section 11.1): an Ability Macro with a name that is unique and identifies the magic item, 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 others of the same magic item type, which is one of: Potion, Scroll, Rod/Stave/Wand, Weapon, Armour, Ring, Miscellaneous, and also DM Only magic itemsThe quickest way to understand these entries is to examine existing entries.  Do go to the root database 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 spells and powers does not need to worry about anything other than the Ability Macro in the database, as running the command <b><i>--check-db</i></b> will update all other aspects of the database appropriately for all databases, as long as the Specs and Data fields are correctly defined. Use the name of the particular database as a parameter to check and update just that database.  Running the command <b><i>--check-db</i></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><b>The Ability Macro</b> may look something like this:</p>
+
===Oil-of-Etherealness===
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: black">/w "@{selected|character_name}" <nowiki>&{template:2Espell}{{title=Oil of Etherealness}} {{splevel=Oil}} {{school=Alteration}}</nowiki><span style="color:green">Specs=[Oil of Etherealness,Potion,1H,Alteration]</span><nowiki>{{components=M}}{{time=[[3]] rounds after application}}</nowiki><span style="color:blue">PotionData=[sp:30,rc:charged]</span><nowiki>{{range=User}}{{duration=4+1d4 turns}} {{aoe=User}} {{save=None}} {{healing=[Become Ethereal](</nowiki><span style="color:red">!rounds --target single|@{selected|token_id}|&#64;{target|Select a target|token_id}|Oil-of-Etherealness|&#91;[10*(4+1d4)]&#93;|-1|Ethereal|Ninja-mask</span><nowiki>)}}{{</nowiki>effects=This potion is actually a light oil that is applied externally to clothes and exposed flesh, conferring etherealness. In the ethereal state, the individual can pass through solid objects in any direction—sideways, upward, downward—or to different planes. The individual cannot touch non-ethereal objects.<br>
+
The oil takes effect three rounds after application, and it lasts for 4+1d4 turns unless removed with a weak acidic solution prior to the expiration of its normal effective duration. It can be applied to objects as well as creatures. One potion is sufficient to anoint a normal human and such gear as he typically carries (two or three weapons, garments, armor, shield, and miscellaneous gear). Ethereal individuals are invisible.<nowiki>}}{{materials=Oil}}</nowiki></p>
+
<p>You might notice that the structure of this macro is extremely similar to that of a spell: indeed, it uses the same Roll TemplateAs this is an Oil that achieves the same effect as a spell, this is not surprising.</p>
+
<p>However, there is one new field in the data section (in this case called the PotionData section):</p>
+
<table>
+
<tr><th scope="row">rc:</th><td>&lt;MI-type&gt;</td><td>the recharging/curse type of the magic item.</td></tr>
+
</table>
+
<p>All magic items have a recharging/curse type: for details, see the <b>--gm-edit-mi</b> command in the MagicMaster API help documentation, section 7.1.  If not supplied for a magic item definition, it defaults to uncharged.  Generally, items in the database are not cursed-, but can have their type changed to cursed or some recharging cursed type when the DM stores them in a container or gives them to a Character using the <b>--gm-edit-mi</b> command.</p>
+
<p>Other magic items might use different structures, and be more complex:</p>
+
===Bead-of-Force===
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;">/w "@{selected|character_name}" <nowiki>&{template:2Edefault}{{name=Bead of Force}}{{subtitle=Magic Item}}</nowiki><span style="color:green">Specs=[Bead of Force,Miscellaneous,1H,Evocation]</span><nowiki>{{Speed=[[0]]}}</nowiki><span style="color:blue">MiscData=[w:Bead of Force,sp:0,rc:charged]</span><nowiki>{{Size=Tiny}}{{Range=[Up to 30yds](</nowiki><span style="color:red">!rounds --aoe @{selected|token_id}|circle|yards|0|60||dark|true</span><nowiki>)}}{{damage=[5d4](!&#13;&#47;gmroll 5d4 damage from Bead of Force in 10ft redius) damage in 10ft radius}}{{duration=3d4 rounds}}{{Save=[To escape sphere](!&#13;&#47;gmroll 1d20 Save vs. spell or captured in *Sphere of Force*)}}{{Effect=[Trapped in Sphere](</nowiki><span style="color:red">!rounds --target area|@{selected|token_id}|Bead-of-Force|8|-1|'Held in Sphere of Force'|fishing-net</span><nowiki>)}}{{</nowiki>desc=These small, black spheres might be mistaken for common beads, marbles, or unusually black but lusterless pearls. From 5-8 of these beads are usually found at one time. Each is about three-quarters of an inch in diameter and quite heavy, weighing almost an ounce. One can be hurled up to 30 yards.<br>
+
Upon impact, the bead sends forth a burst of force that inflicts 5d4 points of damage upon all creatures within a 10-foot radius of its center. Each victim is allowed a saving throw vs. spell. Those who save will be thrown out of the blast area, but those who fail to save will be encapsulated by a sphere of force after taking damage.<br>
+
The sphere will form around any and all such creatures in the 10-foot-radius area, even those of large size, and will persist for 3d4 rounds. Victims will be unable to escape except by the same means and used to bring down a wall of force spell.<nowiki>}}</nowiki></p>
+
<p>The Bead of Force ability macro uses a Default Roll Template, which means the only mandatory field is the <nowiki>{{name=}}</nowiki> field, and the DM can define any other fields they want to describe and enact the magic item. Here, an API button exists to do a saving throw with documented outcomes, and another API button can target an area with multiple tokens in to entrap them (if the DM rejects or confirms as they make or fail each saving throw).</p>
+
<br>
+
==Magic Items with Powers or Spell-Storing==
+
<p>Some magic items, especially artefacts and sentient items, can store spells and/or have powers similar to charactersMagicMaster supports magic items of this type to a degree, although there are inevitably exceptions that the DM will have to get creative in their development!  These items use API buttons that call various MagicMaster commands to deliver their capabilities.</p>
+
<p>First to note is that <b>items that have powers and spells use spell slots in the owning character's character sheet</b>These spell slots should not be used by characters in your campaignIf they are, errors might occur.  By default, on the AD&D2E character sheet the system uses Wizard Level 14 spell slots for magic item powers, and Wizard Level 15 spell slots for spell-storing magic items.  As standard AD&D2E only has spells up to level 9 this generally works without causing problems.</p>
+
<p>Next, in addition to the three standard elements of the Ability Macro, the 'ct-' attribute and the listing, these items require a 4th element which specifies their powers and spells.  These are:</p>
+
<table>
+
<tr><th scope="row">mi-muspells-[item-name]:</th><td>Wizard spells able to be stored in the magic item</td></tr>
+
<tr><th scope="row">mi-prspells-[item-name]:</th><td>Priest spells able to be stored in the magic item</td></tr>
+
<tr><th scope="row">mi-powers-[item-name]:</th><td>Powers able to be used by the magic item</td></tr>
+
</table>
+
<p>In each case the <i>[item-name]</i> is replaced by the Ability macro name (which is not case sensitive).</p>
+
<p><b>Note:</b> The DM creating new spell storing or power wielding magic items does not need to worry about anything other than the Ability Macro in the database, as running the command <b><i>--check-db</i></b> will update all other aspects of the database appropriately for all databases, as long as the Specs and Data fields are correctly defined. Use the name of the particular database as a parameter to check and update just that database.  Running the command <b><i>--check-db</i></b> with no parameters will check and update all databases.</p>
+
<p>When a spell-storing or power wielding magic item is added to a magic item bag or container using --edit-mi or --gm-edit-mi, these attributes are added to the character sheet and also they are parsed by the system and the spells and/or powers are created in the relevant spell books automatically.  When such an item is found in a container by a character, or passed from character to character, all of the stored spells & powers are deleted from the old character and created in the new character.  A character gaining such an item can use its spells and powers immediately.</p>
+
<p>Here is an example of a power wielding magic item:</p>
+
===Ring-of-Shooting-Stars===
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;"><span style="color:red">!setattr --silent --sel --casting-level|1 --casting-name|@{selected|token_name}'s Ring of Shooting Stars</span><br>
+
/w "@{selected|character_name}" <nowiki>&{template:2Edefault}{{name=Ring of Shooting Stars}}{{subtitle=Ring}}</nowiki><span style="color:green">Specs=[Ring of Shooting Stars,Ring,1H,Evocation]</span><nowiki>{{Speed=[[5]]}}</nowiki><span style="color:blue">RingData=[w:Ring of Shooting Stars,sp:5,rc:charged,ns:6], [cl:PW,w:RoSS-Dancing-Lights,sp:5,pd:12], [cl:PW,w:RoSS-Light,sp:5,pd:2], [cl:PW,w:RoSS-Ball-Lightning,sp:5,pd:1], [cl:PW,w:RoSS-Shooting-Stars,sp:5,pd:3], [cl:PW,w:RoSS-Faerie-Fire,sp:5,pd:2], [cl:PW,w:RoSS-Spark-Shower,sp:5,pd:1]</span><nowiki> {{Size=Tiny}} {{Immunity=None}} {{Resistance=None}} {{Saves=None}} {{</nowiki>desc=This ring has two modes of operation—at night and underground—both of which work only in relative darkness.<br>
+
<i>During night hours, under the open sky</i>, the shooting stars ring will perform the following functions:<br>
+
• [*Dancing lights*](<span style="color:red">!magic --mi-power @{selected|token_id}|RoSS-Dancing-Lights|Ring-of-Shooting-Stars|1</span>) as spell (once per hour).<br>
+
• [*Light*](<span style="color:red">!magic --mi-power @{selected|token_id}|RoSS-Light|Ring-of-Shooting-Stars|1</span>), as spell (twice per night), 120-foot range.<br>
+
• [*Ball lightning*](<span style="color:red">!magic --mi-power @{selected|token_id}|RoSS-Ball-Lightning|Ring-of-Shooting-Stars|1</span>), as power (once per night).<br>
+
• [*Shooting stars*](<span style="color:red">!magic --mi-power @{selected|token_id}|RoSS-Shooting-Stars|Ring-of-Shooting-Stars|1</span>), as power (special).<br>
+
<i>Indoors at night, or underground</i>, the ring of shooting stars has the following properties:<br>
+
[*Faerie fire*](<span style="color:red">!magic --mi-power @{selected|token_id}|RoSS-Faerie-Fire|Ring-of-Shooting-Stars|1</span>) (twice per day) as spell<br>
+
[*Spark shower*](<span style="color:red">!magic --mi-power @{selected|token_id}|RoSS-Spark-Shower|Ring-of-Shooting-Stars|1</span>) (once per day) as power<br>
+
Range, duration, and area of effect of functions are the minimum for the comparable spell unless otherwise stated. Casting time is 5<nowiki>}}</nowiki></p>
+
<p>Note that the ability macro starts with a call to the <b>ChatSetAttr API</b> to set the <i>casting-level</i> to 1 and the name of the caster to be <i><Character-name>'s Ring of Shooting Stars</i>Not strictly necessary, but a nice cosmetic.</p>
+
<p>The data section now includes repeating data sets, one for each of the powers that the item has:</p>
+
<pre>RingData=[w:Ring of Shooting Stars,sp:5,rc:charged,ns:6], [cl:PW,w:RoSS-Dancing-Lights,sp:5,pd:12], … </pre>
+
<p>The first data set is very similar to the standard magic item data, with the addition of the <b>ns:</b> field, and is then followed by a number of repeated data sets specifying each of the powers:</p>
+
<table>
+
<tr><th scope="row">ns:</th><td>&lt;#&gt;</td><td>The number of powers (or spells) that the item can wield or store</td></tr>
+
<tr><th scope="row">cl:</th><td>&lt;MU/PR/PW&gt;</td><td>The type of the power/spell specification: PW=power, MU=wizard spell, PR=priest spell</td></tr>
+
<tr><th scope="row">w:</th><td>&lt;text&gt;</td><td>The name of the power/spell - must be exactly the same as the database name (case ignored)</td></tr>
+
<tr><th scope="row">sp:</th><td>&lt;[-/+]# / dice roll spec&gt;</td><td>The speed or casting time of the power/spell in segments</td></tr>
+
<tr><th scope="row">pd:</th><td>&lt;-1/#&gt;</td><td>The available casts per day, or -1 for <i>'at will'</i></td></tr>
+
</table>
+
<p>By running the <b>--check-db</b> command (see section 9 and the note above) these data sets are used to correctly set up the database with the powers wielded, so that when a Character receives this item, the Character also gains the powers to use through the item.</p>
+
<p><b>Note:</b> if a Character picks up two Power-wielding items with exactly the same item name (i.e. two copies of the same item) the results are unpredictable. This is best avoided.</p>
+
<p>Feel free to just copy the specification for a Ring-of-Shooting-Stars in the Rings database and save it to a new Ability Macro with a different name, and then alter the power names, speeds, and uses per day, as well as the API Button <b>--mi-power</b> commands and the other text, to form new power-wielding magic items.  Also, the Ring does not have to have 6 powers - just remove or add one or more repeating data sets to reduce or increase the number of powers.</p>
+
<p>Here is an example of a spell-storing magic item:</p>
+
===Ring-of-Spell-Storing-HHSLS===
+
<p style="display: inline-block; background-color: lightgrey; border: 1px solid black; padding: 4px; color: dimgrey; font-weight: extra-light;">/w "@{selected|character_name}" <nowiki>&{template:2Edefault}{{name=Ring of Spell Storing with Haste x2, Slow, Light & Sleep}}{{subtitle=Ring}}</nowiki><span style="color:green">Specs=[Ring of Spell Storing,Ring,1H,Conjuration-Summoning]</span><nowiki>{{Speed=[[5]] regardless of spell}}</nowiki><span style="color:blue">RingData=[w:Ring of Spell Storing HHSLS,sp:5,rc:uncharged,ns:5], [cl:MU,w:Haste,sp:5,lv:6], [cl:MU,w:Haste,sp:5,lv:6], [cl:MU,w:Slow,sp:5,lv:7], [cl:MU,w:Light,sp:5,lv:3], [cl:MU,w:Sleep,sp:5,lv:3]</span><nowiki> {{Size=Tiny}}{{Store spell=[Store Priest Spell](</nowiki><span style="color:red">!magic --mem-spell MI-PR|@{selected|token_id}</span>)<br>
+
[Store Wizard Spell](<span style="color:red">!magic --mem-spell MI-MU|@{selected|token_id}</span><nowiki>)}}{{Cast spell=[View](</nowiki><span style="color:red">!magic --view-spell mi-muspells|@{selected|token_id}</span>) or [Cast](<span style="color:red">!magic --cast-spell MI|@{selected|token_id}</span><nowiki>) spells}}{{</nowiki>desc=A ring of spell storing contains 1d4+1 spells which the wearer can employ as if he were a spellcaster of the level required to use the stored spells. The class of spells contained within the ring is determined in the same fashion as the spells on scrolls (see "Scrolls"). The level of each spell is determined by rolling 1d6 (for priests) or 1d8 (for wizards). The number rolled is the level of the spell, as follows:<br>
+
Priest: 1d6, if 6 is rolled, roll 1d4 instead.<br>
+
Wizard: 1d8, if 8 is rolled, roll 1d6 instead.<br>
+
Which spell type of any given level is contained by the ring is also randomly determined.<br>
+
The ring empathically imparts to the wearer the names of its spells. Once spell class, level, and type are determined, the properties of the ring are fixed and unchangeable. Once a spell is cast from the ring, it can be restored only by a character of appropriate class and level of experience (i.e., a 12th-level wizard is needed to restore a 6th-level magical spell to the ring). Stored spells have a casting time of [[5]].<nowiki>}}</nowiki></p>
+
<p>This is a specific version of a Ring of Spell StoringAs the spells stored are specified in the macro, if you want there to be multiple rings of spell storing in your campaign they each need to be individually programmed (easy cut & paste job) & named differently.</p>
+
<p>The only new field in these data sets is:</p>
+
<table>
+
<tr><th scope="row">lv:</th><td>&lt;#&gt;</td><td>The level of the caster who cast the spell into the ring.  The spell will have effects as if cast at this level when cast from the ring.</td></tr>
+
</table>
+
<p>The <b>lv:</b> field only specifies the level of the initial spell caster when the item is first found.  Once owned and used, the level of the spell caster is recorded each time a spell is refreshed by casting into the item.  As the item is then passed from one Character to another, or stored in a container and recovered later, the levels at which the spells were cast is retained.  However, if the item is reloaded from the databases, or a duplicate of the item is placed by the DM and found by another character, that version of the item will have the spell caster levels from the database definitions.  Note that if a single Character picks up two versions of exactly the same spell storing item (i.e. with the same item name) the results are unpredicable...</p>
+
<p>Feel free to just copy the specification for a Ring-of-Spell-Storing in the Rings database and save it to a new Ability Macro with a different name, and then alter the spell names and casting levels as desired, to form new Rings of Spell Storing or other magic items.  Also, the Ring does not have to have 5 spells - just remove or add one or more repeating data sets to reduce or increase the number of stored spells (though the official definition of a Ring of Spell Storing states a maximum of 5 spells).</p>
+
<br>
+
==Weapons (if using AttackMaster API)==
+
<p>Weapons, magical or not, are special types of items in the Magic Items databases.  If coded properly (in the same way as those in the MI-DB-Weapons database), they can be used with the <b>AttackMaster API</b> to implement fully automatic weapon management, the ability to hold weapons “in-hand” or sheathed, to have automatic ammo and range management for ranged weapons, automatic entry of weapons into the melee and/or ranged weapons tables, ready to make attacks with magical plusses and other specifications all set up, and support for dancing weapons (ones that can attack without being held by the Character), creatures with more than 2 hands, and 1-handed weapons, 2-handed weapons, and even weapons that need more than 2 hands!</p>
+
<p>See the <b>Weapon & Armour Database Help</b> handout and AttackMaster API documentation for how Weapon definitions should be structured for use with the AttackMaster API, which are just a few additions to the standard definition of an item.</p>
+
<br>
+
==Armour & Shields==
+
<p>Like weapons, armour and shields of all types (including magical armour like magical Bracers and Rings of Protection) can be coded to be used with the <b>AttackMaster API</b> to automatically calculate the appropriate AC for various scenarios (such as with & without Shield, from the back, if surprised, etc).  This will take into account if the armour is valid for the character class, determine which is the best armour combination that the character has, if various armour elements can or can't work together, and add in Dexterity bonuses or impairments.  It will also allow magical effects cast on the character to take effect or be adjusted via the token “circles” and highlight when such an effect is in place by showing the relevant token bar (only when there is a difference between the token AC and calculated AC).</p>
+
<p>See the <b>Weapon & Armour Database Help</b> handout and AttackMaster API documentation for how Armour & Shield definitions should be structured for use with the AttackMaster API, which are just a few additions to the standard definition of an item.</p>
+
<p>Also, see the <b>RoundMaster API</b> documentation for how magical effects can be placed on and affect tokens and characters.</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>
+
<p>There are no default settings for any of the Specs data fieldsAll must be explicitly specified.</p>
+
====Spell Types====
+
<p>There is an infinite list of spell types: generally the type is the spell name.</p>
+
====Spell Item-Classes====
+
<table>
+
<tr><th scope="row">MUSpellL< 1-9 ></th><td>A Wizard spell with the Level specified as a number from 1 to 9</td></tr>
+
<tr><th scope="row">PRSpellL< 1-9 ></th><td>A Priest spell with the Level specified as a number from 1 to 9</td></tr>
+
<tr><th scope="row">Power</th><td>A Power</td></tr>
+
</table>
+
====Spell Handedness====
+
<p><b>0H</b> A spell/power that does not take a hand (there is no Somatic component)<br>
+
<b>1H</b> A spell/power that requires only 1 hand to cast (most spells are like this)<br>
+
<b>2H</b> A spell/power that requires 2 hands to cast (perhaps a scroll must be held)<br>
+
<b>3H</b> A spell/power that takes 3 hands… perhaps more than 1 caster together?<br>
+
<b>4H</b> Etc  No currently programmed spells use more than 2 hands<br>
+
<b>…</b> …</p>
+
====Spell/Power Schools====
+
<p>Spell Schools are not currently checked by the system, but are required for future expansion for whether it can be used by a Character of a specific class, or if there are magical situations that suppress various spell types. Those implemented so far for the Spells databases are:</p>
+
<p><i>Abjuration, Alteration, Conjuration-Summoning, Enchantment-Charm, Divination, Illusion-Phantasm, Invocation-Evocation, Necromancy.</i></p>
+
<p>Note that the '/' in School names in the AD&D2e PHB have been replaced by hyphens.  It is also allowed to use just one half of any hyphenated school name where appropriate. If a spell or power is of more than one school, separate each with a vertical bar character '|'</p>
+
<br>
+
====Magic Item Types====
+
<p>There is an infinite list of magic item types: generally the type is the magic item nameA magic item can have more than one type, with each separated by a vertical bar character '|'</p>
+
====Magic Item Classes====
+
<table>
+
<tr><th scope="row">Weapon</th><td>Weapons that are not Melee or Ranged weapons or any other class</td></tr>
+
<tr><th scope="row">Melee</th><td>Melee weapons that are used in hand-to-hand combat</td></tr>
+
<tr><th scope="row">Innate-Melee</th><td>Melee weapons that do not require proficiency to wield</td></tr>
+
<tr><th scope="row">Ranged</th><td>Ranged weapons that are either thrown or fire ammunition</td></tr>
+
<tr><th scope="row">Innate-Ranged</th><td>Ranged weapons that do not require proficiency to wield</td></tr>
+
<tr><th scope="row">Ammo</th><td>All types of ammunition that is used by Ranged weapons</td></tr>
+
<tr><th scope="row">Armour</th><td>Any type of armour that does not need to be held to work</td></tr>
+
<tr><th scope="row">Shield</th><td>A barrier that is held in hand(s) and defends against one or more attacks from the front</td></tr>
+
<tr><th scope="row">Potion</th><td>Any type of potion, oil, pill or similar that is consumed or rubbed on</td></tr>
+
<tr><th scope="row">Scroll</th><td>Scrolls and spell books, that contain one or multiple spells</td></tr>
+
<tr><th scope="row">Wand</th><td>Wands that cast spells or spell-like effects when wielded in the hand</td></tr>
+
<tr><th scope="row">Staff</th><td>Quarterstaffs and similar large bludgeoning items that can also have spell-like abilities</td></tr>
+
<tr><th scope="row">Rod</th><td>Walking-stick sized rods that can do spell-like effects, especially when used to attack</td></tr>
+
<tr><th scope="row">Ring</th><td>Rings that are worn on a finger, one to each hand, that protect, have powers or spells</td></tr>
+
<tr><th scope="row">Protection-Ring</th><td>Rings that protects and are counted as a type of Armour</td></tr>
+
<tr><th scope="row">Protection-Robe</th><td>A Robe that protect and are counted as a type of Armour</td></tr>
+
<tr><th scope="row">Light</th><td>All types of lantern, torch, and other illumination</td></tr>
+
<tr><th scope="row">Miscellaneous</th><td>Anything that does not fit in one of the other categories</td></tr>
+
<tr><th scope="row"><i>Unspecified</i></th><td>Items without any Specs section or an empty Class definition are listed under DM-Only</td></tr>
+
</table>
+
====Armour Handedness====
+
<p><b>0H</b> Items that do not require to be held to work (e.g. a Ring, Buckler or a Helm)<br>
+
<b>1H</b> An item that must be held in one hand to work, such as a Wand<br>
+
<b>2H</b> Items that need two hands to wield, like a Staff<br>
+
<b>3H</b> Items that need three hands to use, perhaps by two characters… (not yet implemented)<br>
+
<b>…</b> etc.</p>
+
====Item Schools====
+
<p>Currently, all Magic Items other than Weapons and Armour use the same set of magical schools as for Spells & Powers, as they mostly perform spell-like effects.  See section 11.7.1.4 for the list.</p>
+
===Data Sections===
+
<p>Definitions for Data Section field types for Weapons & Armour can be found in the AttackMaster API documentation.  Below are the definitions for Spell, Power & other Magical Item types.</p>
+
<p><b>Note:</b> Always refer to the database specification definitions in other sections above for detailed information on the use of these Field specifiers.  Not all specifiers have an obvious use.</p>
+
<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="8">Can be used in</th>
+
</tr>
+
<tr>
+
<th scope="col">Spell<br>Data</th>
+
<th scope="col">Potion<br>Data</th>
+
<th scope="col">Scroll<br>Data</th>
+
<th scope="col">Wand<br>Data</th>
+
<th scope="col">Staff<br>Data</th>
+
<th scope="col">Rod<br>Data</th>
+
<th scope="col">Ring<br>Data</th>
+
<th scope="col">Misc<br>Data</th>
+
</tr>
+
</thead>
+
<tr><th scope="row">w:</th><td>< text ></td><td>'-'</td><td>Name to be displayed</td><td> </td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
<tr><th scope="row">w:</th><td>< text ></td><td>''</td><td>Name of spell or power (Not case sensitive)</td><td>X</td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td></tr>
+
<tr><th scope="row">+:</th><td>[ + / - ] #</td><td>0</td><td>Magical adjustment</td><td> </td><td> </td><td> </td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
<tr><th scope="row">n:</th><td># [ / # ]</td><td>1</td><td>Attacks per round</td><td> </td><td> </td><td> </td><td>X</td><td>X</td><td>X</td><td> </td><td>X</td></tr>
+
<tr><th scope="row">sz:</th><td>[ t / s / m / l / h ]</td><td>''</td><td>Size of item</td><td> </td><td> </td><td> </td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
<tr><th scope="row">sp:</th><td>[-]# or Dice Roll spec</td><td>0</td><td>Speed in segments (1/10 round)</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
<tr><th scope="row">wt:</th><td>#</td><td>1</td><td>Weight of item in lbs</td><td> </td><td>X</td><td> </td><td>X</td><td>X</td><td>X</td><td> </td><td>X</td></tr>
+
<tr><th scope="row">ns:</th><td>#</td><td>0</td><td>Number of stored spells & powers defined for item</td><td> </td><td> </td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
<tr><th scope="row">w:</th><td>< text ></td><td>'-'</td><td>Name of stored spell or power (Not case sensitive)</td><td>X</td><td> </td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
<tr><th scope="row">cl:</th><td>MU / PR / PW</td><td>''</td><td>Type of stored spell or power</td><td> </td><td> </td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
<tr><th scope="row">lv:</th><td>#</td><td>1</td><td>Level at which spell/power is cast</td><td> </td><td> </td><td> </td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
<tr><th scope="row">pd:</th><td>-1 / #</td><td>1</td><td>Number per day (power only)</td><td> </td><td> </td><td> </td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
<tr><th scope="row">rc:</th><td>Charged / Uncharged / Rechargeable / Recharging / Self-chargeable / Cursed / Charged-Cursed / Recharging-Cursed / Self-chargeable-Cursed</td><td>Uncharged</td><td>Initial charged and Cursed status of item when found (Can be changed by DM using -gm-only-mi command once added to Character Sheet) Not case sensitive</td><td> </td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
+
</table>
+
<br>
+

Revision as of 20:00, 9 January 2022

The CommandMaster API is part of the RPGMaster suite of APIs for Roll20, which includes RoundMaster, InitiativeMaster, AttackMaster, MagicMaster and CommandMaster. It manages the initialisation of a Campaign to use the RPGMaster APIs, communication and command syntax updates between the APIs and, most importantly for the DM, easy menu-driven setup of Tokens and Character Sheets to work with the APIs.

API ScriptAuthor: Richard E
Version: 1.020
Last Modified: 2022-01-09
Code: CommandMaster
Dependencies: RoundMaster, InitiativeMaster, AttackMaster
Conflicts: None

Contents

How CommandMaster Works

The CommandMaster API coordinates other APIs in the RPGMaster API series and provides the DM with facilities to set the Campaign up to use them. It will initialise a Campaign in Roll20 to use the RPGMaster series APIs. APIs can register their commands with CommandMaster and, should they change in the future, CommandMaster will search all Character Sheets and databases for that command and offer the DM the option to automatically update any or all of those found to the new command structure of that API. Selected Tokens and their associated Character Sheets can be set up with the correct Token Action Buttons, with spell-users given spells in their spell book, fighters given weapon proficiencies, setting saving throws correctly, and linking token circles to standard Character Sheet fields.

Initialising a Campaign

Using the --initialise command will add a number of Player Macros for the DM that will run the most-used RPGMater DM commands, which can be flagged to appear in the Macro Bar at the bottom of the DM’s screen for ease of access.

Setting up tokens & character sheets

Selecting one or multiple tokens and running the --abilities command will allow token action buttons and RPGMaster API capabilities to be set up for all the represented Character Sheets at the same time, though all Character Sheets will be set up the same way.

Registering API commands

Any API command can be registered with CommandMaster using the --register command. This will allow the command registered to be added as a Token Action Button to Character Sheets by the abilities command, and to be optionally updated in all Character Sheets wherever used should the details of the registration change.

Editing Character Sheet abilities

Danger: this command is very powerful, and can ruin your campaign if mis-used! The --edit command can be used to change any string in Character Sheet ability macros to any other string, using ‘escaped’ characters to replace even the most complex strings. However, use with care!


Syntax of CommandMaster calls

The CommandMaster API is called using !cmd.

!cmd --initialise

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

!cmd --register action|description|api-call|api-command|parameters

Commands can be stacked in the call, for example:

!cmd --initialise --abilities

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

Commands

Campaign setup

--initialise
--abilities

Character Sheet configuration

--add-spells [POWERS/MUSPELLS/PRSPELLS] | [level]
--add-profs
--set-prof  [NOT-PROF/PROFICIENT/SPECIALIST/MASTERY] | weapon | weapon-type
--set-all-prof

Command and Ability maintenance

--register action|description|api-call|api-command|parameters
--edit old-string | new-string

Other commands

--help
--debug [ON/OFF]


Campaign setup

Initialise for RPGMaster APIs

--initialise

This command creates a number of Player Macros which can be found under the Player Macro tab in the Chat window (the tab that looks like three bulleted lines, next to the cog). These macros hold a number of DM commands that are useful in setting up and running a campaign. It is recommended that the “Show in Bar” flags for these macros are set, and the “Show Macro Bar” flag is set (the macro bar is standard Roll20 functionality - see Roll20 Help Centre for more information).

The buttons added are:

  • Maint-menu: Runs the !init --maint command
  • Token-setup: Runs the !cmd --abilities command
  • Add-items: Runs the !magic --gm-edit-mi command
  • End-of-Day: Runs the !init --end-of-day command
  • Initiative-menu: Runs the !init --init command

The DM can drag Macro Bar buttons around on-screen to re-order them, or even right-click them to change their name and colour of the button. Feel free to do this to make the Macro Bar as usable for you as you desire.

Setup Tokens & Character Sheets

--abilities

Displays a menu with which one or more selected tokens and the Character Sheets they represent can be set up with the correct Token Action Buttons and data specific to the RPGMaster APIs, to work with the APIs in the best way. The menu provides buttons to add any command registered with CommandMaster (see --register command) as a Token Action Button, add spells to spell books, add granted powers, add or change weapon proficiencies and proficiency levels for each weapon, set the correct saving throws based on race, class & level of character / NPC / creature, and optionally clear or set the Token ‘circles’ to represent AC (bar 1), base Thac0 (bar 2) and HP (bar 3). Essentially, using this menu accesses the commands in section 2 without the DM having to run them individually.

All tokens selected when menu items are used will be set up the same way: exceptions to this are using the Set Saves button (sets saves for each selected token/character sheet correctly for the specifications of that sheet), and the Set All Profs button (sets weapon proficiencies to proficient based on the weapons in each individual token/character sheet’s item bag). Different tokens can be selected and set up differently without having to refresh the menu.

Character Sheet configuration

The commands in this section can be accessed using the --abilities command menu. The individual commands below are used less frequently.

Add spells to spell book

--add-spells [POWERS/MUSPELLS/PRSPELLS] | [level]

Displays a menu allowing spells in the Spells Databases to be added to the Character Sheet(s) represented by the selected Token(s). If no spell type and/or spell level is specified, the initial menu shown is for Level 1 Wizard spells (MUSPELLS). Buttons are shown on the menu that allow navigation to other levels, spell types and powers.

Note: adding spells / powers to a sheet does not mean the Character can immediately use them. They must be memorised first. Use the commands in the MagicMaster API to memorise spells and powers.

Choose weapon proficiencies

--add-profs

Displays a menu from which to select proficiencies and level of proficiency for any weapons in the Weapon Databases. Also provides a button for making the Character proficient in all weapons carried (i.e. those currently in their Item table).

All current proficiencies are displayed, with the proficiency level of each, which can be changed or removed.

Note: this does more than just entering the weapon in the proficiency table. It adds the weapon group that the weapon belongs to as a field to the table (see weapon database help handouts for details), which is then used by the AttackMaster API to manage related weapon attacks and give the correct proficiency bonuses or penalties for the class and weapon used.

Add weapon proficiencies

--set-prof  [NOT-PROF/PROFICIENT/SPECIALIST/MASTERY] | weapon | weapon-type 

Sets a specific weapon proficiency to a named level. If the proficiency level is omitted, PROFICIENT is assumed. If the weapon already exists in the proficiencies table, the existing proficiency level is updated to that specified. Otherwise, the weapon (and its weapon group) are added to the table at the specified level.

Note: this does more than just entering the weapon in the proficiency table. It adds the weapon group that the weapon belongs to as a field to the table (see weapon database help handouts for details), which is then used by the AttackMaster API to manage related weapon attacks and give the correct proficiency bonuses or penalties for the class and weapon used.

Add proficiencies for all carried weapons

--set-all-prof

Adds all currently carried weapons (those in the Items table) to PROFICIENT, saving them and their weapon group to the weapon proficiency table. Those weapons found that are already in the table are reset to PROFICIENT (overwriting any existing different proficiency level). Any other proficiencies already in the table are not altered.

Note: this command always adds a weapon proficiency called innate. This proficiency is used for attacks with innate weapons, such as claws and bites, but also for spells that require a touch attack. Indeed, to make this even more specific, the weapons database distributed with the AttackMaster and MagicMaster APIs includes a weapon called Touch.

Tip: if using the MagicMaster API then running the !magic --gm-edit-mi command and adding weapons before running this command can speed up setting up character sheets.

Command and Ability maintenance

Register an API command

--register action|description|api-call|api-command|parameters

Register an API command with the CommandMaster API to achieve two outcomes: allow the command to be set up as a Token Action Button, and/or automatically maintain & update the syntax of the commands in Character Sheet ability macros and the RPGMaster API databases.

This is a powerful and potentially hazardous command. Registry of an API command is remembered by the system in the state variable, which is preserved throughout the life of the Campaign in Roll20. If a subsequent registration of the same action has different parameters, the system detects this and searches all Character Sheet ability macros for the old version of the command and replaces all of them with the new command. It also changes the parameters, using a syntax including a range of character \‘escapes\’ to substitute characters that Roll20 might otherwise interpret as commands itself. In detail, the --register command takes:

action:the unique name given to this command in the whole system. This can be any legal text name including A-Z, a-z, 1-9, -, _ only. Must start with an alpha. Case is ignored.
description:a short description of the command, which is displayed in the menu that allows the command to be added as a Token Action Button.
api-call:the API call without the !, e.g. cmd, or magic, etc
api-command:the command to be passed to the specified API, with the hyphens replaced by ~~ or plusses replaced by **, e.g. ~~cast-spell or **menu.
parameters:the parameters (or initial parameters) to be passed as part of this command to replace the matching existing command parameters. This string is \‘escaped\’ using the following character replacements:
Character Parameter separator  ? [ ] < > @ - |  : & { }
Substitute  %% ^ << >> ` ~ ¦ &amp; &#123; &#125;
Alternative
(no ; )
\vbar \ques \lbrak \rbrak \lt \gt \at \dash \vbar \clon \amp \lbrc \rbrc

Commands cannot have a CR (carrage return/new line) in the middle of them, but CR can separate commands in multi-command sequences.

If the parameter string ends with $$, this will ensure that a complete command up to the next CR is to be replaced (including everything up to the CR even if not part of the command). If there is not a $$ on the end of the parameter string, then only the command and parameters that are matched are replaced (using a parameter count of each old and new parameter separated by ‘%%’) - the rest of the line (including any remaining parameters not so matched) will be left in place.

Here are some examples of registration commands:

--register Spells_menu|Open a menu with spell management functions|magic|~~spellmenu |\`{selected|token_id}
--register Use_power|Use a Power|magic|~~cast-spell|POWER%%\`{selected|token_id}
--register Attack_hit|Do an attack where Roll20 rolls the dice|attk|~~attk-hit|\`{selected|token_id}

Edit ability macros

--edit existing-string | new-string

Danger: use this command with extreme care! It can destroy your Campaign! It is recommended that you make a backup copy of your Campaign before using this command. --register is more controlled, as it has been tested with the RPGMaster command strings, and any future releases that change the API commands will be fully tested before release for their effect on Campaigns, with accompanying release notes. Using the --edit function directly can have unintended consequences!

Replaces an existing ‘escaped’ string with a new replacement string in all ability macros on all Character Sheets including the API character sheet databases. These strings both use the same escape sequence replacements as for the --register command (see section 3.1) as in fact --register and --edit use the same functionality.

Examples of its use are to change API command calls, or Character Sheet field name access in macros should the field names change.


Other Commands

Display help on these commands

--help

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.

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.


Character Sheet and Token setup for use with RPGMaster APIs

Token configuration

The API can work with any Token configuration but requires tokens that are going to participate in API actions to represent a Character Sheet, so that actions relevant to the token and the character it represents can be selected.

A single Character Sheet can have multiple Tokens representing it, and each of these are able to do individual 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.

The recommended Token Bar assignments for all APIs in the Master Series are:

Bar1 (Green Circle):	Armour Class (AC field) - only current value
Bar2 (Blue Circle):	Base Thac0 (thac0-base field) before adjustments - only current value
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.

These assignments can be changed in each API, by changing the fields object near the top of the API script (note: no underscore, and 'bar#' and 'value' or 'max' are separate entries in an array of 2 elements). All APIs must use the same field definitions:

fields.Token_AC:	defines the token field for the AC value (normally ['bar1','value'])
fields.Token_MaxAC:	defines the token field for the AC max (normally ['bar1','max'])
fields.Token_Thac0:	defines the token field for the Thac0 value (normally ['bar2','value'])
fields.Token_MaxThac0: defines the token field for the Thac0 max (normally ['bar2','max'])
fields.Token_HP:	defines the token field for the HP value (normally ['bar3','value'])
fields.Token_MaxHP:	defines the token field for the HP max (normally ['bar3','max'])

Alter the bar numbers appropriately or, if you are not wanting one or more of these assigned: leave the two elements of the array as [,]. The system will generally work fine with reassignment or no assignment, but not always. Specifically, some effects in the Effects-DB, which implement spell effects on Character Sheets and Tokens, may not set the right values if no assignment of one or more of HP, AC & Thac0 are made to the Token.


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 the AttackMaster API code, right at the top, is an object definition called 'fields': see section 3 for details. This can be altered to get the API to work with other character sheets.

The coding of the API is designed to use the AD&D 2E system of attack calculations, armour class values and saving throw management. If you use another system (e.g. the D&D 5e system) the API coding will need to change. This might be a future enhancement.

Matching the API to a type of Character Sheet

The API has an object definition called 'fields', which contains items of the form

Internal_api_name: [sheet_field_name, field_attribute, optional_default_value, optional_set_with_worker_flag]

A typical example might be:

Fighter_level:['level-class1','current'],
Or
MUSpellNo_memable:['spell-level-castable','current','',true],

The internal_api_name must not be altered! Doing so will cause the system not to work. However, the sheet_field_name and field_attribute can be altered to match any character sheet.

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.

Internal_api_table: [sheet_repeating_table_name,starting_index]

An example is:

MW_table:['repeating_weapons',0],

The internal_api_table must not be altered! 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.

Each character sheet must have repeating tables to hold weapons, ammo and magic items, as well as other data. 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, and magic items are held in the repeating_potions table. The table management system provided by the API 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.

Character Attributes, Races, Classes and Levels

Character Attributes of Strength, Dexterity, Constitution, Intelligence, Wisdom and Charisma are generally not directly important to the RPGMaster Series APIs, 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 section 2 above).

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.

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, 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 weapons, armour, shields, some magic items and saves.

Important 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.

Note: classes of Fighter and Rogue (such as 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 need to have levels set in the corresponding spell-caster columns - the casting ability & level is worked out by the system

The following Classes are currently supported:

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.

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 commands --edit-mi or the GM-only command --gm-edit-mi. Alternatively, the AttackMaster --edit-weapons command can be used to load weapons, ammunition and armour into the Items table. It is generally possible to enter item names and quantities directly into the table and use them within the system, but 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). Other items can be in the table but will not otherwise be effective.

Items can be added to the databases. See the Database Handouts for more information on the databases.

Weapons and Ammo

For the APIs to work fully the melee weapons, damage, ranged weapons and ammo must be selected using the AttackMaster --weapon command to take the weapon 'in hand'. This will display a menu to take weapons and shields from the Items table and take them in hand, ready to use. This automatically fills all the correct fields for the weapons and ammo to make attacks, including many fields that are not displayed. Entering weapon data directly into the melee weapon, damage, ranged weapon and ammo tables will generally work, but will be overwritten if the --weapon command is used. Also, some API functions may not work as well or at all.

For the InitiativeMaster API to support weapon attack actions weapon name, speed and number of attacks are the most important fields. For the AttackMaster API to support attack rolls, proficiency calculations, ranged attacks, strength and dexterity bonuses, and other aspects of functionality, fill in as many fields as are visible on the character sheet. When entering data manually, ensure that the row a melee or ranged weapon is in matches the row damage or ammo is entered in the respective tables (there is no need to do this if using AttackMaster functions to take weapons in-hand, as the relevant lines are otherwise linked).

Weapon Proficiencies

Weapon Proficiencies must be set on the Character Sheet. This is best done by using the CommandMaster API character sheet management functions, but can be done manually. Both specific weapons and related weapon groups can be entered in the table, and when a Player changes the character's weapons in-hand the table of proficiencies will be consulted to set the correct bonuses and penalties. Weapon specialisation and mastery (otherwise known as double specialisation) are supported by the CommandMaster functions, but can also be set by ticking/selecting the relevant fields on the Character Sheet weapon proficiencies table. If a weapon or its related weapon group does not appear in the list, it will be assumed to be not proficient.

Spell books and memorisable spells

The best (and easiest) way to give a Character or NPC spells and powers is to use CommandMaster API to add spells and powers to the Character's spellbooks, and MagicMaster API to memorise and cast spells and use powers. However, for the purposes of just doing initiative and selecting which spell to cast in the next round, the spells and powers can be entered manually onto the character sheet. Spells 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.

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 initiative 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).

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 spells Initiative Menu. 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.

Spells can only be cast if they have macros defined in the spell databases (see Spell Database Handout). If the CommandMaster API is loaded, the DM can use the tools provided there to manage Character, NPC & creature spell books and granted powers from the provided spell & power databases.

The spells a spell caster can memorise (what they have in their spell books, or what their god has granted to them) is held as a list of spell names separated by vertical bars '|' in the character sheet attribute defined in fields.Spellbook (on the AD&D2E character sheet 'spellmem') of each level of spell. On the AD&D2E sheet, the spell books are the large Spell Book text fields at the bottom of each spell level tab. The spell names used must be identical (though not case sensitive) to the spell ability macro names in the spell databases (hence the hyphens in the names). So, for example, a 1st level Wizard might have the following in their large Wizard Level 1 spell book field:

Armour|Burning-Hands|Charm-Person|Comprehend-Languages|Detect-Magic|Feather-fall|Grease|Identify|Light|Magic-Missile|Read-Magic|Sleep

Only these spells will be listed as ones they can memorise at level 1. When they learn new spells and put them in their spell book, this string can be added to just by typing into it. When they reach 3rd level and can have 2nd level spells, the following string might be put in the spell book on the Level 2 Wizard spells tab:

Alter-Self|Invisibility|Melfs-Acid-Arrow|Mirror-Image|Ray-of-Enfeeblement

Again, as they learn more spells and put them in their spell book, just edit the text to add the spells.

Once these spell books are defined, the DM or Player can use the MagicMaster -mem-spell command (or an action button and associated ability macro on the Character Sheet) to memorise the correct number of these spells in any combination and store those on the Character Sheet.

Powers

Powers can only be used if they are defined in the Powers database - see Database handouts. If the CommandMaster API is also loaded, the DM can use the tools provided there to manage Character, NPC & creature spellbooks and granted powers.

Powers work in an almost identical way to Wizard & Priest spells, except that there is only 1 level of powers. Powers that the character has are added to the spell book on the Powers tab in the same way as spells, and then memorised using the --mem-spell command (which also works for powers with the right parameters).