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

Script:MagicMaster

From Roll20 Wiki

Jump to: navigation, search

Main Page: API:Script Index

API ScriptAuthor: Richard E
Version: 1.5.02
Last Modified: 2023-05-24
Code: MagicMaster
Dependencies: ChatSetAttr,TokenMod, RoundMaster, InitMaster, AttackMaster, CommandMaster, RPGMlibrary AD+D2e
Conflicts: None

MagicMaster API provides functions for AD&D-2E (though 5e and other spells could be added) to manage all types of magic, including Wizard & Priest spell use and effects; Character, NPC & Monster Powers; and discovery, looting, use and cursing of Magic Items. It's a part of the RPGMaster suite of APIs.

Note: This API requires that a RPGMaster Library API is loaded, which provides RPG version-specific and Roll20 Character Sheet version-specific data, rulesets and processing (as well as other goodies!).

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

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

Contents

Forum

RPGMaster Forum

MagicMaster Database Help

RPGMaster Magic Spells & Items DB - RPGMaster Spells & Magic Items databases Wiki page

Configuring Character Sheets

RPGMaster Character Sheet setup - RPGMaster Character Sheet setup Wiki page

What MagicMaster does

Class, Item, Spell and Power databases

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

Spells and Powers

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

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

Adding Spells & Powers to the Character

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

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

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

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

Casting spells and using powers

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

Types of Item Provided

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

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

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

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

Adding Items to the Character

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

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

Using Items

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

Dynamic lighting for tokens

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

DM tools

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

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

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


How to use MagicMaster

Installation and Configuration

Copy the script's code, available either via the Roll20 One-Click Install system, or from the menu on the right and stored at Roll20's API GitHub Repository and paste the code into a new script in your campaign's API Script Editor. Save the new script and it will be available inside your campaign. It will install several new Character Sheets and Handouts: The handout MagicMaster Help provides a full manual of how to use MagicMaster. The handout RPGMaster CharSheet Setup provides information on setting up a character sheet for use with MagicMaster and the rest of the RPGMaster API series. The handout Magic Database Help provides information on use and adding to the Magic Item, Spell & Power databases.

Script Use

After installing the script, refer the the handout MagicMaster Help for full information on use. Below is a copy of the contents of that handout.

Syntax

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

!magic --help

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

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

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

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

Commands can be stacked in the call, for example:

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

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


Commands

Commands Index

Spell and Power management

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

Magic Item management

--mimenu [token_id]
--edit-mi [token_id]
--view-mi [token_id]
--use-mi [token_id]
--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]

Spell, power & magic item effects and resting

!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]

Treasure & Item container management

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

Light source management

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

Other commands

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


Spell management

Display a menu to do actions with spells

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

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

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

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

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

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

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

The Character Sheet associated with the token must have spell books specified for the relevant types of spells or powers. These are lists of spells from the spell macro databases 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 RPGMaster CharSheet Setup handout (created by the API) for how to create these manually.

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

MI-MU and MI-PR have a special function: these are used to cast memorised spells into a spell-storing magic item (which should be the last item selected by the Character running the command), such as a Ring of Spell Storing. Magic Item spells are stored in an unused level of the Character Sheet. This command displays both all memorised spells and all spell-storing magic item spell slots 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.

View the memorised spells or granted powers

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

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

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

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

Cast a memorised spell or use a granted power

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

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

This displays a menu of all levels of the memorised spells/powers of the relevant type. MI displays the spell book for 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.

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

