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

[5e Community] Spell Macro

Hi, I'm hoping someone can help me. I'm using the 5th Edition Community Created character sheet and I'd like to make a macro that will allow characters to select a list of spells to cast then enter the level that they would like to cast them at. I have some experience with macros, but I have trouble with queries for some reason. Any help would be appreciated.
The basic format for a drop-down query like this is: {{any template info that is the same for every option}} {{&nbsp; ?{Query Prompt |Option 1,&nbsp; details of option 1 |Option 2,&nbsp; details of option 2 ...etc }&nbsp; }} You can find information about the variables used in the community sheet here: <a href="https://wiki.roll20.net/DnD5e_Character_Sheet#Spel" rel="nofollow">https://wiki.roll20.net/DnD5e_Character_Sheet#Spel</a>... Nesting Roll queries within a drop-down query gets a bit messy, as you have to replace any comma, pipe or closing curly with its HTML Entity equivalent.&nbsp; There's a bunch of posts on drop-down queries that go over that.
I've done some research on this and even asked a question for a similar thing regarding skill checks. However I've been told that won't work because it's a repeating section on this character sheet.
A series of API buttons might be the best bet as the HTML entities can get out of hand when it comes to a fitting a spell macro into a drop down. Populate your character's spell list as usual. Then create these spell book macros for the character based on the number of spells they have for each level. Only have as many buttons as the player has spells, otherwise you will get errors for the missing ones. Level 3 example /w @{selected|character_name} &{template:5eDefault} {{spell=1}} {{title=Spell Select}} {{subheader=@{Selected|character_name}}} {{subheaderright=@{selected|spell_slots_l3} / @{selected|spell_slots_l3|MAX} **Slots**}} {{subheader2=Level 3}} {{emote=[@{selected|repeating_spellbookLEVEL3_$0_spellname}](~selected|repeating_spellbookLEVEL3_$0_spellcast)[@{selected|repeating_spellbookLEVEL3_$1_spellname}](~selected|repeating_spellbookLEVEL3_$1_spellcast) [@{selected|repeating_spellbookLEVEL3_$2_spellname}](~selected|repeating_spellbookLEVEL3_$2_spellcast) [@{selected|repeating_spellbookLEVEL3_$3_spellname}](~selected|repeating_spellbookLEVEL3_$3_spellcast) [@{selected|repeating_spellbookLEVEL3_$4_spellname}](~selected|repeating_spellbookLEVEL3_$4_spellcast) }} Cantrip Example /w @{selected|character_name} &{template:5eDefault} {{spell=1}} {{title=Cantrip Select}} {{subheader=@{Selected|character_name}}} {{emote=[@{selected|repeating_spellbookCANTRIP_$0_spellname}](~selected|repeating_spellbookCANTRIP_$0_spellcast) [@{selected|repeating_spellbookCANTRIP_$1_spellname}](~selected|repeating_spellbookCANTRIP_$1_spellcast) [@{selected|repeating_spellbookCANTRIP_$2_spellname}](~selected|repeating_spellbookCANTRIP_$2_spellcast) [@{selected|repeating_spellbookCANTRIP_$3_spellname}](~selected|repeating_spellbookCANTRIP_$3_spellcast)}}
Is this something that requires a membership to Roll20 to do?
1465584423

Edited 1465584446
No, you do not need to be a subscriber to use the API buttons. They have even made it easier to use with the addition of the ~ function. Have at it and make buttons galore!
That's perfect. Thanks!
1465585367

Edited 1465585383
Any way to add how many of each spell slot is left? I know that you can use "spell_slots_lx" and "spell_slots_lx_max" to get how many have been used and how many you have total, but I'm not sure how to get that into the API .
1465586745

Edited 1465586906
It's in the level 3 example. I make tokens to keep the track of spell slots. Try this
[@{selected|repeating_spellbookLEVEL3_$0_spellname}](~selected|repeating_spellbookLEVEL3_$0_spellcast) This is an Ability Command Button , which is very similar to an API Command Button .
1465587472
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Just to clarify, what Ed S. is talking about are the Ability Command Buttons, which are closely related to the API Command Buttons, but are not the same.
Ed S. said: It's in the level 3 example. I make tokens to keep the track of spell slots. Try this I see that now. Thanks!
1465587613

Edited 1465587774
Ok, I didn't realize the distinction but I see that the API buttons do have a different syntax. [Macro](!&amp;#13;#MacroName) Those do not require a pro subscription to use either.