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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Allow the API to run Macros

In order to make combat run faster, I would like to have certain Macros to be triggered automatically. Unfortunately, there seems there is no way to call a macro from the API. In my particular example, I want a certain Macro (which contains the character Statblock and Spells) to be executed automatically at the start of its turn. Right now I just display a couple of buttons on a new turn with those macros. As a DM, not having all those whisper messages on my own chat would greatly enhance the Roll20 Experience.
1539970708

Edited 1539970812
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
This is already possible. There are a number of ways to do this: sendChat('API','#someGlobalMacro'); OR sendChat('API','%{someCharacter|someAbilityOnThatCharacter}'); or get all the info using findObjs, .get, and sendchat to assemble some dynamic output based on the ability. You can't use the selected/target keywords in the first example, but can work around that with the dynamic output method where you get everything and process it in script.
Scott C. said: This is already possible. There are a number of ways to do this: sendChat('API','#someGlobalMacro'); OR sendChat('API','%{someCharacter|someAbilityOnThatCharacter}'); Weirdly enough, if iI do this I'll only get someCharacter|someAbilityOnThatCharacter on the output (of course, assuming I replaced both someCharacter and someAbilityOnThatCharacter with valid inputs). In my case: '%{' + token.get('represents') + '|shaped_statblock}'