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

Stacked Spell list Macro as token action, Help?

Hey! So I'm trying to organize a simpler way to track spells for my npcs. My goal is to have a token action I can click to pull up a box with the names of all of that npc's spells in chat, that I can then click to get the full spell description. Taking inspiration from this Taking20 tutorial: <a href="https://www.youtube.com/watch?v=8RxRODcMRRo&amp;list=PL4ihyL-PTq4N5DRmy72zCqD1eQhnqaCTp&amp;index=6" rel="nofollow">https://www.youtube.com/watch?v=8RxRODcMRRo&amp;list=PL4ihyL-PTq4N5DRmy72zCqD1eQhnqaCTp&amp;index=6</a> This is what I have so far for an attribute to pull the first level 1 spell from an npc's character sheet. /w gm &amp;{template:Default} {{name=@{selected|npc_name}}} {{rname=Spells}}&nbsp; [@{selected|repeating_spell-1_$0_spellbasename}](!&amp;#13;@%{selected|repeating_spell-1_$0_spell})
1577062613
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You can cast &nbsp;them using the&nbsp; Universal Chat Menu &nbsp;script, and if GiGs ever decides to quell my whining, the ability to use the script to make reports would also be possible. As it is, your script will work, but will return an error for any spell that doesn't exist on the sheet.
1577100448

Edited 1577100656
Thank you for the help! I'm using the 5e template and it turns out I just can't get !chatmenu to work, the command doesn't work for me on any level of operation. But I did manage to get it working with the&nbsp; [command name](~macro to call) format. Everything works, the button appears in a table in chat, and the button casts the spell. The only thing I still can't get working is to pull the spell name attribute onto the button. Here's my new code: &amp;{template:default} {{name=@{selected|npc_name}'s Spells}} {{Level 1=[@{selected|repeating_spell-1_$0_spellname_base}](~@{selected|repeating_spell-1_$0_spell})}}&nbsp; So when I run this, I get the error codes:&nbsp; No attribute was found for @{selected|repeating_spell-1_-LwemM8o2-1SM88Y4hmD_spellbasename}&nbsp; &nbsp;and&nbsp; No attribute was found for @{selected|repeating_spell-1_-LwemM8o2-1SM88Y4hmD_spell} The button will still cast the right spell, but the text inside reads:&nbsp;&nbsp; selected|repeating_spell-1_$0_spellname_base Any idea what I'm doing wrong to call up that attribute?
1577100784

