
>>> Rough Video showing some of the things you can do with Reporter. <<<
There is an older version of this script on the forums, but since that thread has closed, and this is now available for One Click installation, I am creating a new thread. There are many new features since its original release.
Reporter
Reporter reads the tokens on the board that are associated with character sheets and builds a report of them in the chat or to a handout, returning selected values from the token settings or the character sheets they are associated with.
Reporter has specific support for the D&D 5th Edition by Roll20, D&D5E Shaped, Pathfinder First Edition by Roll20, and Pathfinder Second Edition by Roll20 sheet. There is an option to choose Other for the sheet, which will disable the few sheet-specific shortcuts. It should work with most any sheet or no sheet at all. The first time you run the script, it will ask you to choose which sheet you are using. You can change this behavior with !report --config|sheet
Reporter contains special features that work well with other scripts, specifically, Tokenmod, ChatSetAttr, Supernotes and Token Action Maker. These are detailed below as appropriate. All items marked in [brackets] are optional. The constructed macro can become quite large, but there are many built-in macros in the menu button (!report --menu) to get you started.
You can either select a set of tokens to work with, or if you select no tokens, it will assume all tokens on the Object/Token layer. This behavior can be altered using keywords, described below. The basic syntax is:
Basic Syntax
!report[filters] --[queries] ---[buttonline] ----[keywords]
filters will search the token set and only return those which meet a specific set of criteria. Filters contain an operator, source, attribute, and value
queries are the part of the macro that decides which information is returned about the character/token pairs. Queries can contain optional dividers and aliases.
buttonline is a string containing text and Ability or API Command buttons.
keywords are options that change the overall appearance or scope of the report.
Each of these is documented below
Filters
Filters have changed since pre-release. Please check any previous macros. This was changed to make parsing possible for running multiple filters on the same report.
By default, Reporter uses the selected tokens to run a query, or if no tokens are selected, all tokens on the token/objects layer.
You may wish to constrain a report to only tokens which match a specific set of criteria. For example, you might have 50 tokens on the table, but only 10 of them are goblins, and you only want to work with the goblins. Or you want to find all the characters who are both PCs and have darkvision. You can add filters after the !report command. The filter is written using a similar syntax to a query, followed by the filter term. In essence, it is querying each token for a match. The syntax is:
!report||operator|source|attribute|value
You can add more filters just by adding double pipes to the end of the first filter and typing another.
There are four types of operator.
+ only includes the token/character pairs that matches the query
- excludes any token/character pair that exactly matches the query
~ only includes any character that is a partial match for the query
^ excludes any character that is a partial match for the query
thus:
!report||-|c|name|Goblin will return all tokens that are not represented by the Goblin character sheet.
!report||~|c|name|Goblin will return any tokens that are represented by the Goblin or Hobgoblin character sheet.
!report||-|c|npc|1||+|t|has_night_vision|true will exclude all NPCs (leaving only PCs), and then only return those that have nightvision set.
Filters do not support an alias (see below), because they are never displayed in the final report.
Filters are executed sequentially, with each filter working on the result from the last, so some logic is required for best results.
Filters are case insensitive.
There is as yet, no way to test for an empty, or undefined value.
Queries
Queries are the part of the macro that decides which information is returned about the character/token pairs. Queries are constructed using
t|attribute to poll a token attribute
c|attribute to poll a character sheet attribute
Queries are separated by a space
Examples
!report --t|name would return a report of all selected token names
!report --c|strength would return a report of all strength values on the character sheets of the selected tokens
!report --c|strength c|dexterity would return a report of all strength and dexterity values on the character sheets of the selected tokens
For character sheets, the script will try to pull a value from the character journal first, and if that does not exist, the installed character sheet. At this point in time, Reporter cannot return information that requires a callback, such as the GMNotes field. There are some built-in tools to access the Supernotes script if you have that installed.
Dividers
You may not always want each attribute reported on its own line. You can add a code after the attribute name(not the alias) to use something either than a line return between attributes
comma (,) Adds three non-breaking spaces between this attribute and the next, keeping them on the same line when possible.
period (.) Adds a vertical pipe between this attribute and the next, keeping them on the same line when possible.
dash (-) Adds a thin gray horizontal rule between this attribute and the next.
Hashtag (#) Adds a bit of horizontal space between this attribute and the next.
Examples:
!report --t|emits_low_light|Low-Light t|low_light_distance|Distance ---light
will return this:
but with the addition of a comma after the emits_low_light attribute:
!report --t|emits_low_light,|Low-Light t|low_light_distance|Distance ---light
it will return this:
Aliases
There are times in the report when you would not like 'has_bright_light_vision' in the report. You can substitute an alias for the attribute name that will display in chat. For this, just add another pipe after the query and type an alias.
For example, if a token has 60 feet of Night Vision:
t|night_vision_distance
might produce:
T: night_vision_distance = 60
but
t|night_vision_distance|NV
would yield:
T: NV= 60
If you use a hyphen (-) as the alias, it will display no label at all. You can turn on or off the graphic for the source (token or character) with source keyword described below.
Buttonline
The buttonline is a string containing text and Ability or API Command buttons. These are formed using the normal syntax for buttons: [button name](command) with a few exceptions. In order to keep the Roll20 parser from resolving queries and attribute calls before the script gets them, they need to be written slightly differently.
Examples:
@{token|name} is written as A{token|name}
?{question|default_answer} is written as Q{question|default_answer}
Further, for a handful of scripts, the Reporter API will attempt to parse the code so that each buttonline refers to the specific token being reported on. In this way, each buttonline can have a set of controls that apply to that specific token, without needing it to be selected. Currently Token Mod, ChatSetAttr and Supernotes are supported. It does this by injection the token id into the script calls for those scripts. Because of this, do not use --ids in a token-mod call, ChatSetAttr call, or --id in a Supernotes call.
Special Codes for Queries and Buttonlines
Reporter contains a few special codes for common cases, to make macro writing easier. You can put these in place of normal commands:
--vision as the Query will replace any declared query line with one designed to report most vision situations. It will give values for whether the token has sight, night vision and what the distance of any night vision is.
---vision as the Buttonline will replace any declared button line with a buttonline designed to handle most cases of vision and darkvision.
--light as the Query will replace any declared query line with one designed to report most lighting situations. It will give values for the amount of light, distance and what type.
---light as the Buttonline will replace any declared button line with a buttonline designed to handle most cases of lighting.
---actions as the Buttonline will replace any declared button line with a buttonline made up of the token action buttons associate with the character. This is designed for synergy with the Token Action Maker script, but is not essential. Not that the token actions created by this command cannot contain roll templates and will not convert the selected|commandname structure. this requires very careful parsing and is best avoided. It should work flawlessly with Token Action Maker commands, with the exception of the "Check" and "Save" buttons, for the reasons just mentioned.
Keywords
Keywords are options that change the overall appearance or scope of the report. They are separated from the rest of the report by four dashes and must come at the end of the macro.
layer|[gmlayer|objects|map|walls|tracker|all] will constrain the report to a particular layer or all layers at once, so long as no tokens are selected. If any tokens are selected, Reporter will default to the layer the selected tokens are on. This makes it easier for instance to check the vision settings of tokens on the token layer and the gmlayer simultaneously, or to ping pull to note tokens on the gm layer without switching manually to that layer.
If the layer keyword layer|all is used the report will be on all token/character pairs on all layers. In this case, a layer character will appear on each subhead line of the report to let you know which layer the token is on.
If the layer keyword layer|tracker is used the report will be on all token/character pairs on the Turn Tracker as if it were a layer. In this case, a layer character will appear on each subhead line of the report to let you know which layer the token is on. If you click on the layer token, it will switch the token from the GM/Notes layer to the Token/Objects layer and back.
compact|[true|false] (default=false): The compact mode shows the token image at half size, and eliminates the second line of the report subhead, since it is not always desired. You may have a very large report you want to see better, or you may be using a sheet that does not support the default values. Currently the second line of the subhead only references the D&D 5th Edition by Roll20 sheet and the Pathfinder 2 by Roll20 sheet.
showheader|[true|false] (default=true): This will control whether the header will display at the top of the report.
showfooter|[true|false] (default=true): This will control whether the footer will display at the bottom of the report.
showpageinfo[true|false] (default=false): this will include extra page information in header and/or footer, including some basic dynamic lighting controls for the page.
printbutton|[true|false] (default=false): This will control whether the print button will display on each line of the report.
visibility|[gm|whisper|all] (default=gm): This will determine how the report is presented. "gm" is whispered to the gm, "whisper" is whispered to the user who sent the command, "all" is posted openly for all to see.
Note Buttons This is a group of keywords that will place a button on the name line of the report for calling up various Supernotes commands. The visibility of the notes button is controlled by the visibility keyword. If the visibility is "gm", it will use a !gmnote command, if the If the visibility is "whisper", it will use a !selftnote command, and if the visibility is "all", it will use a !pcnote command. If the report is in the Chat tab, the notes will display in the chat tab, and if the report is set to be in a handout, the notes will in the handout, directly below the report. This can be used to create a handout that can run a report and display notes below. An example use could be a handout that can read map keys and display the notes for each map key, making an interactive dungeon map.
- tokennotesbutton|[true|false] (default=false): If this keyword is set to true, the report will place a small shortcut button to return the contents of the reported tokens GM Notes field.
- charnotesbutton|[true|false] (default=false): If this keyword is set to true, the report will place a small shortcut button to return the contents of the GM Notes field of the character assigned to the reported token.
- biobutton|[true|false] (default=false): If this keyword is set to true, the report will place a small shortcut button to return the contents of the Bio Notes field of the character assigned to the reported token.
- avatarbutton|[true|false] (default=false): If this keyword is set to true, the report will place a small shortcut button to return the Avatar of the character assigned to the reported token.
- tooltipbutton|[true|false] (default=false): If this keyword is set to true, the report will place a small shortcut button to return contents of the reported tokens Tooltips field.
- imagebutton|[true|false] (default=false): If this keyword is set to true, the report will place a small shortcut button to return images from the Bio field of the character assigned to the reported token.
source|[true|false] (default=true): if source is set to false, the C and T characters that show whether an attribute comes from the token or the sheet will not be displayed. Set this keyword to false if they are a distraction.
charactersheetlink|[true|false] (default=true): if this keyword is set to false, the link to open the token's corresponding character sheet will not display
charactersheetbutton[true|false] (default=false): if this keyword is set to true, the link to open the token's corresponding character sheet will be shown as a link graphic, and will not display the full name. If charactersheetlink is set to false, this command will do nothing.
subtitle|[true|false] (default=true): if this keyword is set to false, the line directly below the character name will not display. (This is also the default in Compact mode). This may be desirable if not using the D&D 5th Edition by Roll20 or Pathfinder 2 by Roll20 sheets.
ignoreselected|[true|false] (default=false): if this keyword is set to true, the search will not be preset to whichever tokens are selected. The report will run as if no tokens were selected, following whatever layer criteria might have been specified. See layer keyword above.
npcsubstitutions[true|false] (default=true): if this keyword is set to false, the script will not automatically substitute npc attributes for their PC counterparts (ex: npc_senses for passive_wisdom). Many sheets use a different attribute names for an NPC as opposed to a PC. Reporter know the most common pairs and will attempt to substitute when possible. Setting this to false may be needed for sheets that are not the D&D 5th Edition by Roll20 or Pathfinder 2 by Roll20 sheets.
sort|attribute (default is the raw order): This keyword will sort the final list. Most of the sorts are confined to the token attributes, since they require internal code and if they refer to a sheet may return poor or no results if the sheet does not have the proper attributes. Currently the following values can be sorted on:
charName: character name. Sheet must have a "name" attribute.
charNameI: character name, inverse order. Sheet must have a "name" attribute.
tokenName: token name
tokenNameI: token name, inverse order.
bar1: token bar1 value
bar1I: token bar1 value, inverse order.
bar2: token bar2 value
bar2I: token bar2 value, inverse order.
bar3: token bar3 value
bar3I: token bar3 value, inverse order.
cr - Challenge Rating. D&D 5th Edition by Roll20 Sheet only
crI - Challenge Rating, inverse order. D&D 5th Edition by Roll20 Sheet only
title|Title| If this is present in the keywords, the string in between pipes will be placed at the top of the report. If you only want the custom title to display, be sure turn off the header with showheader|false. The title must be placed between two pipes. title|My Title| will work. title|My Title will break.
handout|Handoutname| If this is present in the keywords, the report will be sent to a handout instead of chat. This can allow a report to remain usable without scrolling through the chat. It can also be used as a sort of floating palette. Reports in handouts can be updated. Running the macro again will regenerate the table, as will pressing the Repeat button. The string in between pipes will be used as the name of the report handout. If no handout by that name exists, Reporter will create one and post a link in chat to open it. The title must be placed between two pipes. handout|My Handout| will work. handout|My Handout will break.
A report Handout automatically creates a horizontal rule at the top of the handout. Anything typed manually above that rule will be persistent. Reporter will not overwrite it. You can use this area to create Journal Command Buttons to generate new reports or to give some context to the existing report. All updates are live.
Examples:
!report ---- layer|gmlayer compact|true
will report on all the tokens on the gm layer in compact mode.
!report ---- layer|tracker compact|true title|Tracker Navigator| showheader|false showfooter|false
will produce a compact report that will allow you to navigate around the tracker tokens on the board, with links to ping pull, switch layers, open character sheets and more.
Clicking on the GM layer character on Sadroth's line will move the token from the GM layer to the Token layer.
A more full featured Turn Tracker could include more info and macros:
!report --c|strength,|Str c|strength,|Dex c|strength|Con c|strength,|Int c|strength,|Wis c|strength#|Cha t|bar1_value,|HP c|npc_ac|AC c|npc_senses|perception t|statusmarkers|Condition ---[Apply Damage](!token-mod --set bar1_value|Q{Enter damage amount. Use positive or negative to modify values|-0}) | [Apply Condition](!token-mod --set statusmarkers|Q{Choose Status|Dead,dead|Bloodied,red}) ----layer|tracker compact|true title|Tracker Display| showheader|false showfooter|false source|false
How to Read a Report
Header. The header of the report will list the range of tokens being reported, by name, followed by the count.
Report Line. The report line of each item will show an image of the token, followed by its token name and the associated character sheet name. If the character sheet is a renamed NPC statblock. ex. If Captain Hero is using the Veteran sheet, it will note this. It will also not if any of the characters have the PC flag.
The second line of the report will display the creature type for NPCs or the class and level for PCs. The second line is available for the D&D 5th Edition by Roll20 and Pathfinder 2 by Roll20 sheets only. and will probably return undefined on other sheets.
Click on:
Token image - Ping pull all players to the token's location.
Token Name - Ping pull only GM to the token's location. Invisible to players.
Character Name - Opens the associated character sheet.
Then follows a list of the attributes being requested.
Tindicates a token attribute.
Cindicates a character attribute.
The display of the source character can be turned off with the keyword source|false.
Button Line. This is the list of commands that can be performed on each token. If it is a command using Tokenmod, ChatSetAttr or Supernotes, it will be specific to that token. Refer to Button Line documentation above for details.
Special Buttons. There are a few buttons that appear in the report, at various places on the right side.
☰ will call up the report script menu
⟲ will repeat the command that created the report, in case you want to confirm that changes were made.
w will echo to the chat whatever is on that line: Token name on a report line, or Page name on the page line of the header.
One-line codes
The following are special codes that expand behind the scenes into full-featured macros, and handle some of the more common uses for Reporter. They are available through the menu button, or you can copy the code as displayed into any macro. Many of them require the synergy scripts mentioned at the top for some of their utility. One-line codes cannot receive extra keywords, they are built-in.
- !report --vision ---vision - Use this command to check the vision of selected tokens. If you have no selected tokens, it will return a report of all tokens on the Token/Objects layer.
- !report|vision - Shorthand for the above command. --vision and ---vision are special keywords that can be used as substitutes in any reporter macro.
- !report --light ---light - Use this command to check the lighting of selected tokens. If you have no selected tokens, it will return a report of all tokens on the Token/Objects layer.
- !report --light ---lightplus - A more detailed version of the above, with most common light sources.
- !report|light - Shorthand for the above command. --light, ---light and ---lightplus are special keywords that can be used as substitutes in any reporter macro.
- !report|help - Use this command display the documentation for the Reporter script. Also accepts !report --help
- !report|mapkeys - Use this command to display a list of all objects on the gm layer that represent a character called Map Key You can use this to navigate around a map quickly and call up any token notes that might be placed in the Map Key tokens.
- !report|mapkeys_sorted - As above, but sorted alphabetically.
- !report|pcs-detail - A detailed display of all PCs on the map.
- !report|pcs - A compact display of all PCs on the map.
- !report|npcs-detail - A compact display of all PCs on the map.
- !report|npcs-actions - A detailed display of all PCs on the map with most token action buttons displayed. Works very well with the Token Action Maker script.
- !report|tracker - A compact display of all characters in the Turn Tracker.
- !report|tracker-actions - A display of all characters in the Turn Tracker with most token action buttons displayed.
- !report|report - How to read the report. Also accepts !report --report
"That's all great Keith, but what can I use this for?"
I originally wrote this to be a tool to check lighting and vision for each token on each page in a module. The ability to grab a set or subset of tokens, filtered by criteria and then perform actions on those tokens has a huge number of uses. The One-Line Codes above are some of the most common.
Where's the code?
Reporter is available for One Click installation on your game's API page.