Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script] EncounterHelper

Isolated strange behaviour - you need to move one of the tokens first and then you can click as normal...
Feature request: Ability to rename encounters from menu
1600284491
Kurt J.
Pro
API Scripter
MykeMyke said: Feature request: Ability to rename encounters from menu I'll work on getting this in there. I'm way behind on a PowerCards video, so I'll need to finish that first, but this should be pretty straightforward.
MykeMyke said: Feature request: Ability to rename encounters from menu Yes, seconding this request!
1600977650
Kurt J.
Pro
API Scripter
Jay R. said: MykeMyke said: Feature request: Ability to rename encounters from menu Yes, seconding this request! Version 1.0.10 is up on the Development GIST Renaming is in! :) Version 1.0.10 on the GIST now has a button that looks like a blue nametag on the list. Clicking the button will prompt you for a new name for the encounter. Due to the way the parameters are passed, encounters that contain a "|" (vertical pipe) won't work with the rename feature. It should be an uncommon enough character that it isn't widely used anyway. Renaming can also be done via the chat line: !eh rename <existing encounter name>|<new encounter name> for example: !eh rename Rhino|Monkey would change Rhino to Monkey.Saved values are preserved across the rename. This version also includes the first steps in preparing to bring EncounterHelper to OneClick. I've never done OneClick settings before, so this should be interesting :)
Whoo, thanks, Kurt! Gonna grab the latest build tonight and check it out.
1601335375
Kurt J.
Pro
API Scripter
I've submitted a pull request to add EncounterHelper to OneClick. This will be the first time I've used the OneClick configuration options (at the moment, the only option I've added is to set the API Language), so that may or may not work in the first OneClick verison :) The request hasn't yet been merged, so it is unlikely to happen on tomorrow's update, so possibly next week.
It's on OneClick now. Congrats! I had just written a much simpler script to do the same thing, then found yours. Thanks for saving me work! Speaking of work, your script has this: const buttonText = {         show: "S",         hide: "H",         display: "D",         remove: "❌",         rollinit: "🎲",         groupinit: "Group-Init",         resetbutton: "🛠",         renamebutton: "🎫"     }; In Roll20 it displays like this: Everything works fine so far, though.
1601746628
Kurt J.
Pro
API Scripter
Mike S. said: It's on OneClick now. Congrats! I had just written a much simpler script to do the same thing, then found yours. Thanks for saving me work! Speaking of work, your script has this: const buttonText = {         show: "S",         hide: "H",         display: "D",         remove: "❌",         rollinit: "🎲",         groupinit: "Group-Init",         resetbutton: "🛠",         renamebutton: "🎫"     }; In Roll20 it displays like this: Everything works fine so far, though. Yea, it is strange... If you "import" the script the emojis come over properly, but just activating it from OneClick breaks them. It looks like using the Windows 10 "windows-key + ." to type the emoji's directly was not the best idea :) I've already submitted a pull request to fix this, after changing the code to use html emoji values instead. Should be up on OneClick around Tuesday.
1602003950
Kurt J.
Pro
API Scripter
Hot tip. Apparently it helps to hit the SAVE button in Notepad++ after making changes to code :( The reformatted description is live for OneClick, but the emoji changes were... um... overlooked. I just saved the file and opened a new pull request. The script can be installed from the Dev GIST until next week's OneClick update.
1602245469
David M.
Pro
API Scripter
This script is really slick. Thanks for sharing, Kurt!
1602717292
Kurt J.
Pro
API Scripter
The emoji display issues are fixed on OneClick as of today :) And I just did a run-through of each of the languages and didn't run into display issues there either (though some of the extended characters don't show up with the accents on them - that might be the font used by the output, so I'll look into that). There is one minor display issue if you have GroupInit installed in that the encounter list's header and footer rows don't cover the last icon - I need to change the colspan value, but it doesn't impact functionality.
That looks much better! Thanks! I'll be putting it through it's paces tomorrow.
Installed the latest version last night. It looks great and runs smoothly. A couple of feature requests for future versions: The ability to set HP/AC values from within the script, in the config menu, rather than having to manually change bar3 to bar1 in the code after import. An option to display token name rather than character name (or perhaps alongside it, with character name in parentheses?). Right now, if you add four hellhounds to an encounter but their token names are creatures 2, 7, 9, and 14, it will just say hellhounds in the EH output, which doesn't help me differentiate them (and also doesn't match user expectation, since the heading currently says "token name" rather than "character name"). It would be great if running the show encounter details command gave you "Creature 45 (Hellhound), Creature 21 (White Dragon)", and so on.
1603486084
Kurt J.
Pro
API Scripter
Jay R. said: Installed the latest version last night. It looks great and runs smoothly. A couple of feature requests for future versions: The ability to set HP/AC values from within the script, in the config menu, rather than having to manually change bar3 to bar1 in the code after import. An option to display token name rather than character name (or perhaps alongside it, with character name in parentheses?). Right now, if you add four hellhounds to an encounter but their token names are creatures 2, 7, 9, and 14, it will just say hellhounds in the EH output, which doesn't help me differentiate them (and also doesn't match user expectation, since the heading currently says "token name" rather than "character name"). It would be great if running the show encounter details command gave you "Creature 45 (Hellhound), Creature 21 (White Dragon)", and so on. Version 1.0.12a is now up on the  Development GIST  and includes these features: The !eh configmenu contains four new options:    Show Button Help in Encounter List : If ON, an additional row with explanations for each of the buttons in the encounter list will be displayed. Off by default. Override OneClick Settings : If ON, the two options below will override any script-set or OneClick config values. List Columns : Allows you to show or set the value of the "columns" setting Saved Values for Reset : Allows you to show or set the value of the "resetValues" setting (normal caveat - exiting tokens WON'T be updated. you would need to run the page-wide function to update reset information). When this version goes to OneClick, there SHOULD be support for setting Columns and ResetValues by the OneClick page (fingers crossed that I don't mess it up :))  Columns and ResetValues configurations can now be set via the config menu (see above). Right now, you need to type the entire string in the supported format (which is a little different than what it was when editing the code). The default columns string is "bar|HP|3;attr|AC|npc_ac", and the default resetValues string is "left;top;width;height;bar3_value;bar3_max;statusmarkers". NOTE: With this change, editing columns or resetvalues in the script code is no longer effective/supported. I plan on coming up with a more user-friendly way of editing the column list and the reset values list, but that will take some additional development time. If a token and the character it represents have different names, the name will be listed in the encounter list as "TokenName (Character Name)". If the two names match, it will simply be listed once. Ex: "Ghoul Priest (Ghoul)" will be displayed for a renamed Ghoul, but "Ghoul (Ghoul)" will not be displayed for a Ghoul simply dragged from the character list. Cleaned up some potential bugs related to config settings that aren't set yet. They should be assigned their default values if the script tries to read them and they don't exist in the State variable yet. Special note: If you set Columns and Resetvalues via the config menu, you must turn on Override OneClick Settings (even if the script isn't on OneClick or not used via OneClick) for the config values for these items to be used. Otherwise they will use the default in the code.
Holy crap, Kurt, thank you! :) Can't wait to try this out.
Just tried v1.12a and it works perfectly! Thanks so much, Kurt. This script has provided a huge quality-of-life improvement to my Roll20 experience.
Ooooh - hadn't seen the 1-click! Bug Report (v1.0.9) - EH crashes if drawn object selected along with tokens. Consistently produces the following:
1603557838
Kurt J.
Pro
API Scripter
MykeMyke said: Ooooh - hadn't seen the 1-click! Bug Report (v1.0.9) - EH crashes if drawn object selected along with tokens. Consistently produces the following: Looking for opinions on desired functionality here... Would you rather: Selected graphics (non-token) objects are simply ignored by the script (makes draging to select multiple tokens easier) Selected graphics (non-token) objects are included in the encounter for hide/show/display/reset purposes I think either way is possible - and I'm open to other suggestions as well.
Kurt J. said: MykeMyke said: Ooooh - hadn't seen the 1-click! Bug Report (v1.0.9) - EH crashes if drawn object selected along with tokens. Consistently produces the following: Looking for opinions on desired functionality here... Would you rather: Selected graphics (non-token) objects are simply ignored by the script (makes draging to select multiple tokens easier) Selected graphics (non-token) objects are included in the encounter for hide/show/display/reset purposes I think either way is possible - and I'm open to other suggestions as well. My first thought is that option 1 is better because it improves quality of life (dragging to select multiple tokens gets easier) and I can't think of a case when someone would want a drawn object to be in the encounter (why would you need this object to be in initiative if it's not a token?). But that's just me. If you do decide to go with option 2, maybe make it something you can choose to turn on or off in EncounterHelper, via the config menu? Just a thought.
Looking for opinions on desired functionality here... Would you rather: Selected graphics (non-token) objects are simply ignored by the script (makes draging to select multiple tokens easier) Selected graphics (non-token) objects are included in the encounter for hide/show/display/reset purposes I think either way is possible - and I'm open to other suggestions as well. I'd like option 2. This allows me to set up drawn spell effects, spell or weather graphics that aren't tokens, walls that were previously unseen, and the like. A config setting for this is a good idea.
Mike S. said: I'd like option 2. This allows me to set up drawn spell effects, spell or weather graphics that aren't tokens, walls that were previously unseen, and the like. A config setting for this is a good idea. +1. If I didn't use the functionality then I wouldn't have found the bug :-D Thanks as ever for continuously improving a fantastic script!
Bug Report (v1.0.9 and v1.0.12, not checked OneClick) - Encounters generate with correct number of tokens in confirmation post, but all actions only affect a single token from the encounter.
MykeMyke said: Bug Report (v1.0.9 and v1.0.12, not checked OneClick) - Encounters generate with correct number of tokens in confirmation post, but all actions only affect a single token from the encounter. Interesting. Can you give the specific case? I had no issues at all with 1.0.12a last night. Whenever I clicked the dice, all tokens in the group went into initiative.
1603587309
GiGs
Pro
Sheet Author
API Scripter
I would prefer to have non-tokens ignored. But I think an even better solution would be a config setting that allows you to choose on a encounter by encounter basis whether to ignore non-tokens. You could even have 3 settings: ignore non-tokens ignore tokens (for when wanting to set up purely layout and decorative things)  do not ignore anything.
1603637076