If the optional CHARGED parameter is specified (only relevant to spells and powers stored on magic items), this specifies that the Magic Item from which the spell or power is cast is charged, and looses one charge when that cast is made. This is generally the case when the spell or power is on a Scroll. When the charge quantity reaches zero (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.

Cast the last used spell or power again

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

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

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


Magic Item management

Display a menu of possible Magic Item actions

--mimenu [token_id]

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

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

Searching & Storing are explained in section 7.

Edit a Magic Item bag

--edit-mi [token_id]

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

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

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

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.

View a Character's Magic Item Bag

--view-mi [token_id]

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

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

Use a Magic Item from the bag

--use-mi [token_id]

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

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

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.

Add, set or deduct Magic Item charges

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

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

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

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

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

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

Use a Magic Item power

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

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

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

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

Define the spells a spell-storing Item can store

--store-spells token_id|item_name

GM-only command. Takes a mandatory token_id, and a mandatory item_name for an item that must be in the item table of the character associated with the token with the ID provided.

Will only work for an item in the item table of the character sheet associated with the provided token if it's definition contains the command !magic --cast-spell MI or !magic --cast-spell MI-POWERS, that is an item that can cast the spells that the DM specifies such as a Ring of Spell Storing. If this is not the case, an appropriate message is displayed.

The menu displayed will allow the DM to specify which spells are stored in the item, and at what level they were cast into the item. Spells of multiple levels can be stored, and even a mixture of Wizard and Priest spells can be stored on the same item, if so desired. Any character that acquires the item will be able to cast these spells from the item and, if they can know the spell, can restore the spell using the --mem-spell command.

This command/menu is also accessible from the menu displayed by the --gm-edit-mi command for appropriately defined items.

Store spells in a spell-storing Magic Item

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

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

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

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

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

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

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

Casting a spell from a spell-storing magic item

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

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

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

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


Spell, power & magic item effects and resting

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

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

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

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

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

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

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

See the RoundMaster API documentation for full details.

Cast a spell that requires a “touch” attack roll

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

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

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

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

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

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

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

Perform Short or Long Rests

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

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

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

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

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

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

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

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


Treasure & Item container management

DM/GM version of Magic Item management

--gm-edit-mi [token_id]

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

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

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

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

Search tokens for Magic Items and Treasure

--search token_id|pick_id|put_id

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

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

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

Looting without searching, and storing items in a container

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

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

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

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


Light source management

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

Show a menu of Light Sources to select from

--lightsources [token_id]

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

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

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

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

Set a lightsource for a token

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

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

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


Other commands

Display help on these commands

--help

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

Configure API behavior

--config [PROF/ALL-WEAPS/WEAP-CLASS/ALL-ARMOUR/MASTER-RANGE/SPECIALIST-RULES/SPELL-NUM] | [TRUE/FALSE]

Takes two optional arguments, the first a switchable flag name, and the second TRUE or FALSE.

Allows configuration of several API behaviors. If no arguments given, displays menu for DM to select configuration. Parameters have the following effects:

Flag True False
PROF Strictly apply non-proficient weapon penalties as per PHB Use the non-proficient weapon penalty displayed on the Character Sheet
ALL-WEAPS Allow any character of any class to use and become proficient in any weapon. Restrict the use of weapons by class to some degree set by WEAP-CLASS
WEAP-CLASS Weapons not allowed to a class get a penalty of -100 Weapons not allowed to a class get double non-proficient penalty
ALL-ARMOUR All armour types allowed for all classes Armour not allowed to a class not included in AC calculations
MASTER-RANGE Ranged weapon Mastery gives double damage at Point Blank range Ranged weapon Mastery not allowed, as per PHB
SPECIALIST-RULES Only Specialist Wizards specified in the PHB get an extra spell per spell level Any non-Standard Wizard gets an extra spell per spell level
SPELL-NUM Spellcaster spells per level restricted to PHB rules Spellcaster spells per level alterable using Misc Spells button

Check database completeness & integrity (GM only)

--check-db [ db-name ]

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

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

This command is very useful to run after creating/adding new items as ability macros to the databases (see section 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).

Switch on or off Debug mode

--debug (ON/OFF)

Takes one mandatory argument which should be ON or OFF.

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

Forcing a database reset to the API version

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

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


Using Character Sheet Ability/Action buttons

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

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