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

Adding multiple Macros to a character through API

Hello. I recently was able to convert all spells from a game I play into Macros using a variety of find and replace tricks in word and other related text programs. I am curious if there is an API out there that would allow you to add multiple new ability macros to a character at once. This way I can create a spell book and load all the spells into it in one fell swoop (or multiple smaller swoops). I have looked at CharUtils but that only seems to allow to have a macro ability copied from one character to another. What I need this to do is copy the macro text into the new ability and rename the ability.
1644949005
timmaugh
Pro
API Scripter
InsertArg can copy an ability and rename it at the same time, but only one ability at a time. Here is a post describing that.
1644951329

Edited 1644951494
Inside every spell template are a bunch of things that would trip up any copy over to a new sheet.  Namely any attribute call setup to call that character sheet, and also things like the wtype at the beginning and the charoutput at the end are attributes whose text field in the sheets backend including characters that cause breakage of queries and other places you'd need to replace characters in.   Token Action maker does a good job of making token actions in batches, I have to believe that api's are capable of doing it.  You can also setup the spells on a macro mule and call to them via a macro in the collections tab but again...that involves needing to replace html which means you need to either chop off the wtype(which then breaks most copy/paste macros cause the R2 value is incomplete when wtype is missing), and then replace charname output with the generic blank syntax.   I have caster bots in my game where I made a character who has a gigantic token action that is a queried list of every spell from level 1-5 for each class.  It took a LONG time.  For npc's I just point the token to the bot instead so the token actions come up.  For the players, I just copy and paste it over as I've already cleansed the character sheet calls to use selected instead.  The macro is GIGANTIC.  
I just got done writing my own script for something very similar. You can find it here: (see the second github link near the bottom in particular) <a href="https://app.roll20.net/forum/post/10693924/script-api-script-to-create-spell-macros-for-3-dot-5" rel="nofollow">https://app.roll20.net/forum/post/10693924/script-api-script-to-create-spell-macros-for-3-dot-5</a> Depending on what you are trying to pass over, what system it is for, and how those macros are structured, you can easily make modifications to this code to do what you are looking to do. Generally, I find API scripts are incredibly helpful for doing any mechanically repetitive work. If you have a clear idea of what inputs and outputs you expect/desire, then it just becomes a matter of translating that into code.