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 Update] EncounterHelper

1693309886
Kurt J.
Pro
API Scripter
I've released an updated version of EncounterHelper (1.1.0) that is now live on OneClick.&nbsp; This update brings a couple of new features (Thanks Nick Olivo and his video commentors for the suggestions) You can now create encounters from any map layer (except the GM Layer), meaning you can have walls, lights, and map objects handled by EncounterHelper in addition to tokens and drawing objects from the objects layer You can now add additional objects to an encounter after the encounter has been created with the !eh add &lt;encountername&gt; command, which will add any selected objects to the named encounter (or create it if it does not exist). This is required if you want objects from different layers in the same encounter. Each object will remember where it came from Some tweaks and bug fixes New color theme to replace the orange glare GitHub (Development Versions):&nbsp;&nbsp; <a href="https://github.com/kjaegers/ScriptCards/blob/main/X_OtherScripts/EncounterHelper.js" rel="nofollow">https://github.com/kjaegers/ScriptCards/blob/main/X_OtherScripts/EncounterHelper.js</a> Original thread:&nbsp; <a href="https://app.roll20.net/forum/post/8988154/script-encounterhelper/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/8988154/script-encounterhelper/?pagenum=1</a>
1693677380
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Just wanted to give a shout out here. I watched the video by Nick and it convinced me to give this a try. I had a very complex encounter area with multiple groups of NPCs who had to appear and disappear (it was an arena scenario, with multiple bouts and various people in the audience who needed to appear at intervals. Normally for ad hoc visibility control I use Bump (and used it here, for fine control), but Encounter Helper was a godsend. It made it super easy to manage all the groups and a lot less time than setting up token mod macros. Great script! Thanks Kurt!
1693681105
vÍnce
Pro
Sheet Author
Nick Olivo's tip on using Encounter Helper: <a href="https://youtu.be/1gTMIIRPzf0?si=iLqHNjNOL9QyB4JC&amp;t=28" rel="nofollow">https://youtu.be/1gTMIIRPzf0?si=iLqHNjNOL9QyB4JC&amp;t=28</a>
I love Encounter Helper, and I think it was a different video of Nick's that sold me on it (could be misremembering, but Nick has a ton of great content and explains things well, so he's sold me on quite a few mods). I like this update, being able to add tokens to an existing encounter is super helpful.&nbsp; I'm not quite sure how to apply the other new feature, though: "... you can have walls, lights, and map objects handled by EncounterHelper in addition to tokens and drawing objects from the objects layer &nbsp;objects and tokens" Would love to hear how others are using that feature so I can get my mind in gear!&nbsp;&nbsp;
1694974059