Edited 1577100968
Ziechael
Forum Champion
Sheet Author
API Scripter
At a quick glance you have " spellname_base" and the error refers to " spellbasename ", could be linked to that?&nbsp; Quick test and this should work: &amp;{template:default} {{name=@{selected|npc_name}'s Spells}} {{Level 1=[@{selected|repeating_spell-1_$0_ spellname }](~@{selected|repeating_spell-1_$0_spell})}}
That worked! Thank you so much!
Last thing on this topic, every time this macro goes off it first fills the chat with messages like&nbsp; No attribute was found for @{selected|repeating_spell-1_-LwiOKrBUO4JRWQZp1QG_spell} for every spell on the list. The code works flawlessly, but is there any way to clean that up?&nbsp;
1577112400
Ziechael
Forum Champion
Sheet Author
API Scripter
Could you share your entire macro? It'll make trouble shooting easier :)
1577117713
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The error message could be coming from referencing spells that don't exist, ex, calling the 4th spell from a character who only has 3 spells at that level. But yeah, the whole macro would help.
Sure, here's the Macro for one of my characters, with innate spellcasting and spells by level&nbsp; /w gm &amp;{template:default} {{name=@{selected|npc_name}'s Spells}}{{At Will=[@{selected|repeating_spell-1_$0_spellname}](~@{selected|repeating_spell-1_$0_spell})[@{selected|repeating_spell-1_$1_spellname}](~@{selected|repeating_spell-1_$1_spell})[@{selected|repeating_spell-1_$2_spellname}](~@{selected|repeating_spell-1_$2_spell})}} {{1/Day=[@{selected|repeating_spell-2_$0_spellname}](~@{selected|repeating_spell-2_$0_spell})[@{selected|repeating_spell-3_$0_spellname}](~@{selected|repeating_spell-3_$0_spell})}} {{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})}} {{Level 1=[@{selected|repeating_spell-1_$3_spellname}](~@{selected|repeating_spell-1_$3_spell})[@{selected|repeating_spell-1_$4_spellname}](~@{selected|repeating_spell-1_$4_spell})[@{selected|repeating_spell-1_$5_spellname}](~@{selected|repeating_spell-1_$5_spell})}} {{Level 2=[@{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=[@{selected|repeating_spell-3_$1_spellname}](~@{selected|repeating_spell-3_$1_spell})}} There aren't any spells being called that aren't in the character sheet. When that happened the code for that spell came up on the button instead of the name of the spell. That error is being called for every single one of the spells in the macro, but they all work.
1577123217
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ah, the problem is "selected|repeating_spell-1_$0_spell", and similar. "spell" is not an attribute name. What were you wanting to display at this point? Were you wanting it to cast the spell? In which case a button would look like: %{selected|repeating_spell-1_$0_spell} % indicates an ability (Do something). @ is used for an attribute call (Read something). I think you would have much easier to manage results with the script I mention above (look for completed macros in the thread), but if you change your attribute calls to ability calls where appropriate, you should eliminate the error messages. Keep in mind, the macro you have written will cast the spells, not display them, as you outlined in the top post. There is no built-in display ability.
1577123370
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I do have a UCM macro that displays the description text of any given spell: !chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{name=Spell Descriptions. Clicking on these gives the text of the spell without casting it.}}{{description=CHATMENU}} --separator: | --title:Eldritch Invocations --repeating_traits|name|output|name=Invocation: --title:Cantrips —&nbsp; *Save DC @{selected|spell_save_dc}* --repeating_spell-cantrip|spellname|spelldescription! --title:Lvl-1 *(@{selected|lvl1_slots_expended}/@{selected|lvl1_slots_total})* --repeating_spell-1|spellname|spelldescription!|spellprepared --title:Lvl 2 *(@{selected|lvl2_slots_expended}/@{selected|lvl2_slots_total})* --repeating_spell-2|spellname|spelldescription!|spellprepared --title:Lvl 3 *(@{selected|lvl3_slots_expended}/@{selected|lvl3_slots_total})* --repeating_spell-3|spellname|spelldescription!|spellprepared --title:Lvl 4 *(@{selected|lvl4_slots_expended}/@{selected|lvl4_slots_total})* --repeating_spell-4|spellname|spelldescription!|spellprepared --title:Lvl 5 *(@{selected|lvl5_slots_expended}/@{selected|lvl5_slots_total})* --repeating_spell-5|spellname|spelldescription!|spellprepared --title:Lvl 6 *(@{selected|lvl6_slots_expended}/@{selected|lvl6_slots_total})* --repeating_spell-6|spellname|spelldescription!|spellprepared --title:Lvl 7 *(@{selected|lvl7_slots_expended}/@{selected|lvl7_slots_total})* --repeating_spell-7|spellname|spelldescription!|spellprepared --title:Lvl 8 *(@{selected|lvl8_slots_expended}/@{selected|lvl8_slots_total})* --repeating_spell-8|spellname|spelldescription!|spellprepared --title:Lvl 9 *(@{selected|lvl9_slots_expended}/@{selected|lvl9_slots_total})* --repeating_spell-9|spellname|spelldescription!|spellprepared This one will filter the spell list on up to five criteria, returning a subset of concentration, or ritual spells only and so forth: !chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{name=**Filters** Casting Time = ?{castingtime|any, |Action,1 action|Reaction,reaction|Bonus Action,bonus} Ritual = ?{ritual|any,&lt;2|no, |yes,1} Concentration = ?{Concentration|any,&lt;2|no, |yes,1} School = ?{School|any, |Abjuration,Abjuration|Conjuration,Conjuration|Divination,Divination|Enchantment,Enchantment|Evocation,Evocation|Illusion,Illusion|Necromancy,Necromancy|Transmutation,Transmutation}}}{{description=CHATMENU}} --separator: |&nbsp; &nbsp;--title:Cantrips —&nbsp; *Save DC @{selected|spell_save_dc}* --repeating_spell-cantrip|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl-1 *(@{selected|lvl1_slots_expended}/@{selected|lvl1_slots_total})* --repeating_spell-1|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 2 *(@{selected|lvl2_slots_expended}/@{selected|lvl2_slots_total})* --repeating_spell-2|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 3 *(@{selected|lvl3_slots_expended}/@{selected|lvl3_slots_total})* --repeating_spell-3|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 4 *(@{selected|lvl4_slots_expended}/@{selected|lvl4_slots_total})* --repeating_spell-4|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 5 *(@{selected|lvl5_slots_expended}/@{selected|lvl5_slots_total})* --repeating_spell-5|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 6 *(@{selected|lvl6_slots_expended}/@{selected|lvl6_slots_total})* --repeating_spell-6|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 7 *(@{selected|lvl7_slots_expended}/@{selected|lvl7_slots_total})* --repeating_spell-7|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 8 *(@{selected|lvl8_slots_expended}/@{selected|lvl8_slots_total})* --repeating_spell-8|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School} --title:Lvl 9 *(@{selected|lvl9_slots_expended}/@{selected|lvl9_slots_total})* --repeating_spell-9|spellname|spell|spellcastingtime=?{castingtime},spellritual=?{ritual},spellconcentration=?{Concentration},spellschool=?{School}
1577124985

