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

How would I make a Repeating Action Macro?

I noticed the execute as js userscript checkbox appeared, so I thought I'd try it. Just need some tips on how to start. I tried a basic: var j=0 while (j<3) { d20.textchat.doChatInput(j) j++ } Doesn't seem to work that way. I'm not familiar with JS, what am I doing wrong here?When I replace the j in chat input with "Hello world", it outputs 3 times as expected. My end goal currently is to make a macro that query which "repeating_npcaction" you want, then how many times. So when you have multiple of the same monster that does multiple of the same attack(I'm using 5E ogl), you can easily do it in macro. Before now, I've been doing this:  3 attacks: %{selected|repeating_npcaction_$1_npc_action} %{selected|repeating_npcaction_$1_npc_action} %{selected|repeating_npcaction_$1_npc_action}
1684501169
timmaugh
Pro
API Scripter
To do a dynamic loop, you really need a mod script. ScriptCards can do it, as can the metascript toolbox. Here are a few options of the metascript approach: Dynamically determine a number of attacks (single output loop) Dynamically determine a number of skeletons to attack (single output loop) Dynamically determine the number (and content) of critical failure results (single output) Dynamically output a new command line (narration) (multiple output loop) (for that last one, to see the code, click through to the video and read the pinned comment; there are two options, with the second being more dynamic and probably more relevant to what you want to do.) If you want to go this route and can't figure it out from these examples, post back more info and I can help. I think you're going to want to batch up your commands (to have multiple outputs), which will require ZeroFrame. Then you're going to want to dynamically generate those lines, which will require Muler, as well as the ability to test whether you've reached the desired number of lines (APILogic), and a way to increment a counter (MathOps). And you're going to need to dynamically reference the repeating attribute, which will require Fetch.
If your goal is to learn & practice javascript and the Roll20 Mod format, then timmaugh has given you a great starting place. But if you just want to use what others have already produced, then here are a few options: Universal Statblock MacroMule for D&D 5E   Token Action Maker Universal Chat Menu