symposion / roll20-shaped-scripts

Support script for 5e Shaped Character Sheet on Roll20.net
http://roll20.net/
7 stars 5 forks source link

Build Status

Roll20 Shaped Character Sheet Companion Script

This is a script designed for use with the API on the Roll20 Virtual Table Top. This script is specifically designed to provide services and enhancements for the 5e Shaped Character Sheet by Roll20 user Kryx. It will not work with any other character sheet such as the Roll20 5e OGL character sheet. If you report bugs/ask for help while trying to use the script with a different character sheet you will be ignored with extreme prejudice!

NOTE FOR 1-CLICK USERS: I recommend that you do not install this script via the 1-Click interface. Both the script and the sheet it supports are under very active development with frequent updates. If you install them from the Roll20 sheet list/1-click script page, they will update automatically without asking you when a new version is released. If something goes wrong, this can leave your campaign in a mess just before you're due to start a game session. Even when upgrades go smoothly, you may decide that you don't like changes that have been made and prefer the old version. Unless you install a specific version of the sheet and the script, you will have no control over this process, and downgrades after the fact are hard-to-impossible.

Key features

Setup

Prerequisites:

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 way of importing can be faster and more customisable than dragging from the Compendium, and it's also extensible: you can add extra data files to add more content. The script comes with all the SRD monsters and spells built-in. Creating additional 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 if you search for them. 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,\"patched\":0,\"added\":558}}"

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:

  1. Create/find a token to represent your monster/character, and place it on the tabletop
  2. Open the token settings
  3. Paste your statblock into the GM notes for the token. Make sure that you haven't lost all of the linebreaks - the Roll20 text editor controls can be a bit funny about line-endings. Sometimes I have to paste the text into a text editor first, and then copy it out of there before I paste it into Roll20. It should look roughly like the original you copied it from, minus all the formatting. At this stage you might also want to check that it's not completely garbled, if e.g. it comes from an OCR scan of a print book. The script will fix a lot of mistakes, but it's still only a script - if the text is totally garbled you may need to fix some of the mistakes manually.
  4. When you're done, come out of the token editing and select the token.
  5. Type !shaped-import-statblock into the chat window and hit enter.
  6. You should see a message in the chat window, and end up with a new character in the journal. If you see an error message at this point you may need to fix up some problems with the text of the statblock

Your new monster is now ready for use!

Notes on Statblock Text

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:

Importing Monsters from the Script Database

Manually

  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 database - which by default includes SRD monsters unless you've added additional data files. If you're not sure what names are present in the database, or exactly what spelling is being used, try the Guided approach mentioned immediately below.
  4. You should see a message in the chat window, and end up with a new character in the journal.

Your new monster is now ready for use!

Guided

When you run !shaped-monsters it will output a scrollable list of all of the monsters in the chat window, along with filter buttons to allow you to narrow the list down by things like type, CR, school, class, etc. Clicking a monster on this list will import it into your library. This script comes with all the SRD monsters and spells built in.

Importing Spells from the Script Database

Manually

  1. Select a token that represents a character
  2. Type !shaped-import-spell --Fireball, Cure Wounds into the chat window and hit enter, replacing the spell names with whatever spells you want to import. If you're not sure what spells are available, try the Guided approach mentioned immediately below.
  3. You should see a confirmation message in the chat window

Your new spells are now ready for use!

Guided

Similar to monsters, !shaped-spells will display a list of all available spells in the database, pre-filled with all SRD spells. You need a character token selected, or you need to pass a character id like !shaped-spells --character .

Tracking advantage using the script

  1. Configure your characters with the "Normal" roll option in the character sheet options (see later on for details of how to ensure that this is set automatically for characters imported with the script)
  2. Run !shaped-config from the chat window, click on 'Advantage Tracker' and then set 'Show Markers' to 'on' if it isn't already
  3. During play, when a character should have advantage or disadvantage, select their token and run !shaped-at --advantage from the chat window to give them advantage. Replace --advantage with --disadvantage or --normal for disadvantage/normal respectively.

IMPORTANT NOTE: Advantage/disadvantage is a per-character setting, not per-token. If you have monster characters for which many tokens appear on the map at once (e.g. a horde of goblins), they will all get (dis)advantage at the same time - so don't forget to turn it off when you're finished with the token if it's only supposed to apply to one!

