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

Spellcasting macros using API scripts

Good Morning everyone,
I have been searching for something tied directly to this idea, which given all the threads I have seen must be possible, but I have got to be missing a post somewhere. That being said, apologies for the probably duplicate question. I am using the OGL char sheet in a game I am DMing and want to set up a macro that will run when a player selects his token and uses the macro to cast a specific spell, Thunderwave. The macro would cast the spell in the same manner as clicking on the spell sheet, but then also utilize the an API script I installed called KABOOM. I have played been playing with the macro settings, but am having a heck of a time trying to locate how to set it up using the spell sheet information. Any assistance, or a finger point in the general area of a helpful solution/document would be appreciated!

Thanks for reading!
If your character is willing to use a macro for the spell rather than clicking it from the character sheet, you could just add the API command into the same macro.

To get the thunderwave spell from the macro you have two choices.

1 - You can use the exact same roll information by clicking on the thunderwave spell in the character sheet, then click the up arrow in the chat log. This will allow you to see everything that the character sheet used for the spell and could simply copy this information into your macro.

2 - You could call the spell directly from the character sheet by using %{character_name|repeating_spell-1_$0_spell}. 0 is the row index of the spell starting from the top. If you create this macro as an ability of the individual character, you don't even need to include the character_name for the spell.
August 31 (7 years ago)
The Aaron
Pro
API Scripter
Probably I'd cast the spell from the sheet, then click in chat and push up to see what was sent, copy that and put it in an ability on the character with the KABOOM command on the next line of the ability, then make it a token action and cast that way.
August 31 (7 years ago)
The Aaron
Pro
API Scripter
Oooh, Kyle has a much better answer! =D

If you did want to get the effect from casting it on the Character sheet, you could write an API script that scrapes the chat log and finds that spell being cast, then issues the !KABOOM command based on it.  That's tedious and error prone, but possible.
Thank you both so far! @Kyle - I will have to play around with this on my next break at work and see what works best. @Aaron - I think that may be a little (please read as MILES...lol) above my current MACRO/API scripting skill level. Now I just need to see if there is a way to have the macro/script check a saving throw for the tokens within range... or maybe I should just get this to work first. lol
Is KABOOM a custom script you created or one you found?
August 31 (7 years ago)
The Aaron
Pro
API Scripter
One he found.  It's pretty neat.  Pushes tokens back from an epicenter.  Even respects DL walls.
August 31 (7 years ago)
The Aaron
Pro
API Scripter
https://app.roll20.net/forum/post/4541901/slug%7D
@Aaron - Nail on the head! Very cool and parsecs away from my skill. LOL
September 01 (7 years ago)
Thank you both! With the two of your ideas combined I have it set up to call for different spells that use this type of effect. Now for the hard part, to see if there is a way for Kaboom to have tokens make a saving throw prior to moving them. Not sure if API scripts can do that, but I think I may need to inquire with the author for that though experiment.
September 01 (7 years ago)
I've done the same with two macros, one for the spell, it whispers the gm if the saving throw is a fail or a success too (buttons), fail=link to kaboom macro and success = nothing happens or link to half damage macro.
September 06 (7 years ago)
PaprikaCC
API Scripter
Hey there @Matthew W. It's technically possible to integrate saving throws with KABOOM, but it would not post the saves/damage/effect results to chat in the script's current state. Let me know what you'd like to see as a feature and I'll try and figure out how to do it.
September 07 (7 years ago)
@PaprikaCC, if it is possible, and forgive the very basic programming-esque explanation, I would love to see the API query the token to make a saving throw per the spell requirements, display it and in a if-->then style push the token X amount on a fail. Not sure if that is possible, but that would be a new update in my idealistic dream Roll20-verse. lol

Thank you again for stopping in and chiming in, and let me say I absolutely LOVE the API and am planning on using it with or without said idealistic update.