5e Shaped Companion API
5e Shaped Companion API
5e Shaped Companion API
Version: 4.4.6
Key features
Automatically create characters from Monster Manual statblock text
Import spells to characters from user-created databases of spells in JSON format
Import monsters from user-created databases in JSON format
Automatic population of NPC spells from JSON (if present) on import (both JSON and
statblock)
Auto HP rolling on drop for monster tokens
Token setup with configurable defaults on monster import
Auto ammo decrement
Auto death save increment
Auto HD reduction/HP increase on HD roll
Advantage tracking commands - set a character to have (dis)advantage and mark which
tokens this applies to
Commands to create token actions for new characters
Short/Long Rest handling
Trait use count decrementing
Automatic configuration of new characters
Setup
Prerequisites:
You, or the person who created your game, must be a Pro subscriber to Roll20 to use this
script.
You should be familiar with how to use roll20, have a basic understanding of how to
configure a game on Roll20, including setting up character sheets and installing API
scripts. If you've only just started using Roll20 and haven't found your feet yet, setting
this script up and using it is probably a bad place to start - it's an advanced tool, many of
whose features presume a good working understanding of standard Roll20 capabilities.
Play around with a simple campaign first, get used to making characters, working with
tokens, and using the 5e Shaped Character Sheet manually; and then come back here for
power-user goodness.
You should have a recent version of the 5e Shaped Character Sheet. If you are installing
it from the list on the game settings page, it's under Dungeons & Dragons, and at the time
of writing it's called 5th Edition (Shapedv2). If you want the version of the sheet with all
the very latest fixes and features, you can install it directly from Kryx's Github.
Instructions for how to do this can be found on the thread on the character sheets forum -
the threads change frequently but at the time of writing the latest one was here
Installation
1. Open the raw text of the script
2. Copy all the text - Ctrl-A followed by Ctrl-C (or Cmd-A, Cmd-C on a Mac)
3. Got to the API scripts page for your campaign
4. Paste the text into a new script, and then give it a sensible name in the box at the top - e.g.
"5e Shaped Companion"
5. Hit save
6. When the page refreshes, check the console box at the bottom of the page to make sure
that there are no errors. If everything has worked you should see a line that looks a bit
like: "ShapedScripts 1460893071206 INFO : -=> ShapedScripts v0.8.3 <=-". If
you see a line that includes the text ERROR then Something Bad Has Happened and you
should ask for help on the API scripts forum if you can't work the problem out for
yourself from the error message (sometimes they are even helpful, I promise!)
You are now set up and should be able to use the script as detailed below.
Updating
Sometimes a new version of the script comes out. If you have installed the script according to the
instructions above, you will need to update it manually when this happens. The process is exactly
the same as installing the original, except that when you paste the script into your campaign, you
should replace the script text of the previous version rather than installing a new one. This is
very important, because if you end up with two different versions of the script running at the
same time, Bad Things Will Happen.
Optional Extras
Some of the script commands allow you to import spells or monsters from custom data files.
This can be useful for things that aren't in the SRD, or for custom stuff created by other people.
Creating these custom data files is beyond the scope of this README at the moment, but you
may find pre-made files floating around on the internet made by other people. These should be
script files that end in .js (not .json), and you install them in exactly the same way that you
install the main script. If it worked, you should see some lines like this in your API log:
"ShapedScripts 1460893071585 INFO : Summary of adding entities to the lookup:
{\"errors\":0,\"monsters\":{\"withErrors\":0,\"skipped\":0,\"deleted\":0,\"pa
tched\":0,\"added\":558}}"
Send me a private message here if you want some more guidance on finding and installing useful
extras.
Usage
Import a Monster from Monster Manual Statblock text
You first of all need a statblock from somewhere - generally speaking people get these from
PDFs of adventures, or perhaps an OCRed copy of the Monster Manual. The statblock must
conform to the layout conventions used by WotC for their 5e products or it will not work;
fortunately most published material respects these conventions. Once you have statblock, follow
these steps:
The script does its best to fix up errors in the text and be tolerant of variances in layout, but there
are some things
that it absolutely requires to be correct:
1. Find a token for your new monster and place it on the tabletop
2. Select the token
3. Type !shaped-import-monster --Lich into the chat window and hit enter, replacing
'Lich' with the name of the monster you want to import. Obviously the monster name
must match something in your custom database. If you're not sure what names are present
in the database, or exactly what spelling is being used, you can run !shaped-import-
monster on its own and it will show a button that will launch a select list of all the
available monsters.
4. You should see a message in the chat window, and end up with a new character in the
journal.
5. Open the new character; you will be presented with the option to cancel or import, click
import (this stage seems redundant, but it's working around a Roll20 limitation
unfortunately)
6. After a few seconds (be patient) all the attributes of your new character should be
populated.
7. Click the edit button at the top right of the character sheet dialog, and then click 'Use
selected token" in the "Default token" box (Unfortunately it is not possible to automate
this step either as things stand)
8. Save
When enabled, if the script detects a d20 roll with advantage or disadvantage, the character's roll
option will be automatically reverted back to "normal".
Decrementing ammo
The script will automatically decrement ammo providing that the information is filled in
correctly on the character sheet and the use ammo automatically option is turned on in the sheet
options. See the character sheet documentation for more information.
Death saves, Hit Dice
The script will automatically decrement hit dice and apply regained HP when you roll them from
the character sheet. You can turn this off in the [configuration](#configuration). When you roll a
death save, it will add it to your death save successes/failures automatically, unless you have the
roll 2 option on for your sheet rolls (since it won't know whether you succeeded or failed!)
Process HD rolls
If enabled in the configuration (see below), the script will automatically apply hit dice rolled by
clicking on the relevant HD line on the character sheet to the character's HP total. It will also
decrement the number of HD remaining. It will issue a warning if no HD of the relevant size
remain and won't add the amount to the HP total.
Short/Long rest
The script will apply the effects of a short/long rest if you run the command !shaped-rest --long
or !shaped-rest --short with a character token selected. There are also buttons that link to this
functionality on the character sheet itself. You can show these by entering "edit mode" on the
sheet and ticking the checkbox on the Core page for "Show Rests".
Options
--overwrite if the selected token already represents a character in the journal, the import
will fail to avoid accidentally overwriting data, unless you supply this option to confirm
that you wish to do so.
--replace if there is already a character in the journal with the same name as the one you
are importing, the import will fail, whether or not the current token represents that
character. This is to avoid creating loads of duplicates by mistake, which is almost never
what you want to do. If you supply --replace the script will overwrite any character with
the same name, unless there is more than one, in which case it will fail rather than risking
overwriting the wrong one. Note that --replace implies --overwrite.
Selection
You must have at least one token selected. If you have more than one, it will attempt to import a
statblock from each one in turn. When importing, each token will be set to represent the newly
created character for it, and the script will also attempt to set the avatar for the character to be the
token graphic[1](#avatar-note).
!shaped-import-monster
Alias !shaped-monster * Imports details of named monsters from a database of custom
monsters loaded as a separate script. If run with no options, this command will display a
chat window button that allows you to launch a select list of all available monsters to
choose from. The imported character will be configured with the default settings that you
specify in the [default character settings configuration](#new-characters) . In addition the
tokens you use will be configured according to the [default token settings
configuration](#token-defaults) ready to be set as the default token for the character.
Options
-- (e.g. --Lich) specifies a monster to import. You may supply multiple monsters as
separate options, or you may supply multiple in one option separated by commas (--
Ghoul, Zombie, Ghost)
--overwrite if the selected token already represents a character in the journal, the import
will fail to avoid accidentally overwriting data, unless you supply this option to confirm
that you wish to do so.
--replace if there is already a character in the journal with the same name as the one you
are importing, the import will fail, whether or not the current token represents that
character. This is to avoid creating loads of duplicates by mistake, which is almost never
what you want to do. If you supply --replace the script will overwrite any character with
the same name, unless there is more than one, in which case it will fail rather than risking
overwriting the wrong one. Note that --replace implies --overwrite.
Selection
If you have no tokens selected, this command will just add the new characters to the
journal.
If you have 1 token selected, and you are importing one monster, the script will attempt
to use the token image as the avatar for your new character[1](#avatar-note), and will
also set the token to represent the newly created character
If you have 1 token selected and you are importing more than one monster, the script will
only attempt to use the token image as the avatar for your new character[1](#avatar-note).
1 Note that avatars will ony successfully be set for token images from your library, not
marketplace or web content. This is due to security restrictions within the Roll20 platform. If you
really want an image as a character avatar, please unpload it to your library and then create a
token from it before doing your import.
!shaped-import-spell
Alias !shaped-spell * Imports details of named spells from a database of customer spells
loaded as a separate script. All spells will be added to the currently selected character. If
run with no options, this command will display a chat window button that allows you to
launch a select list of all available spells to choose from.
Options
-- (e.g. --Fireball) specifies a spell to import. You may supply multiple spells as separate
options, or you may supply multiple in one option separate by commas (--Fireball,
Lightning Bolt, Wish)
Selection
You must have exactly one token that represents a character selected when running this
command.
!shaped-import-spell-list
Imports a complete list of spells according to specified criteria into the currently selected
character. This allows you to e.g. import all 1st level cleric spells. Please note that importing
very large lists of spells into a character may result in character sheet lag, please exercise caution
when using this command.
Options
Selection
You must have exactly one token that represents a character selected when running this
command.
!shaped-at
Gives the selected character advantage or disadvantage, or neither.
Options
Selection
You must select at least one token that represents a character. The specified setting will apply to
the characters of all selected tokens.
!shaped-abilities
Creates token actions for your character as shortcuts to a variety of rolls and other actions from
the sheet.
Options
In addition, you can pass the names of spells like --Fireball to create token actions for each
spell. Obviously the character in question must actually have this spell in its spellbook for this to
work.
Selection
You must have at least one token that represents a character selected for this command to work.
If you have multiple characters selected you cannot specify spells in the options since the
different characters may have different spells.
!shaped-config
Display configuration UI to change default behaviours. The significance of all the options is
detailed [below](#configuration)
!shaped-apply-defaults
Alias !shaped-token-defaults * Apply the same defaults that are used when setting up
tokens on import to whatever tokens are currently selected. Useful for mass-configuring
manually created tokens. See [below](#config-token-settings) for more details on what
these options are.
!shaped-rest
Applies the effects of a long or short rest.
Options
Selection
You must select at least one token that represents a character unless you supply the --id option.
The selected character(s) will have the effects of the specified type of rest applied to them.
Configuration
Advantage Tracker
Output Decides how Advantage Tracker will report changes (whisper the gm, public to
all, or silent)
Show Markers If this is 'on', all tokens for a character will be marked with the specified
markers if they have advantage or disadvantage. Designed for use with the [!shaped-
at](#shaped-at) command
Ignore NPCs If this is 'on', Advantage Tracker will ignore NPCs
Advantage Marker Sets the status marker to be displayed when a character has
Advantage if Show Markers is on
Disadvantage Marker Sets the status marker to be displayed when a character has
Disadvantage if Show Markers is on
Token Defaults
Note that all of the settings under Token Defaults are applied to tokens only when !shaped-
import-monster, !shaped-import-statblock or !shaped-apply-defaults are run.
Numbered Tokens If this is 'on', new tokens will have %%NUMBERED%% appended
to their name to work with Aaron's TokenNameNumbered script. Please search for this
on the API forum for more details.
Show Name Tag If this is 'on', the token will show its name tag to anyone who has
permission to see it
Show Name to Players If this is 'on', and Show Name Tag is also 'on', players will be
able to see the token's name.
Light Radius Default light radius emitted from token (Note that this value will be
overriden by a value derived from a monster's senses attribute where available)
Dim Radius Start of dim light within the above-specified light radius (Note that this
value will be overriden by a value derived from a monster's senses attribute where
available)
Show other players Whether light emitted from the token is visible only to the
controlling player(s) or to all players
Has Sight If 'on' then controlling players will be able to see areas of maps with dynamic
lighting enabled based on the position of this token
Light angle Emitted light will be cast in arc this many degrees wide.
LOS angle the token's vision will be limited to an arc this many degrees wide
Light multiplier The multiplier affects how far the token can see from existing light
sources. This is a good way to simulate a character who has the ability to see further than
normal in low light situations or has an alternate form of vision that might allow them to
navigate in the dark. For example, someone who can see twice as far in low light would
have a multiplier of two.
New Characters
The settings in this section will be applied to new characters when they are created, since the
sheet has no way of storing default options
for new characters.
Apply to all new chars? If this is on, then the settings in this section will be applied to
every new character, otherwise they will only be applied to characters created by the
script using the various import commands, or when !shaped-apply-defaults is run.
Sheet Output Set whether output from the new character sheet should be public or
whispered to the controlling player by default
Death Save Output Same as Sheet Output, but specifically for death saves
Initiative Output Same as Sheet Output, but specifically for Initiative rolls
Show name on Roll Template If 'on', the character's name will be shown on all their
rolls in chat
Roll Options How are d20 rolls handled by default:
o Normal: Roll one die only
o Roll with Advantage: Roll two dice, display the highest value
o Roll with Disadvantage: Roll two dice, display the lowest value
o Roll 2: Roll two dice, display both results
Revert advantage If enabled, (dis)advantage will automatically be reverted back to
rolling normally after the next d20 roll. Useful for the most common case where you get
advantage on a single roll.
Init Roll Same as above, but only applies to Initiative rolls. There is no Roll 2 option in
this case because initiative must have a single value to be sent to the turn tracker
Init to Tracker If 'on', automatically send all initiative rolls to the turn tracker.
Break Init Ties If 'on', the value a character's initiative bonus will be divided by 100 and
added to their initiative roll to break initiative ties (matching rolls mean the character
with the highest bonus goes first)
Show Target AC If 'on', all attacks and spells with a target will require a target to be
clicked and will display the target's AC on the Roll output
Show Target Name If 'on', all attacks and spells with a target will require a target to be
clicked and will display the target's character name on the Roll output
Auto Use Ammo If 'on', new characters will be set to automatically decrement ammo
when launching attacks that are configured with ammo.
Default tab Sets the default tab which will be open when you first go to the new
character sheet.
Default token actions Configures which token actions will be created automatically for
the character. For details of what each of these actions are, please see the documentation
for [!shaped-abilities](#roll-hp-for-monsters). PLEASE NOTE: There is currently a bug
for which we have no sensible resolution that prevents this functionality working for
attacks, actions, spells, reactions, lair actions, legendary actions, regional effects and
traits when using !shaped-import-monster or !shaped-import-statblock. For the time
being the workaround is to run !shaped-apply-defaults after you have run the import and
clicked the "Import" button on the character sheet.
Hiding Settings This submenu configures the default settings for the various "hide"
options from the settings page of the character sheet. These settings are designed for use
with a browser extension to help mask parts of the sheet output (see character sheet
documentation for more details).
Text sizes This submenu configures the default text sizes for the output of various
macros in the character sheet.