Auto reverting advantage/disadvantage

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

Creating token actions for characters

It can be useful to create token action buttons for your characters to allow quick access to commonly used attacks, spells, actions, etc. For this you need to use the !shaped-abilities command. For example, !shaped-abilities --attacks will create a token action for each attack defined for your character. For full details of all the available options, please see below

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

Roll HP for monsters

You can configure one of your token bars to represent HP by default in the script configuration. If you do this, and enable the 'Roll HP on Drop' option, the script will automatically Roll HP for any character whose default token doesn't have a linked attribute for the specified bar. PCs and important individual NPCs should have their HP bar linked directly to the character sheet in their token setting, since they are individuals with a single HP value. Generic monsters ('mooks') should not have their HP bar linked to a character sheet attribute, however, since there can be several individuals all sharing a single character sheet. For these monsters, the script will automatically roll HP and apply it to a new token whenever you drag the character from the journal onto the table top. If you would prefer to have a static HP value for your mooks, you should disable this feature in the script configuration and set the HP value for the token manually before setting it as the default token for your character.

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.

Decrement uses

If enabled in the configuration (see below), the script will automatically decrement the number of uses remaining for traits, actions, attacks, features, etc each time they are used. It will also issue a warning if something is used when no uses remain.

Short/Long rest

The script will apply the effects of a short/long rest if you run the command !shaped-rest --type long or !shaped-rest --type 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 Settings page for "Show Rests".

Full command list

!shaped-import-statblock

Imports details from a text statblock into a Roll20 character. The statblock must be inserted into the GM notes field of a token (not a character!) and the token must be selected before running this command. The imported character will be configured with the default settings that you specify in the default character settings configuration . In addition the tokens you use will be configured according to the default token settings configuration ready to be set as the default token for the character.

Options

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

!shaped-monsters

!shaped-monster

Options

Selection

You may no or 1 tokens selected when running this command:

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-by-token

This basically does the same thing as !shaped-import-monster, except that instead of passing it a list of monsters as parameters to the chat command, it infers the names of the monster to import from the names of the selected tokens. This is a quick way to configure and import a whole bunch of monsters all at once. Find the tokens you want for all your monster and drag them to the tabletop; name the tokens according to the monsters they represent, select them all, and run this command. It will find monsters by name from your custom JSON database, and configure each token to represent the new characters it creates.

Options

Selection

You must have at least one token selected for this command. As described above, it will use the name assigned to each token to lookup the monster it will represent from your JSON database.

!shaped-spell

Options

Selection

You must have exactly one token that represents a character selected when running this command.

!shaped-spells

Options

Selection

You can have up to 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

!shaped-apply-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 for more details on what these options are.

Selection

You must have at least one token that represents a character selected for this command to work.

!shaped-rest

Applies the effects of a long or short rest, or a turn recharge

Options

Selection

You must select at least one token that represents a character unless you supply the --character option. The selected character(s) will have the effects of the specified type of rest applied to them.

!shaped-update-character

Triggers any pending character sheet upgrades for the selected characters. When a new version of the character sheet is released, there are often upgrade scripts that must run before previously created characters can be used with it. Normally these are run the first time you open each character sheet. For convenience, you can use this command to trigger these updates on batches of characters without having to open their sheets.

Options

!shaped-expand-spells

When you drag characters from the SRD/Compendium, they are imported with a spell list, but none of the spells have any content. This command will expand these "stub spells" using data from a custom spells database, if one is present.

Selection

You must select at least one token that represents a character. The selected character(s) will be checked for empty spells and these will be expanded from the custom JSON database.

Selection

Unless you specify --all you must have at least one token that represents a character selected for this command to work.

!shaped-remove-spell

Removes spells from the selected character.

Options

Selection

You must select exactly one token which represents a character.

Configuration

Advantage Tracker

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.

Token Defaults/Token Bar Options

Token Defaults/Token Aura Options

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.

New Characters/Houserule Settings

New Characters/Houserule Settings/Saving Throws

Character Sheet Enhancements

Houserules & Variants