Edited 1603637104
Kurt J.
Pro
API Scripter
Ok, version 1.0.12b is up on the development GIST (I know the 1.0.12a was reporting that it was 1.0.13, but that isn't the case :)) - New configuration toggle : "Include Drawings". Off by default. If turned On, it will include Path type objects in the encounter if they are selected when the encounter is created. - Updated the encounter creation and reset code to allow for Path objects as well as tokens (Hide/Show didn't require changes). - Updated reset code to test to see if an object has  a given parameter from ResetValues before trying to set it. This might prevent some wonkyness with the Roll20 UI getting confused. - Updated the Display code to report path objects as "Drawing/Path" with no column information. There aren't names assigned to paths, so there isn't really a way to identify them (I suppose I could include the object ID, but that probably wouldn't be very useful - Let me know if anyone feels otherwise, as its a simple change). I noticed Roll20 gets weird about multi-selecting path objects after they are moved by the API. You can still drag a box around them, but shift-clicking on them makes the selection area much bigger than just the bounds of the shapes. Not sure what is going on there, but it doesn't seem to bother anything... just something to be aware of. Right now, I think the only type of "map object" that isn't currently able to be added to an encounter are Text objects. That wouldn't be too difficult, so I'll probably add that (and another toggle) for the next version. Please let me know if you run into any issues.
Hey, just wondering when 1.12a or 1.12b will be in the one-click? 
1607202471
Kurt J.
Pro
API Scripter
Jay R. said: Hey, just wondering when 1.12a or 1.12b will be in the one-click?  I'll try to do that this weekend. I'm away from my development PC quite a bit these days, but I'll get it wrapped up and updated.
Kurt J. said: Jay R. said: Hey, just wondering when 1.12a or 1.12b will be in the one-click?  I'll try to do that this weekend. I'm away from my development PC quite a bit these days, but I'll get it wrapped up and updated. Thanks, Kurt!
1608568920
Andreas J.
Forum Champion
Sheet Author
Translator
Question: Is the API designed to work specifically with the D&D 5E by Roll20 sheet, or D&D 5E in general, or is it system agnostic/customizable for possibly using with other systems? Whatever the answer, it would be a good idea to have it stated at the start of the API's description. Not everyone plays D&D 5E, and it's useful to be able to determine at a glace if APIs are locked to specific sheets/systems or if they are universal. I've just made a PR to update the description & names of a couple of APIs so this kind of stuff is more clear.
1608580746

Edited 1608581912
Kurt J.
Pro
API Scripter
ᐰndreas J. said: Question: Is the API designed to work specifically with the D&D 5E by Roll20 sheet, or D&D 5E in general, or is it system agnostic/customizable for possibly using with other systems? Whatever the answer, it would be a good idea to have it stated at the start of the API's description. Not everyone plays D&D 5E, and it's useful to be able to determine at a glace if APIs are locked to specific sheets/systems or if they are universal. I've just made a PR to update the description & names of a couple of APIs so this kind of stuff is more clear. It is not specific to any system, hence the ability to specify what columns are displayed in association with tokens. The defaults that are filled in for the columns to display (AC and HP) are D&D attributes, but they can be changed in the settings. The script is also not language specific. It has configuration options for English, Spanish, French, and German. Right now all of the text is translated by Google translate, but I'd be perfectly happy to modify the text with more precise translations. I updated the Wiki page to reflect this, and while I would agree that this isn't a bad idea, I would also put some of the onus on the user to know what they are enabling and using in their game.
1608599378

Edited 1608599544
Andreas J.
Forum Champion
Sheet Author
Translator
It is not specific to any system, hence the ability to specify what columns are displayed in association with tokens. Yeah dunno why I was thinking that, with the APi being connected to the token, not the character sheets, so it shouldn't eve be relevant. After fiddling around with things and somehow not managing to display any NPCs in the HP/AC list of encounters, I gotta say this API is fantastic! I'm also impressed over you creating multilingual support for the API, that's the first instance I've heard of. Kurt J. said: The defaults that are filled in for the columns to display (AC and HP) are D&D attributes, but they can be changed in the settings. What settings? I can't for my life find how to change the API's setting for which token bars it assumes. The closest info i found on this described in the inital post in this thread was: 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. and I didn't find anything like it there. The script's wiki page nor the YT video had any info on this either. BTW, the API's Wiki page isn't listed in this thread nor the API's description. I think it would be a good idea to link this thread in the API's description as well.
1608851793

Edited 1608852818
Kurt J.
Pro
API Scripter
I've submitted a pull request to update the OneClick version of EncounterHelper to 1.0.13. Prior to this, the OneClick version required the user to Import the API and update the code to change the columns. This version lets you set them through the !eh config command. If you want to do this, you'll need to toggle on the OneClick override for the columns (also in !eh config). There is also a new config option to help text about the icons on the !eh list at the bottom of the list. Finally, the description has been updated to indicate that the API is not system-specific.
Can't wait for 1.0.13 in 1-click for stability. The enlarged selection boxes have been screwing me up something rotten recently - have you managed to isolate this at all?
1609182124
Kurt J.
Pro
API Scripter
MykeMyke said: Can't wait for 1.0.13 in 1-click for stability. The enlarged selection boxes have been screwing me up something rotten recently - have you managed to isolate this at all? As far as I can tell, this is a bug in the Roll20 UI code, perhaps as it relates to dealing with changes made by the API. The API doesn't have any access to UI features/functions like selections, so there is no way I can do anything about it, unfortunately.
Kurt J. said: As far as I can tell, this is a bug in the Roll20 UI code, perhaps as it relates to dealing with changes made by the API. The API doesn't have any access to UI features/functions like selections, so there is no way I can do anything about it, unfortunately. Makes sense - it's infuriating because of the inconsistency. Your script works perfectly to reset things as I need... but then it's a massive headache if I can't select tokens where I think I can (or they need to be changed layers to be properly viewed / selected). This selection area bug has big implications if combined with other scripts (Teleport springs to mind!) - but it's not something under your control I understand. :-)
1609426248
Kurt J.
Pro
API Scripter
Version 1.0.13 is on OneClick, but it is missing some code that I branched off into 1.0.12a and 1.0.12b. I'll be updating again over the weekend to merge the two and have 1.0.14 going up with the next weekly oneclick update.
1609600469
Kurt J.
Pro
API Scripter
I've issues a pull request to update OneClick to 1.0.14. When it goes live, I plan on creating a new YouTube video on using EncounterHelper, since the initial video is considerably out of date given the changes made to the script. If all goes well, 1.0.14 should be live on OneClick this Tuesday or Wednesday.
1610071909
Kurt J.
Pro
API Scripter
Version 1.0.14 is live on OneClick Over the next couple of days I'll be updating the Wiki and the YouTube video.
Just dropping in to show my love for this awesome script. I too am having some issues with selecting tokens after they've been grouped but this thing still saves a ton of time during my sessions.
Running into a weird bug where selecting multiple tokens for the !eh create command only generates an encounter with one of the selected tokens. Has happened to me multiple times. For example: Drag three spined devils onto the map. Select three tokens and run !eh create 09C. Minions Encounter is created but with only one of the spined devil tokens.
1611964662
Kurt J.
Pro
API Scripter
Jay R. said: Running into a weird bug where selecting multiple tokens for the !eh create command only generates an encounter with one of the selected tokens. Has happened to me multiple times. For example: Drag three spined devils onto the map. Select three tokens and run !eh create 09C. Minions Encounter is created but with only one of the spined devil tokens. Try as I might, I haven't been able to duplicate this... Are you pulling tokens from the compendium, the image library, or your character/handout gallery?
Kurt J. said: Jay R. said: Running into a weird bug where selecting multiple tokens for the !eh create command only generates an encounter with one of the selected tokens. Has happened to me multiple times. For example: Drag three spined devils onto the map. Select three tokens and run !eh create 09C. Minions Encounter is created but with only one of the spined devil tokens. Try as I might, I haven't been able to duplicate this... Are you pulling tokens from the compendium, the image library, or your character/handout gallery? I'm pulling from my character gallery. The tokens are already setup with connections to compendium monsters, default vision, etc. etc. Weirdly, it's not consistent. For example, I deleted the spine devils, then dragged some new tokens onto the map, set them up, and ran !eh on them, and they worked fine. I'll do some more testing and see if anything jumps out at me.