Edited 1694974886
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Kurt, have you considered adding text objects in with drawing objects? I wanted to do a campaign recap to show the characters' progress on a map with markers, route lines and labels, but realized the labels wouldn't show/hide. Also (I don't know if it already does this), if you add in an image that is on the map layer, does EH toggle it between map and gm layer? That would be useful for things like traps or environmental hazards that appear during an encounter. NVM, I just tested and this is indeed how it works. Excellent! I am using this excellent tool more and more with each game. I use Bump when something needs to go invisible or there are only a few tokens, but this is excellent for hordes or waves of attackers or reinforcements.
1695022493
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Here's a handy EH macro if you are using Fetch. Select any token on the page and run !eh setactivepage @(selected.page_id) The script will set EH's page to that page id, so long as it is a viable choice.
I am having a bit of a problem getting encounter helper working on a new game I am setting up. I set the page to active, highlight my rat tokens and create the&nbsp; encounter:- (From EncounterHelper): &nbsp;Active page set to Yawning Portal Third Floor. (From EncounterHelper): &nbsp;Created encounter Rat with 4 tokens. However when I then run the !eh list or the !eh command on its own it crashes the sandbox with the following&nbsp; error:- Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.&nbsp; More info... &nbsp;If this script was installed from the Mod Library, you might find help in the Community API Forum. For reference, the error message generated was:&nbsp; TypeError: Cannot read properties of undefined (reading 'split') TypeError: Cannot read properties of undefined (reading 'split') at apiscript.js:1159:46 at Array.forEach (&lt;anonymous&gt;) at getEncounterMobsFullInfo (apiscript.js:1156:35) at getEncounterMobs (apiscript.js:1167:28) at apiscript.js:694:64 at Array.forEach (&lt;anonymous&gt;) at apiscript.js:682:52 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1762:12 The other mods I am running are, Token mod, Token Action maker, group initiative and Dynamic Lighting Tool.
1695152446
Kurt J.
Pro
API Scripter
keithcurtis said: Kurt, have you considered adding text objects in with drawing objects? I wanted to do a campaign recap to show the characters' progress on a map with markers, route lines and labels, but realized the labels wouldn't show/hide. Also (I don't know if it already does this), if you add in an image that is on the map layer, does EH toggle it between map and gm layer? That would be useful for things like traps or environmental hazards that appear during an encounter. NVM, I just tested and this is indeed how it works. Excellent! I am using this excellent tool more and more with each game. I use Bump when something needs to go invisible or there are only a few tokens, but this is excellent for hordes or waves of attackers or reinforcements. Good idea :) I've added Text objects in the latest GitHub build available here:&nbsp;<a href="https://github.com/kjaegers/ScriptCards/blob/main/X_OtherScripts/EncounterHelper.js" rel="nofollow">https://github.com/kjaegers/ScriptCards/blob/main/X_OtherScripts/EncounterHelper.js</a>
1695152538
Kurt J.
Pro
API Scripter
@Jason G - Have you created an "Encounter Token" on the page?
1695161285
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Kurt J. said: Good idea :) I've added Text objects in the latest GitHub build available here:&nbsp; <a href="https://github.com/kjaegers/ScriptCards/blob/main/X_OtherScripts/EncounterHelper.js" rel="nofollow">https://github.com/kjaegers/ScriptCards/blob/main/X_OtherScripts/EncounterHelper.js</a> Sweet!
Kurt J. said: @Jason G - Have you created an "Encounter Token" on the page? Yes i had one, removed it and created a new one and it works. I had the token set to represent a character with the token name of "Encounter Token" I think that was causing the issue, if I leave it on generic token it works.
1695304450
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I thought I had problems with an attached sheet, until I realized that any text already existent in the GM notes can cause issues. My default token has no gm notes now.
1695372684
Kurt J.
Pro
API Scripter
I will add some error handling to at least prevent the sandbox crash in this case and output a message about issues with the gm notes field on the token.
1696863969

Edited 1696864004
Kurt J.
Pro
API Scripter
Sorry... I went to do the update for 1.2.1 and realized I never *actually* created the pull request for a previous set of changes. I've done that now for 1.2.1, so the update should happen the next time changes are merged to OneClick. This version adds the ability to include text objects in encounters and fixes a potential sandbox crash issue if the GM Notes on EncounterToken are not in the expected format.
1698431690

Edited 1698432378
Edit: I'm dumb. I didn't know I had to do "eh create!" and then give it a name like "!eh create ghouls" Everything is working now. I am getting the below error when I do "eh create!" while selecting a ghoul token. I have the "Encounter Token" set as "None/Generic Token" I do "1eh pagelist" I select "Activate" for the page I am on. I click on a ghoul token, do "eh create!" and get the below error.&nbsp; I am doing something wrong? For reference, the error message generated was:&nbsp; TypeError: Cannot read properties of undefined (reading 'split') TypeError: Cannot read properties of undefined (reading 'split') at apiscript.js:22633:46 at Array.forEach (&lt;anonymous&gt;) at getEncounterMobsFullInfo (apiscript.js:22630:35) at getEncounterMobs (apiscript.js:22641:28) at apiscript.js:22008:64 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1762:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)
I am having the same issue as Chad/Pryias Chad/Pyrias said: I am getting the below error when I do "eh create!" while selecting a ghoul token. I have the "Encounter Token" set as "None/Generic Token" I do "1eh pagelist" I select "Activate" for the page I am on. I click on a ghoul token, do "eh create!" and get the below error.&nbsp; I am doing something wrong? For reference, the error message generated was:&nbsp; TypeError: Cannot read properties of undefined (reading 'split') TypeError: Cannot read properties of undefined (reading 'split') at apiscript.js:22633:46 at Array.forEach (&lt;anonymous&gt;) at getEncounterMobsFullInfo (apiscript.js:22630:35) at getEncounterMobs (apiscript.js:22641:28) at apiscript.js:22008:64 at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:65:16) at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:168:1), &lt;anonymous&gt;:70:8) at /home/node/d20-api-server/api.js:1762:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) I've been unable to find any token with text in GM field that could be responsible. I simply cannot get the script to run. I can create the toke I can !eh pagelist and get the menu to come up and set the page as active When I run !eh create the script crashes and produces same error as reported above. Suggestions? Thanks.
1698763640

Edited 1698763692
Tilt
Pro
I have also been getting the error listed above today when trying to setup new encounters.&nbsp; &nbsp;Then if I reset the sandbox, it will create the encounter but it will not work exactly the way it should.&nbsp; I can pull up the list of HP/AC information, I can group init the encounter and I can even hit the H to hide the tokens, but if I hit S to show the tokens, it says it has shown them, but they never go to the Token layer, they sit on the GM layer. The way I was finally able to get it to work was to have the encounter created, then hit the "-" sign to delete it and with them still selected, hit the "+" sign to create it.&nbsp; Then it worked correctly..&nbsp; but not by using the !eh create &lt;name&gt; method. Thank you btw for this mod, I use it constantly
1699051113
Kurt J.
Pro
API Scripter
Are you just typing "!eh create" or are you specifying a name for the encounter (like "!eh create Orcs"). I have verified that there is an issue when a name isn't specified and I'll push a fix for that to prevent the sandbox crash, but it is working for me as long as I specify an encounter name.
1699052548
Kurt J.
Pro
API Scripter
Detection for leaving out an encounter name has been added in 1.2.2 which is now queued for OneClick for next week. In the interim, it is available on my GitHub (<a href="https://github.com/kjaegers/ScriptCards/blob/main/X_OtherScripts/EncounterHelper.js" rel="nofollow">https://github.com/kjaegers/ScriptCards/blob/main/X_OtherScripts/EncounterHelper.js</a>)
Kurt J. said: Are you just typing "!eh create" or are you specifying a name for the encounter (like "!eh create Orcs"). I have verified that there is an issue when a name isn't specified and I'll push a fix for that to prevent the sandbox crash, but it is working for me as long as I specify an encounter name. Sorry, I was out of town for the last week.&nbsp; I would give it an encounter name.&nbsp; &nbsp;All of that being said, I worked more on my next session after I posted the above message and it worked perfectly fine for me.&nbsp; &nbsp; So maybe it was just a fluke somewhere else that was causing the issue for Eddy and myself. Thank you