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

Drop-down for 'generic' spellcasting using macros

I've gotten a good start with token macros for my NPCs for attacks and actions and stuff. I've run into some problems with doing macros for spellcasting though.

With some brief research, I found I can use the macro "%{selected|repeating_spell-cantrip_$0_spell}" to make individual generic macros that won't break when a spell changes in the character sheet. Then I got to thinking, one of the NPC mages that I've set up has 10 different spells, so having each spell individually in the bar takes up too much space.

In order to fix this, I attempted to use drop-down menu to allow me to select which spell to use, which ended up looking like this:
?{Choose a spell|
@{selected|repeating_spell-cantrip_$0_spellname}, %{selected|repeating_spell-cantrip_$0_spell} |
@{selected|repeating_spell-cantrip_$1_spellname}, %{selected|repeating_spell-cantrip_$1_spell} |
@{selected|repeating_spell-cantrip_$2_spellname}, %{selected|repeating_spell-cantrip_$2_spell}
}
Now, when I use the macro, a drop down menu appears but it doesn't have a drop-down, just a single text box with the text: 
Light, /w gm&{template:spell
Does anyone have any ideas as to how I could fix this?
January 07 (7 years ago)

Edited January 07 (7 years ago)
There are tons of good ways to create macro kits for spells and/or abilities, and you'll find a number of good discussions about them in the forums. Here's an example of how I do it. The macro whispers the spells/abilities into chat as a list, with clickable buttons. You'll notice in this case that my macro also referencing spells, but also other fields from the sheet such as "class resource" and the super-awesome "repeating traits" area:

/w @{selected|token_name}&{template:atk} {{desc=
**SORCERER**
[Sorcery Points](~selected|repeating_traits_$2_output) (**@{selected|class_resource}**)
***WILD MAGIC***
[Tides of Chaos](~selected|repeating_traits_$5_output)
[Wild Magic Surge](~selected|repeating_traits_$3_output)
***METAMAGIC***
[Quickened Spell](~selected|repeating_traits_$6_output)
[Empowered Spell](~selected|repeating_traits_$7_output)
---------------------
**CANTRIPS**
[@{selected|repeating_spell-cantrip_$0_spellname}](~selected|repeating_spell-cantrip_$0_spell)
[@{selected|repeating_spell-cantrip_$1_spellname}](~selected|repeating_spell-cantrip_$1_spell)
[@{selected|repeating_spell-cantrip_$2_spellname}](~selected|repeating_spell-cantrip_$2_spell)
[@{selected|repeating_spell-cantrip_$3_spellname}](~selected|repeating_spell-cantrip_$3_spell)
[@{selected|repeating_spell-cantrip_$4_spellname}](~selected|repeating_spell-cantrip_$4_spell)
---------------------
**LEVEL 1 SPELLS** (**@{selected|lvl1_slots_expended}**)
[@{selected|repeating_spell-1_$0_spellname}](~selected|repeating_spell-1_$0_spell)
[@{selected|repeating_spell-1_$1_spellname}](~selected|repeating_spell-1_$1_spell)
---------------------
**LEVEL 2 SPELLS** (**@{selected|lvl2_slots_expended}**)
[@{selected|repeating_spell-2_$0_spellname}](~selected|repeating_spell-2_$0_spell)
[@{selected|repeating_spell-2_$1_spellname}](~selected|repeating_spell-2_$1_spell)
[@{selected|repeating_spell-2_$2_spellname}](~selected|repeating_spell-2_$2_spell)
---------------------
**LEVEL 3 SPELLS** (**@{selected|lvl3_slots_expended}**)
[@{selected|repeating_spell-3_$0_spellname}](~selected|repeating_spell-3_$0_spell)
[@{selected|repeating_spell-3_$1_spellname}](~selected|repeating_spell-3_$1_spell)
}}
January 07 (7 years ago)
Chris's post is great as it gives a similar way to accomplish what you want, but I feel as though you may need help understanding why your current macro isn't working and why a query is not the easiest way to go about your macro.

The Problem - Roll queries end at the first '}' it comes across.
This also includes any nested '}' such as those inside your spell abilities and is why the query thinks it does not have the other spells nested in the query.

Now you could still utilize a roll query for your macro, but it is a lot more work. It would involve recreating each of the spell abilities and embedding these failing characters (including ',' or '|', in addition to '}') with their HTML equivalents.

But that is why most people will use API/Ability command buttons instead of roll queries for abilities and macros. With this approach you do not need to recreate each macro. Instead you give up the the nice format of the query for an extra click in the chat window. While this approach would clutter the chat window, if you whisper the macro to yourself if only clutters your screen, not everyone's.
That's what I figured Kyle, I actually did attempt to recreate the %{selected|repeating_spell-cantrip_$0_spell} using the HTML equivalents but if I understand you correctly I'd need to actually replace that whole bit with /w gm&{template:spell}... using HTML equivalents? And would I be correct in assuming that those spell commands would then be unique to the spell and therefore can't be used to create a generic macro that will still work even if the spells are changed?

And thank you for the macro Chris, I guess using the ability buttons will work just as well!
January 08 (7 years ago)
That is correct on both accounts.