Edited 1577125123
So I dropped the @ at the beginning of the spell line, and that made the clutter go away, but when it does the spell no longer works. I'm trying to make a token action that will show a all of an NPC's spells in chat, that I can then cast, like this Previously, when I would click the action, everything would work, but it was prefaced in chat by this Which can be annoying if I have an NPC with 20 spells, since I'll have 20 dialogue boxes. Now those are gone, but the buttons no longer cast their spells and it looks like this Keeping it the other way it was doesn't affect function at all, I was just trying to see if I had unnecessary code that was causing the clutter.&nbsp;
1577125592
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
According to the output I am seeing, you have an extra open curly bracket in each spell command: %{{selected|repeating_spell-1_$0_spell} should be %{selected|repeating_spell-1_$0_spell} But really, you are making a lot more work than you need to. You have indicated that you tried UCM but were unable to get it to work. This UCM macro will do exactly what you are trying to do. It will even break out the innate spells and place them in their own list at the end. Put it into a macro (not an ability), make it a token macro, make sure that "All Players" have access. You only have to write this once, and all players will have access to it immediately, tailored for their sheet. It will appear at the top of the screen whenever their token is selected. !chatmenu @{selected|character_id} {template:npcaction}{{rname=@{selected|character_name}}}{{name=@{selected|class_display} @{selected|race_display}, @{selected|background}}}{{description=CHATMENU }} --separator: |&nbsp; &nbsp; --title:Eldritch Invocations --repeating_traits|name|output|name=Invocation: --title:Cantrips —&nbsp; *Save DC @{selected|spell_save_dc}* --repeating_spell-cantrip|spellname|spell --title:Lvl-1 *(@{selected|lvl1_slots_expended}/@{selected|lvl1_slots_total})* --repeating_spell-1|spellname|spell|spellprepared|innate=0 --title:Lvl 2 *(@{selected|lvl2_slots_expended}/@{selected|lvl2_slots_total})* --repeating_spell-2|spellname|spell|spellprepared|innate=0 --title:Lvl 3 *(@{selected|lvl3_slots_expended}/@{selected|lvl3_slots_total})* --repeating_spell-3|spellname|spell|spellprepared|innate=0 --title:Lvl 4 *(@{selected|lvl4_slots_expended}/@{selected|lvl4_slots_total})* --repeating_spell-4|spellname|spell|spellprepared|innate=0 --title:Lvl 5 *(@{selected|lvl5_slots_expended}/@{selected|lvl5_slots_total})* --repeating_spell-5|spellname|spell|spellprepared|innate=0 --title:Lvl 6 *(@{selected|lvl6_slots_expended}/@{selected|lvl6_slots_total})* --repeating_spell-6|spellname|spell|spellprepared|innate=0 --title:Lvl 7 *(@{selected|lvl7_slots_expended}/@{selected|lvl7_slots_total})* --repeating_spell-7|spellname|spell|spellprepared|innate=0 --title:Lvl 8 *(@{selected|lvl8_slots_expended}/@{selected|lvl8_slots_total})* --repeating_spell-8|spellname|spell|spellprepared|innate=0 --title:Lvl 9 *(@{selected|lvl9_slots_expended}/@{selected|lvl9_slots_total})* --repeating_spell-9|spellname|spell|spellprepared|innate=0 --title:Innate 1&nbsp; --repeating_spell-1|spellname|spell|innate --title:Innate 2 --repeating_spell-2|spellname|spell|innate --title:Innate 3 --repeating_spell-3|spellname|spell|innate --title:Innate 4 --repeating_spell-4|spellname|spell|innate --title:Innate 5 --repeating_spell-5|spellname|spell|innate --title:Innate 6 --repeating_spell-6|spellname|spell|innate --title:Innate 7&nbsp; --repeating_spell-7|spellname|spell|innate --title:Innate 8 --repeating_spell-8|spellname|spell|innate --title:Innate 9 --repeating_spell-9|spellname|spell|innate
1577126077
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I've gone back through your macro and re-written it into something that will work. I forgot you were putting these into command buttons, where the syntax is a little different if you are writing these as abilities that are on the same sheet as the selected character. This should work as you are envisioning: /w gm &amp;{template:default} {{name=@{selected|npc_name}'s Spells}}{{At Will=[@{selected|repeating_spell-1_$0_spellname}](~selected|repeating_spell-1_$0_spell)[@{selected|repeating_spell-1_$1_spellname}](~selected|repeating_spell-1_$1_spell)[@{selected|repeating_spell-1_$2_spellname}](~selected|repeating_spell-1_$2_spell)}} {{1/Day=[@{selected|repeating_spell-2_$0_spellname}](~selected|repeating_spell-2_$0_spell)[@{selected|repeating_spell-3_$0_spellname}](~selected|repeating_spell-3_$0_spell)}} {{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)}} {{Level 1=[@{selected|repeating_spell-1_$3_spellname}](~selected|repeating_spell-1_$3_spell)[@{selected|repeating_spell-1_$4_spellname}](~selected|repeating_spell-1_$4_spell)[@{selected|repeating_spell-1_$5_spellname}](~selected|repeating_spell-1_$5_spell)}} {{Level 2=[@{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=[@{selected|repeating_spell-3_$1_spellname}](~selected|repeating_spell-3_$1_spell)}} On a Chat Macro (which is what you are creating) the syntax for button name and ability (on same sheet) is as follows: [command name](~selected|macro to call)
The issue I was running into is that that command doesn't work for NPC sheets, and npc tokens are the only thing I need to make this work for.
1577133775
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
This is due to the way that NPC attributes are named on the official sheet (unfortunately). In the UCM thread, I give versions for PC and NPC. You can find the code here . I think you will like the output, it allows you to click a LOT more than spells. Look through the thread, I give other specialized versions as well. If you prefer the in-line links like I use, you can find the trick for doing that here .
1577136571
GiGs
Pro
Sheet Author
API Scripter
keithcurtis said: You can cast &nbsp;them using the&nbsp; Universal Chat Menu &nbsp;script, and if GiGs ever decides to quell my whining, the ability to use the script to make reports would also be possible. As it is, your script will work, but will return an error for any spell that doesn't exist on the sheet. Hehe, I'll never do that. (The bold bit, that is.)
1577142499
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
GiGs said: keithcurtis said: You can cast &nbsp;them using the&nbsp; Universal Chat Menu &nbsp;script, and if GiGs ever decides to quell my whining, the ability to use the script to make reports would also be possible. As it is, your script will work, but will return an error for any spell that doesn't exist on the sheet. Hehe, I'll never do that. (The bold bit, that is.) Beginning high-pitched exhausted-toddler-meltdown-scream...