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

Issue with macros referencing spell library character

So I'll say up front that this is a little complicated.&nbsp; Sorry! Second, very little of this is my own work.&nbsp; It's almost all cribbed from previous forum posters and YouTube tutorials.&nbsp; I wish I could remember who made all the bits, so I could thank them publicly here, but suffice it to say I'm standing on the shoulders of giants. Next, I have a Pro account.&nbsp; I think everything here just relies on basic macros that work for other subscribers too, though. Here's the setup: I've been a fan of using nested macros to handle spellcasting in D&amp;D 5e, working with the standard character sheet.&nbsp; But it's labor=intensive to build it for each individual spellcasting PC and NPC.&nbsp; So ... I created a character, "S", short for 'Spells' to house the whole shebang.&nbsp; I use three types of macros to make this work, all of which I store on "S": 1) the spellbook hierarchy, named "Spells" This produces a bunch of buttons, one for each level of spell, which is whispered to the chat.&nbsp; There, you click on the button corresponding to the level of the spell you wish to cast.&nbsp; This macro is shown as a token action.&nbsp; All the other ones are not shown; they work behind the scenes and are only accessed by buttons shown in the chat.&nbsp; This macro is universal and never changes whenever it is used.&nbsp; Here's the text: Spells ?{whisper|yes,/w gm|no,} &amp;{template:default} {{name=Spells}}{{Spell Save DC= [[8+@{selected|intelligence_mod}+@{selected|pb}]]}}{{Spell Attack Bonus=[[@{selected|intelligence_mod}+@{selected|pb}]]}}{{Spell Levels= [Cantrips](!&amp;#13;&amp;#37;{selected&amp;#124;0&amp;#125​;)[Lvl:1](!&amp;#13;&amp;#37;{selected&amp;#124;1&amp;#125​;)[Lvl:2](!&amp;#13;&amp;#37;{selected&amp;#124;2&amp;#125​;)[Lvl:3](!&amp;#13;&amp;#37;{selected&amp;#124;3&amp;#125​;)[Lvl:4](!&amp;#13;&amp;#37;{selected&amp;#124;4&amp;#125​;)[Lvl:5](!&amp;#13;&amp;#37;{selected&amp;#124;5&amp;#125​;)[Lvl:6](!&amp;#13;&amp;#37;{selected&amp;#124;6&amp;#125​;)[Lvl:7](!&amp;#13;&amp;#37;{selected&amp;#124;7&amp;#125​;)[Lvl:8](!&amp;#13;&amp;#37;{selected&amp;#124;8&amp;#125​;)[Lvl:9](!&amp;#13;&amp;#37;{selected&amp;#124;9&amp;#125​;)}} As you can see, the "Spells" is written with the "selected" tag -- for it to work, a token has to be selected.&nbsp; All of the related macros work this way -- and that's caused what looks to be the problem/issue, which I'll get to in a moment.&nbsp; But unless the forums have advice for a different route, it's the way I've been able to have a single macro work for every spellcasting PC and NPC without customizing anything. 2) The next level of the nested macros is the individual spell level list.&nbsp; These I've named for each related level:&nbsp; "0", "1", "2", etc.&nbsp; Here's an example of the cantrip level, "0": 0 ?{whisper|yes,/w gm|no,} &amp;{template:default}{{name=Spells: 0}}{{Spells= [RayFrostWand](!&amp;#13;&amp;#37;{S&amp;#124;RayfrostWand&amp;#125​;)[Firebolt](!&amp;#13;&amp;#37;{S&amp;#124;Firebolt&amp;#125​;)[Message](!&amp;#13;&amp;#37;{S&amp;#124;Message&amp;#125​;)[MinorIllusion](!&amp;#13;&amp;#37;{S&amp;#124;MinorIllusion&amp;#125​;)[Thaumaturgy](!&amp;#13;&amp;#37;{S&amp;#124;Thaumaturgy&amp;#125​;)}} As you can see, this level has to be customized to the character in question, by substituting the names of the individual spells that are in the list for the ones in the "standard" macro on the "S" sheet.&nbsp; (This particular one has a macro for a Wand of Frost, "RayFrostWand", but don't let that throw you:&nbsp; it's just a convenient way for me to include spell-like effects rather than cluttering up the screen with additional macro buttons for this sort of thing.) 3) The third level is the macro for each individual spell itself.&nbsp; I've built these to show an emote, then a gif, then the spell itself, the macro for which I found by using the up arrow in the chat window after casting the spell though a character sheet interface; if you'd prefer the simpler version, you could shave off the first two parts.&nbsp; It's a little inelegant at the moment, in that the emote doesn't automatically conform to the gender of the caster:&nbsp; something for me to work on fixing in the future.&nbsp; Each of these macros lives on the "S" character and only there.&nbsp; Here's an example, for Message: Message /em twirls a short piece of copper wire and whispers into his cupped hand.... &amp;{template:desc} {{desc=[x](<a href="https://c.tenor.com/obQiLDg1s_YAAAAC/boss-baby-movie-its-a-secret.gif" rel="nofollow">https://c.tenor.com/obQiLDg1s_YAAAAC/boss-baby-movie-its-a-secret.gif</a>)}} @{selected|wtype}&amp;{template:spell} {{level=transmutation cantrip}} {{name=Message}} {{castingtime=1 action}} {{range=120 feet}} {{target=A creature within range}} {{v=1}} {{s=1}} {{m=1}} {{material=A short piece of copper wire}} {{duration=1 round}} {{description=[ ](<a href="https://media.giphy.com/media/AMmFvTM9VH1qy7WljJ/giphy.gif" rel="nofollow">https://media.giphy.com/media/AMmFvTM9VH1qy7WljJ/giphy.gif</a>) You point your finger toward a creature within range and whisper a message. The target (and only the target) hears the message and can reply in a whisper that only you can hear. You can cast this spell through solid objects if you are familiar with the target and know it is beyond the barrier. Magical silence, 1 foot of stone, 1 inch of common metal, a thin sheet of lead, or 3 feet of wood blocks the spell. The spell doesn’t have to follow a straight line and can travel freely around corners or through openings.}} {{athigherlevels=}} 0 {{innate=}} {{savedc=@{selected|spell_save_dc}}} 0 @{selected|charname_output} This type of macro works for all PCs and NPCs, whenever it is referenced in the nested macro structure. And now to the problem:&nbsp; for certain spells, which use attack or damage rolls, the spell library approach fails for some reason.&nbsp; Apparently, there's something in the macro that is unique to the caster.&nbsp; For example, here's the macro for Absorb Elements from a high level Diviner (named Urhan the Black): %{-NgQ5MRH03ujIY6QEAHU|repeating_attack_-NjTX2UQy1rT2djgas7a_attack} And the same macro for one of his bodyguards, Eldritch Knights (called God-Emperor's Chosen-Footman): %{-Nj6ivnDXSuWk9QIeJ2K|repeating_attack_-NjDeAvHkYGDZ1reauhZ_attack} For the "S" library, I've entered this macro by replacing the portion before the pipe character with "selected", so it looks like this: /em makes a warding gesture, blunting the attack! &amp;{template:desc} {{desc=[x](<a href="https://media.giphy.com/media/bcJvDLgxVSPulkDYB4/giphy.gif" rel="nofollow">https://media.giphy.com/media/bcJvDLgxVSPulkDYB4/giphy.gif</a>)}} %{selected|repeating_attack_-NjTX2UQy1rT2djgas7a_attack} As you can see, the version I've used is the one that comes from the Urhan the Black character sheet. When I then trigger the spell using the nested macro approach, it casts without a problem if Urhan is the "selected" token. However, if I select one of the&nbsp; God-Emperor's Chosen-Footman and trigger the nested macro, only the emote and gif appear.&nbsp; The spell effect doesn't.&nbsp; Nor does an error message. So, finally, to my question:&nbsp; for this type of spell, is there a way to create a macro that can live on the "S" character sheet which will work properly no matter which token accesses it?&nbsp; Help!
Screenshots would be helpful. What does a PC or NPC spell sheet look like? Do you have any spells loaded onto their spell list, or none? If not, then how do you know which spells each character has access to? I also see that you are using the 'default' template for two of the menus, and then the 'desc' and 'spells' template for the last one. Is that just an aesthetic preference, or is there a reason you don't want to use other D&amp;D 5E templates? (Such as 'npcaction') I think you are using more html substitutions than are necessary, but it's hard to tell without seeing the entire setup. It looks like you're trying to do something similar to a Universal Macro Mule , but instead of saving the spells on each character, you are saving all of the spells each as an Ability on the 'S' character, and then each PC and NPC has a custom Ability to reference only the spells that PC or NPC is supposed to have access to?&nbsp; That seems like a LOT of extra work. And then you also don't get the functionality of tracking spell slots.&nbsp; But maybe I'm misunderstanding.
For some reason when I try to reply, I get the Page Not Found error.&nbsp; I'm going to try it again without the screenshots and see if that's the issue: I was not familiar with the Universal Macro Mule; thanks for pointing that out.&nbsp; I spent a little time looking at it yesterday, and it's really a work of art.&nbsp; I can't begin to imagine how much time you must have invested to build it.&nbsp; It's magnificent!&nbsp; The only constructive criticism I can offer is that the cap of 10 for spells per level is too restrictive:&nbsp; I'd double it. It's a really elegant way of porting character sheets to the chat interface, so you can play the game without needing to use a sheet.&nbsp; I'm looking to do something similar, but on a much smaller scale (just for spells), but with two twists:&nbsp; A) I'm looking to expand what's available on the character sheet in terms of what happens when you "cast" a spell, by adding some or all of: i. emote text ii. a suitable gif iii. FX and then hanging the full spell text (and attack, if it's that kind of spell) onto the end of this train. B) Doing this once and only ever once for each spell, rather than needing to do this on each character sheet.&nbsp; Essentially creating a spell dictionary or, if you like, the spell chapter from the Player's Handbook by using a character as a Spell Mule.&nbsp; Other characters then use a short call to reference the spell dictionary which, for convenience, I've put into nested macros that appear in the chat window, so that using character sheets isn't necessary. The Macro Mule does a fantastic job of solving this last part.&nbsp; My hope is that, with the right macro code, I can get the first part to work (the spell "dictionary").&nbsp; Please don't let the formatting throw you: that's heritage from the original authors.&nbsp; Once I get the functionality to work, I'll clean up the templating.
1700489021

Edited 1700489120
Jarren said: Screenshots would be helpful. What does a PC or NPC spell sheet look like? Do you have any spells loaded onto their spell list, or none? If not, then how do you know which spells each character has access to? To your specific questions, a spell sheet is just a character.&nbsp; I've not picked whether it's a PC or NPC it's just the default that appears when you open a new character in R20; I just use the Abilities section to store the macros for the entire setup, and named the character "S" so it's quick to type in its name when referencing it in a macro. Characters do have spells loaded into their spell lists -- but that's a legacy based on what I've already built.&nbsp; If I get this to work properly, that wouldn't be necessary.&nbsp; The specific spell selection lives in the 2nd level macro.&nbsp; The process for a new character would be: Copy the 1st and 2nd level macros (the "index" that lets you pick which spell level you want and one for each spell level, "0" to "9" onto a new character sheet, one each for PC and NPC.&nbsp; Then, every time you want to make a new character with spellcasting, you duplicate this basic sheet and edit the duplicate by inserting the names of the spells the character has (or updating as the game goes on and new spells are acquired).&nbsp; How do you know what spells the character has access to?&nbsp; You either open the macro and read it or run the macros and see them in the chat window. I seem not to be able to upload screenshots without crashing the interface and getting the Page Not Found error.&nbsp; There must be a way to do that, but just pasting them into the Reply box seems to be too challenging for the interface.&nbsp; Are there particular screenshots that would be helpful?
1700507297

Edited 1700592983
Posting photos in the forums Alex B. said: For some reason when I try to reply, I get the Page Not Found error.&nbsp; I'm going to try it again without the screenshots and see if that's the issue: I seem not to be able to upload screenshots without crashing the interface and getting the Page Not Found error.&nbsp; There must be a way to do that, but just pasting them into the Reply box seems to be too challenging for the interface.&nbsp; Are there particular screenshots that would be helpful? I'm not sure why uploading photos would be an issue.&nbsp; Are you dragging and dropping the images, or using the 'picture upload' button? I've always used drag-and-drop and I've never had an issue.&nbsp; Something for you to troubleshoot I guess!&nbsp; Also be careful with character limits on each individual post - I've run into that problem before.&nbsp; It may be that it's actually a data size limit (so each character is a few bytes, but a picture will be several KB) and adding photos is causing the post to fail.&nbsp; Maybe try just posting a standalone photo and see if it works. Universal Macro Mule spells list Alex B. &nbsp;said: I was not familiar with the Universal Macro Mule; thanks for pointing that out.&nbsp; I spent a little time looking at it yesterday, and it's really a work of art.&nbsp; I can't begin to imagine how much time you must have invested to build it.&nbsp; It's magnificent!&nbsp; The only constructive criticism I can offer is that the cap of 10 for spells per level is too restrictive:&nbsp; I'd double it. I can pretty easily add additional spells per level, though as I say in the forum thread, 10 spells per level should cover 95% of use cases.&nbsp; Adding more spells per level can slow down Roll20 from reading the sheet (at least historically; there has been a lot of work to help speed up things like that). Edit: I'm working on an update that will list more spells per level. Currently it's maxing out at 15 spells per level because it's breaking my Excel spreadsheet to include more (the CONCAT function is giving me a CALC error because it's going over the character limit). I'm also adding functionality to include a message if there are additional spells that are not shown per level (and I'll add the same functionality for attacks, items, etc. when I have time) so if the current Macro Mule doesn't show everything, then there will be an indication of needing to increase the number for that category. Demo here: Initially I started the Macro Mule with only NPCs in mind, and I don't know of any NPC spellcasters with more than 10 spells per level.&nbsp; I can definitely understand PCs having additional spells per level (such as a wizard trying to fill out their spellbook). Purpose of Spells Macro Mule Alex B. &nbsp;said: A) I'm looking to expand what's available on the character sheet in terms of what happens when you "cast" a spell, by adding some or all of: i. emote text ii. a suitable gif iii. FX and then hanging the full spell text (and attack, if it's that kind of spell) onto the end of this train. B) Doing this once and only ever once for each spell, rather than needing to do this on each character sheet.&nbsp; Essentially creating a spell dictionary or, if you like, the spell chapter from the Player's Handbook by using a character as a Spell Mule.&nbsp; Other characters then use a short call to reference the spell dictionary which, for convenience, I've put into nested macros that appear in the chat window, so that using character sheets isn't necessary. Ah yeah, I can understand that using a 'Spells' Macro Mule will allow you to add the additional emote/gif/FX instead of putting that on each individual character sheet for each spell. But you'll still have to individually add spells to each character, so it won't save that step, and it will take a LOT of setup time initially. Spells on PCs and NPCs' sheets&nbsp; Alex B. &nbsp;said: To your specific questions, a spell sheet is just a character.&nbsp; I've not picked whether it's a PC or NPC it's just the default that appears when you open a new character in R20; I just use the Abilities section to store the macros for the entire setup, and named the character "S" so it's quick to type in its name when referencing it in a macro. Characters do have spells loaded into their spell lists -- but that's a legacy based on what I've already built.&nbsp; If I get this to work properly, that wouldn't be necessary.&nbsp; The specific spell selection lives in the 2nd level macro.&nbsp; The process for a new character would be: Copy the 1st and 2nd level macros (the "index" that lets you pick which spell level you want and one for each spell level, "0" to "9" onto a new character sheet, one each for PC and NPC.&nbsp; Then, every time you want to make a new character with spellcasting, you duplicate this basic sheet and edit the duplicate by inserting the names of the spells the character has (or updating as the game goes on and new spells are acquired).&nbsp; How do you know what spells the character has access to?&nbsp; You either open the macro and read it or run the macros and see them in the chat window. When I asked, "What does a PC or NPC spell sheet look like?" what I meant was not the Spells 'S' Macro Mule character, but your players' characters and any NPC characters.&nbsp; It sounds like eventually you would not have any spells on&nbsp; their &nbsp;Spells tab at all. Attribute references Alex B. &nbsp;said: And now to the problem:&nbsp; for certain spells, which use attack or damage rolls, the spell library approach fails for some reason.&nbsp; Apparently, there's something in the macro that is unique to the caster.&nbsp; For example, here's the macro for Absorb Elements from a high level Diviner (named Urhan the Black): %{-NgQ5MRH03ujIY6QEAHU|repeating_attack_-NjTX2UQy1rT2djgas7a_attack} And the same macro for one of his bodyguards, Eldritch Knights (called God-Emperor's Chosen-Footman): %{-Nj6ivnDXSuWk9QIeJ2K|repeating_attack_-NjDeAvHkYGDZ1reauhZ_attack} You're going to run into another issue: for any spells that have an attack roll or Spell Save DC, you will need the spell to reference attributes from the&nbsp; character that is casting the spell , and not the attributes from the 'S' character.&nbsp; That is what is happening with your macro here.&nbsp; Doing this correctly will take a lot of manual work to set up each spell correctly on the 'S' character, and each spell will have to be manually built as an Ability and not listed on the spells section of the 'S' character sheet. Part of the reason that your macro is not working is because you're not referencing a spell; you're referencing an attack roll (from the PC sheet).&nbsp; And there are two parts to those references: the character ID (the first part such as '-NgQ5MRH03ujIY6QEAHU' and the repeating attack ID (such as '-NjTX2UQy1rT2djgas7a'). Both of those references are unique to each character.&nbsp; '-NjTX2UQy1rT2djgas7a' is not the reference for Absorb Elements universally; it is the reference for the Absorb Elements 'attack' on Urhan the Black's sheet specifically.&nbsp; But the same thing will hold true for spell references directly as well. The attack that is created from the spell pulls data (To Hit, Damage, etc.) from the spell item, but the references are different. That's not to say that what you're trying to do is not possible.&nbsp; It will be a LOT of work to set it up, and will require manually adjusting each character's spell list as Abilities instead of being able to use the built-in spell list functionality (and compendium drag-and-drop).&nbsp; &nbsp; Or there may be another way that is a bit easier to set up and create a Macro Mule character for that will still give you the functionality that you're looking for. My suggestion: use CustomizableRollListener instead Another option could be to simply use CustomizableRollListener to add the emote/gif/FX when a specific spell is cast into the chat.&nbsp; That way you would literally set each spell up a single time in CRL, and it would work for all NPCs and PCs, and you would otherwise use the character sheets and spells normally. Really what would be simplest is a&nbsp; custom compendium , where you could modify spells to include the emote/gif/FX commands and put them into your own compendium, and pull them out onto each character's sheet instead of having to recreate that functionality.&nbsp; But custom compendiums are something that has been requested for a long time, and may not ever happen due to copyright concerns.
1700528670
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Re: Posting images on the forum There are some quriks. Drag and drop - works Using the import button - works Copying and pasting from an image that is already online - usually works. Copying and pasting from an image that is from your computer - fails. I have always assumed there is some metadata issue that is satisfied by copying and pasting from an online image but not by copying and pasting from your computer (say directly from an image processing program).
Jarren said: Universal Macro Mule spells list Alex B. &nbsp;said: I was not familiar with the Universal Macro Mule; thanks for pointing that out.&nbsp; I spent a little time looking at it yesterday, and it's really a work of art.&nbsp; I can't begin to imagine how much time you must have invested to build it.&nbsp; It's magnificent!&nbsp; The only constructive criticism I can offer is that the cap of 10 for spells per level is too restrictive:&nbsp; I'd double it. I can pretty easily add additional spells per level, though as I say in the forum thread, 10 spells per level should cover 95% of use cases.&nbsp; Adding more spells per level can slow down Roll20 from reading the sheet (at least historically; there has been a lot of work to help speed up things like that). Edit: I'm working on an update that will list more spells per level. Currently it's maxing out at 15 spells per level because it's breaking my Excel spreadsheet to include more (the CONCAT function is giving me a CALC error because it's going over the character limit). I'm also adding functionality to include a message if there are additional spells that are not shown per level (and I'll add the same functionality for attacks, items, etc. when I have time) so if the current Macro Mule doesn't show everything, then there will be an indication of needing to increase the number for that category. Demo here: As an FYI I just updated the MacroMule script to include 15 spells per level and include the 'Not Shown' message if you end up with more spells than that on a character. I can look later at how to increase that further, but this was a quick update that I could do in the meantime.
That's fantastic!&nbsp; I think the utility is more in the lower levels anyway, so if you feel it slows down things too much, you're probably fine to leave the higher levels alone.