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 .
×

Need to run a randomly selected macro

Is this possible? I feel I am close but missing something. I have a set of macros for Wild Magic Surge effects. Some are simple and just post the description, but others either post one description to the group and another to the player. Still others setup a series of commands to add items to the turn tracker or set auras, etc. When a Wild Magic Surge occurs, I would like to have a macro button for the player to hit and sets the thing into motion: Randomly selecting one of the Wild Magic Surge macros and running it. I have searched the forums and out further and  have tried several methods of doing this. I finally arrived at a macro using the RecursiveTables API script: !rt #WM-Surge-[[1t[WM-Surge-Roll] ]] It outputs a fully formed macro name into chat free of rolls or rolling table highlighting but will not run it. I have tested the macros and they run error free. This is what the WM-Surge-A outputs when run manually: What am I missing? Is there a way to bridge this gap? Thank you, James
1589223798
The Aaron
Roll20 Production Team
API Scripter
Macros/abilities are expanded in the Client User Interface.  When they come from the API, that UI doesn't exists or get executed.  To run then from the UI would require a special purpose script, or an extension to RecursiveTable.  Ironically, I was talking with Khan on the Roll20 discord about exactly this less than an hour ago.  I'm going to look into have RecursiveTable call abilities/macros when it recognizes them in the resulting message, but no promises.  Calling Macros/Abilities from the API has some problems. I've done it in OnMyTurn, so I think I can pull that code out and do it here, but I really don't know.
Thank you. I was thinking there was some esoteric formatting option that I was just not finding or understanding. Didn't know it would become a minor project. I use RecursiveTables as much as I use TokenMod. So thank you for helping with my games; past and future. If there is anyway I can help out, just let me know. James