Hi Nick, when I use the first command !Spawn --name|?{Which Monster |Goblin|Orc |Werewolf} --qty|?{How Many} --placement|surround I can't get the tokens to appear. I have all the MODS installed and I place the enemies in the library, I write the name as it appears in the character sheet and I have created the Encounter Token, BUT I can't get it to create the tokens automatically, what can I do?? Thanks for everything and I want to tell you that I love your videos
So excited by this mod. Added the required mods and created the macro with the above code. When I ran it, just as I enter the encounter name and clicked "submit", the sandbox crashed. I can give you the error and stack if you want. Thanks in advance.🙂
Interesting ! already had some of the mods, picked up the new ones and the macro. it is "nice to have" but unfortunately a bit problematic to use for me. for example - if u have monster names that are not just 1 word (i tend to add the monster CR to the character name so i can easily see it), or the fact that every possible monster type need to be manually added to the macro / manually typed to the prompt when used with a custom macro. I was thinking about making a menu macro to select CR, and for each CR call a different macro populated with different monsters with that CR. Wish i could figure out a way to use it with the numbered tokens mod and really integrate it into my workflow.
I have a few questions. 1) What happens if you add more than 8? 2) is there a way to add name/number (forget the actual mod right now… but it uses the %%NUMBERED%% command in the token name line) to this?
Hey, Aluvial... you can add the %%NUMBERED%% syntax to the name, then run a TokenNameNumber command line as another batched line within the ZeroFrame batch... however there is another option. The forselected handle actually produces individualized results for each token it iterates over, and it offers you another syntax token to represent the index of the token for this run of iterated tokens: {&i} If you have three tokens you are iterating over, the first would see that {&i} tag resolve to 0, the second would resolve to 1, and the third to 2. In fact, the tag takes simple offsets, so you could have a lower bound of 1 (instead of 0) simply by adding 1 to the tag: {&i+1} So when you are renaming the tokens with TokenMod, just include that tag to have them already numbered as you wish: (^)!forselected token-mod --set name|?{Which Monster|Goblin|Orc|Werewolf}{&i+1} {^&select ?{Encounter Name}*} (Remember if you include a space in the name you will need to enclose the name in quotation marks so TokenMod recognizes all of it as part of the name.) If you were going to use a simple offset like this, you will end up with duplicate numbers between one Spawned encounter and the next (each starting at 1), so perhaps you would want to include a "squad" component of the name just to be able to differentiate them (perhaps breaking the Encounter name into 2 queries and using one as a squad identifier). This is what Nick was trying to avoid though, going through the process of renaming the tokens, so to keep with Nick's aesthetic of keeping a cleaner Turn Order, you could put a simple query for the offset into the {&i} tag. The idea is you would simply supply the number of creatures-of-the-chosen-type you had already added to the map: {&i + ?{How many already exist?|0}} So if you Spawn 3 Orcs... the first time you would say 0, and you'd get Orc0, Orc1, and Orc2. Then next time you Spawn 4 Orcs, you'd answer that there were 3 Orcs already on the map, and you would get Orc3, Orc4, Orc5, and Orc6. The next time you'd answer that there were 7 Orcs, etc. If you want to have your answer of how-many-creatures-of-type already exist to be increased by 1 (to have a 1-based list instead of a 0-based list), that is doable, too. However, as it requires one more metascript beyond what Nick discussed in this video, I'll reserve it for now unless someone asks for it, just to keep this response clean and on topic to the mods Nick discussed. Post back if you want that syntax tweak.
If you have more than 8 tokens, they will continue to spawn around the origin point. I'll let Timmaugh's comment below handle the TokenNameNumber bit :)
Did anyone find a fix by chance? I have the same problem.@@NickOlivo The spawn default token works individually. Encounter helper works individually. Wrapping it all up in the code causes the crash. I tried a brand new game with only the required API/mods and I still get the same error, but the numbers are different. For reference, the error message generated was: TypeError: Cannot read properties of undefined (reading 'who') TypeError: Cannot read properties of undefined (reading 'who') at handleInput (apiscript.js:34555:43) at eval (eval at (/home/node/d20-api-server/api.js:168:1), :65:16) at Object.publish (eval at (/home/node/d20-api-server/api.js:168:1), :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) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461
Ah, the old "The image HAS to be in YOUR library" issue. I think that has led to more "WHY WONT MY API WORK?????" questions on the R20 forum than any other. I've never used [!eh add XX] as a command for Encounter Helper. I've always used [!eh create XX] Didn't even know "add" was a command. Are they the same or is there a subtle difference? Logic and instinct tell me they are the same. But... I know there are a few Mods/APIs that use different terms to achieve the same Command, but there are also ones where similar words can mean very different things... Quick question before I get started using this... if you are using theAaron's TokenNameNumber Mod, will it use the numbering format when renaming the tokens?
You can add the %%NUMBERED%% syntax to the name during the TokenMod command, then run a TokenNameNumber command line as another batched line within the ZeroFrame batch. You'll want another {&select} tag which appropriately selects the correct tokens (while leaving aside the ones that have already been renamed and numbered). However, there is an option right within the forselected syntax to rename AND number the tokens directly when TokenMod first touches them. See my response to Aluvial for details.
Encounter Helper's Add command is new - the great thing about it is that it will add a new token to an existing encounter, or it will create the encounter if it doesn't exist yet.
@@NickOlivo That's great news, Kurt said something about updating it when we were talking about being able to use it to move objects to the Map and Wall layers on another of your videos. (added 5 minutes later) I looked at the Mod Library and its not showing any new Commands on the main support page for the Mod. (added a further 5 minutes later...) Unfortunately, I've just tried it out in a new test game and EH is still using just the show and hide buttons so I'm guessing that it still works for only Token and GM layers. The version of EH I'm using was modified by someone to allow all 4 layers to be used. So I can transfer light tokens to the Wall/Light layer from the GM layer and move terrain to and from the Map layer for something like swapping out a bridge image with a broken bride image, for example. I'm afraid I've come to rely on those Map and Light layer shifts to make fast changes to map environments. So not going to be able to try this out after all. Which is a shame because this looks like a real time saver.
Getting the following error when I run the macro (tokens are definitely in my Library,; TypeError: Cannot read properties of undefined (reading 'who') TypeError: Cannot read properties of undefined (reading 'who') at handleInput (apiscript.js:11310:43) at eval (eval at (/home/node/d20-api-server/api.js:168:1), :65:16) at Object.publish (eval at (/home/node/d20-api-server/api.js:168:1), :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) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461
@@NickOlivo yup, as far as I can see they're there, a Wolf and Bear, token name is Wolf or Bear, represents Wolf or Bear and and character name is Wolf or Bear, my library image files are called Wolf or Bear. Doublechecked the images were in my library, only thing I changed in your macro was the creature names - !{{ !Spawn --name|?{Which Monster|Wolf|Bear} --qty|?{How Many} --placement|surround --tokenName|?{Encounter Name} (^)!eh add ?{Encounter Name} {^&select ?{Encounter Name}*}{^&delay .3} (^)!forselected token-mod --set name|?{Which Monster|Wolf|Bear} {^& select ?{Encounter Name}*} }}
@@NickOlivo I'm having the same issue. I can run each command individually and it works just fine. but when they are together I get the error above. This is the macro that doesn't work, !{{ !Spawn --name|?{Which Monster|Imp|Spined Devil|Bearded Devil|Barbed Devil|Chain Devil|Bone Devil} --qty|?{How Many} --placement|surround --tokenName|?{Encounter Name} (^)!eh add ?{Encounter Name} {^&select ?{Encounter Name}*}{^&delay .3} (^)!forselected token-mod --set name|?{Which Monster|Imp|"Spined Devil"|"Bearded Devil"|"Barbed Devil"|"Chain Devil"|"Bone Devil"} {^& select ?{Encounter Name}*} }} I even tried increasing the delay to 3.0 to see if it was still too fast, but got the same error. However, these ran individually work, !Spawn --name|?{Which Monster|Imp|Spined Devil|Bearded Devil|Barbed Devil|Chain Devil|Bone Devil} --qty|?{How Many} --placement|surround --tokenName|?{Encounter Name} !eh add ?{Encounter Name} {&select ?{Encounter Name}*} !forselected token-mod --set name|?{Which Monster|Imp|"Spined Devil"|"Bearded Devil"|"Barbed Devil"|"Chain Devil"|"Bone Devil"} {& select ?{Encounter Name}*} I'm not sure what I'm doing wrong