
Encounter Helper
Development GIST: https://gist.github.com/kjaegers/0885fa7d308fdb4b4f82bb4471b96487
YouTube Demonstration: https://youtu.be/tPdyRIcpeVY
Updates
Version 1.1.10 (2020-09-24)
- New button to rename existing encounters. This will pop up a roll query prompt asking for the new name. It will check to see if the new name conflicts with another encounter before performing the rename. Saved data about the tokens in the encounter is preserved across the rename.
- Includes code to facilitate User Options from OneClick install for eventual inclusion there.
Version 1.0.9 (2020-08-21)
- Extensions to the reset functionality. You can now update an encounter (!eh update_reset_info <encountername>) to store or replace its reset data. You can also run a command to update every encounter's (on the page) reset data or reset every encounter on the page.
- Did some localization cleanup... it is far from complete, but should mostly just effect some instance of seeing "Encounter Helper" as the entity sending chat info instead of the localized version. Actual text should be localized almost everywhere.
Version 1.0.8 (2020-08-20)
- Added the ability to reset encounters to a saved state. The state of several (definable) attributes gets stored when the encounter is created, and running "!eh reset <encountername>" will restore those values. Defaults are position, size, bar3 val/max, and status markers. Thanks to MykeMyke for the feature suggestion.
- Corrected a bad column header in the encounter display table. Thanks to Erik M. for pointing out the issue.
Version 1.0.7 (2020-07-27)
- Added localization with four languages (english, french, spanish, and german) based on google translate. There are probably better translations if anyone wants to make suggestions :) To set a language, look for "APILANGUAGE" near the top of the script after the comments section and change the assigned value to one of the available languages.
Version 1.0.6 (2020-07-27)
- Added a configuration menu : !eh configmenu There is currently only one configuration option that lets you toggle on/off rolling for characters if you execute a GroupInitiative call. Note that I can't find a way in Group-Initiative to have it ignore selected tokens, so if you have something selected it will roll that token's initiative regardless of this setting.
- The background for storing and retrieving configuration items - this is internal stuff, but I hope to use what I develop for EncounterHelper for other API scripts in the future.
- The very basic beginnings of support for localization. This is fairly experimental, but right now I have an APILANGUAGE constant at the beginning of the script. I've translated (via our good friend Google Translate) a few phrases used in Encounter Helper into French to try out the system. Most notably configuration options and the output of "!eh create ..." This appears to be working how I intended it, so my next goal is to replace all of the output text in the script with localizable replacement strings.
Version 1.0.5 (2020-07-26)
- Added a block near the top of the code to allow customization of the appearance of the tables an buttons output by Encounter Helper. If you come up with something that looks nice, please post your CSS so I can replace mine... I'm not a UI designer by any means.
- Similarly, you can set the text that is displayed on the buttons. Right now, they default to "S", "H", "D" and an emoji red X.
- Expanded GroupInitiative integration slightly... If GroupInitiative is installed, the encounter list will now include a button (defaults to look like a D6) to roll initiative for the tokens in the encounter (so you don't have to show the encounter to roll initiative for the critters).
Version 1.0.4 (2020-07-23)
- If you have GroupInitiative installed, when you Show and encounter you will get a button to run GroupInitiative on the tokens from that encounter.
Version 1.0.3 (2020-07-23)
- Prevent non-GMs from running !em commands. They wouldn't see anything anyway, but now they can't do it at all.
Version 1.0.2 (2020-07-23)
- Reworked the way the page/token system is handled. Now, when you want to have encounters on a page, create a token on that page named "Encounter Token" (you can rename your existing tokens - nothing in the way encounters are stored has changed). The new command "!eh pagelist" will display a list of all pages with "Encounter Token" tokens on them, and from there you can activate a page. This removes the tie to page names, and the reliance on the player ribbon. Additinally, parenthesis are now supported in encounter names (the chat server was considering parens as the end of the button command link). The encounter list (!eh l) now lists the active page at the top of the table as a reminder.
Version 1.0.1 (2020-07-23)
- As suggested by GiGs, added a means to redefine the columns shown on the "D" table to support any game/sheet.
Introduction
I've been prepping for a new campaign, and while setting up encounters on my pages I thought it would be nice to have a system where I could mass move tokens between layers without switching back and forth, etc. That was the genesis of this new script.
With Encounter Helper, you can define groups of tokens (Encounters) that you can easily move between layers. There are a few other handy options as well. Check the YouTube video above for a demonstration, but here are the particulars:
Requirements
On any page you want to define encounters, you'll need to create a token and give it a very specific name. That name is "Encounter Token" (case sensitive). Encounters for each page will be stored using the notes field on this token. It can be hidden on the GM layer, etc. Graphic and size are not important.
Once in Roll20, enter the command "!eh pagelist" to list all pages with "Encounter Token" tokens on them and select a page to become active. All Encounter Helper work will now be done on the active page. Run !eh pagelist again to select a different page.
Finally, the details/display function will display a table of all of the tokens in the encounter. By default it displays the value of Bar 3 (cur/max) and the npc_ac attribute, but these are customizable by editing the "const columns" line near the top of the script (after the comments) so it can support any game/sheet.
Commands
Encounter Helper only has one defined command (!eh) but that command has several options. They are:
!eh list
Probably the command you will use most often. I created a macro bar button for this command because I use it all the time. It displays a list of all of the encounters on the page with buttons to manipulate them.
The buttons associated with the list are:
S - Show the encounter. Move all of the tokens to the Token layer
H - Hide the encounter. Move all of the tokens to the GM layer.
D - Details/Display. Show all of the tokens associated with the encounter and some stats about them.
X - Delete the encounter. Does not impact the tokens. Only removes the encounter from the encounter list.
All of the buttons above are simply API calls to !eh and its other operations.
!eh create <encounter name>
Highlight a group of tokens and use the create operation to define and encounter. The name is case sensitive, but since most of the time you will be using the output of !eh list to manipulate encounters, you will almost never have to type it again. Tip: I usually name my encounters starting with a room number, as they are output in the list in alphabetical order, so this makes encounters associated with rooms easy to find.
The rest of the commands can be typed into the chat window, but it is usually much easier to access them via the !eh list buttons. The remaining commands are listed below.
!eh pagelist
Shows a list of pages that have "Encounter Tokens" tokens on them and allows you to activate the page you want to work on. All further activity will be relative to that page unless you activate a different page.
!eh show <encounter name>
This is the command run by the "S" button from the list.
!eh hide <encounter name>
This is the command run by the "H" button from the list.
!eh display <encounter name>
This is the command run by the "D" button from the list. The output looks something like this:
!eh remove <encounter name>
This is command run by the "X" button from the list.
Notes
Feedback, bug reports, or suggestions for improvement are welcome.