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

[Script] API Script to create Spell Macros for 3.5

February 15 (3 years ago)

Edited February 16 (3 years ago)

I just finished creating an API script to create ever spell macro from the Spell Macro List found here: 
https://app.roll20.net/forum/post/6264239/d-and-d-3-dot-5-all-spell-macros

Some notes. I don't like that it forces you to use Caster Level Checks and Concentration Checks so I automated that out.
I also automated out the @{character_name} field so that it can just be used without having to copy it onto a character sheet (or select token). If putting on a character sheet, you can use #MacroName {{name= @{character_name} }} and it should add this.
!deletespellMacros searches for all macros named #zSpell(something) and deletes it.

!createspellMacros creates a macro for each spell from that list, naming it #zSPELL(something). The naming part needs a bit of work but you can always fix the name manually for now.
The spell also automatically looks for damage rolls from the spell notes and creates damage fields for each. It also scales up damage for Caster Level and sets a maximum damage using the spell notes.

Automatically adds in spell DC based on minimum caster level for the spell. When used, it asks what kind of caster you are (since different spellcasters have different minimum caster levels) and uses that information for the rolls.

Automatically calculates range and other things using the minimum caster level.

Also allows you to enter a custom amount for DC and Caster Level.

I'll have to look at a bunch of different spells to add other customization, but for now, I think this is a big step forward for making 3.5 games easier to run. Any suggestions as for other features to add are welcome.

Also note, this script takes a few minutes to load everything. Once you use the !createspellMacros command, you will know when it is done when it generates a macro for Zone of Truth.

Update 2/15:
Added more damage conditions. Now it will do (CasterLevel)d(Number) but also (Numb)d(Numb) + (CasterLevel). For the latter, it only does this for spells with maximums. For the former, it does this for spells with or without maximums. There are some spells where it could use a bit more automation, like spells that effect (Num)d(Num) HD, but when I initially tried to add this by duplicating the damage part of the script, I ran into problems. It will, however, capture any text that says roll (Num)d(Num) and put that roll as a line.

In general, nearly all of the spells seem functional with a single click. The only exception to this would be spells that don't have a core class level in the macro. Additionally, most of the spells are good to go and ready to use, but some might need minor tweaking (like those whose damage is more complex like Vampiric Touch).

Here is the code:
https://github.com/astuertz/Roll20/blob/main/createspellMacros35.js

(Can't seem to view it on github so you will have to download it to view.)

Recently just got done creating a new script also that takes the spells created in that code and copies it over to a character sheet. Additionally, it changes all the queries (the ?{Question?|0} type stuff) into numbers. Since, typically, numbers don't change that much for individual characters, entering that stuff would be annoying. But anyway, here's how it works:

Create an ability macro on a character sheet with the same name as the global macro. If desired, add the following lines:
CL 0
DC 0
Ranged 0
Melee 0

Instead of 0's, you can make any number. (At present doesn't look for anything more complicated than numbers.) But it will replace all of the queries for Caster Level with that number, the DC, the Ranged Attack Mod, and Melee Attack Mod.

Makes creating macros for character sheets much quicker and easier.

That code can be found here:
https://github.com/astuertz/Roll20/blob/main/importSpells.js




February 15 (3 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator

Great!

If you submit the API to the API repo, it would be available in the Install menu.

Info on submitting API to Roll20