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

How do I get shorter Spell Input Strings? (I don't know what they're actually called)

I would like to preface this with a disclaimer that I am not terribly proficient with computers, and my blind and unguided prodding into how these macros work is effectively my only experience with any kind of coding. I have no idea what I am asking for is actually called, so I have overexplained what I am doing to hopefully make it as clear as possible. I apologize for the ambiguity created by my lack of familiarity with the appropriate terminology. I have purchased the Curse of Strahd module through the marketplace. The tokens accompanying it are amazing and have their attacks, spells, saving throws, and everything else listed as token actions. Above is what the "Spells" token action layout looks like in the chat, and below are the outputs for the attack and non-attack spells.  I am attempting to edit some of the tokens, in two specific ways. One group of tokens I am *adding* a spellcasting table as shown above, and the other I am  *modifying* the existing spell table. I initially attempted going into the character sheet, and then into the "Attributes and Abilities" tab of a character that does have a spellcasting table attached, copying the text of the macro, and pasting it into a new macro on the character needing new spells. Upon testing the new macro, it *appeared* to pull up the table, but every single spell is broken and only shows " Abjuration [spell level]", as shown in the picture below.  Upon inspection of different spellcasting tables from different tokens, I found that each table had a different... reference number? For example, these are (what I assume to be) the reference codes that the macro is inputting into the chat for me, from two separate tokens.     [Ray of Frost](~repeating_spell-cantrip_-NQS56oVt4Z244CtM6qf_spell)      [Ray of Frost](~repeating_spell-cantrip_-NQWRM-6lH457WQSyrQs_spell) I wondered if it had something to do with the fact that those tables somehow interacted with the character sheet, since I know you can click on the stuff on a character sheet for PCs and NPCs to have it throw the result/description in chat similarly to how the tables from the token action do. I set up the spellcasting on the character by checking the "Spellcasting NPC" option, set the spellcasting ability/caster level, and dragged and dropped the desired spells from the compendium to the character sheet. Now, I can click the spells on the sheet and it throws attack+damage/description into chat. I know you can press the arrow keys to highlight previous chat entries, and I get this string for an attack spell from the newly spellcasting character (ray of frost):      %{-NQaxmOuqiDjlAPnnMHg|repeating_attack_-NjfbkmR6YocFzJpeBK-_attack} I removed everything before "repeating_attack..." and replaced the string behind " [Ray of Frost](~" in the imported macro, and it successfully made the attack/damage roll, and the "Show Spell Description" button functions correctly. Attack spells figured out! Now, the issue I need help resolving is the spells that don't output an attack, like Mage Hand. When I press the up arrow to get the chat input, it's very long and includes every aspect of the spell, instead of a concise string like the attack spells. The macros on the existing spellcasting tokens exclusively have the condensed reference codes and I am wondering how to get these to put into the macros on the newly spellcasting characters.  Thanks for taking the time to read this! I explained how I got to where I was so there's some context for the question and how I have approached everything, and where my knowledge might be lacking. I fully expect that this is an incredibly trivial issue to solve and I'm just missing some button somewhere.          
1700486600

Edited 1700489984
Hi Andrew, I feel your best bet is to have a more generic spellbook for your PCs and NPCs, that way it will pull up the spells that are chosen on any one PC/NPC sheet rather than having to code individual buttons to meet the spells you have selected.&nbsp; This was the basic format of what I used to use, you may still prefer to do this: &amp;{template:default}{{name=@{selected|character_name} Spellcasting }}{{ Spell DC @{selected|spell_save_dc} = @{selected|spell_attack_bonus} to hit with spell attacks }}{{ Cantrips = [@{selected|repeating_spell-cantrip_$0_spellname}](~selected|repeating_spell-cantrip_$0_spell) }}{{ 1st (SLOTS) = [@{selected|repeating_spell-1_$0_spellname}](~selected|repeating_spell-1_$0_spell) }}{{ = [@{selected|repeating_spell-1_$1_spellname}](~selected|repeating_spell-1_$1_spell) }}{{ 2nd (SLOTS) = [@{selected|repeating_spell-2_$0_spellname}](~selected|repeating_spell-2_$0_spell) }}{{ 3rd (SLOTS) = [@{selected|repeating_spell-3_$0_spellname}](~selected|repeating_spell-3_$0_spell) }} you will need to add extra lines to suit (eg if there are two 1st level spells, you need to have another line as per the example above, increasing the number value in two places each time) I used to do it, but now have a macro mule that carries a better version around from game to game for me.&nbsp; I would seriously recommend you do the same, Gauss and Jarren both make their mules widely available, hopefully they will drop in later and post links.&nbsp; Just an example, I went in to CoS, dragged a Dretch to the map, opened it, selected Spellcasting NPC as you have done, then dragged fireball, ray of frost and mage hand from the compendium.&nbsp; MAKE SURE you tick the radio button to show spells are prepared, but that's it, literally seconds.&nbsp; Then when I click the generic spellbook button in my macro bar (with the dretch selected) I get this , with the second image being what I get if I select Entire Spell List: more info on macro mules here: - <a href="https://wiki.roll20.net/Macro_Character_Sheet" rel="nofollow">https://wiki.roll20.net/Macro_Character_Sheet</a>
1700493027

Edited 1700493316
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Andrew! I agree that without access to scripts, the Macro Mules mentioned above are the best way to go. Copying and pasting the pre-generated Ability code as you describe in your post will never work. Everything in Roll20, every token, sheet, attribute, audio track, etc, has a unique ID. If you duplicate a character, all of its attributes have new IDs.&nbsp; In the Ray of Frost action you posted: &nbsp;%{-NQaxmOuqiDjlAPnnMHg|repeating_attack_-NjfbkmR6YocFzJpeBK-_attack} the character referenced is the one with the ID of: &nbsp; -NQaxmOuqiDjlAPnnMHg And the ability on that sheet has an ID of: -NjfbkmR6YocFzJpeBK Those are unique to that character in all of Roll20. They don't transfer. The whole code could be written with more readable, relative references. Let's say the character was named "Bob" and the repeating attack was the first one on the list. It could be written as: &nbsp; %{Bob|repeating_attack_$0_attack} In this case "Bob" identifies the character, and $0 references the line number on the list of attacks on the sheet (because JavaScript starts counting with zero.) Lastly, you could make it a bit more generic with using the "selected" keyword. This means the code doesn't care who the ability belongs to, it will just use the character belonging to the currently selected token. This works well with Token Action Buttons (the ones across the top of the VTT), since they don't even appear unless you have that token selected: &nbsp; %{selected|repeating_attack_$0_attack} This is the approach used by most Macro Mule solutions, since it is easily transported from character to character.
1700493235
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
For completeness' sake, I should mention that the Token Actions in official Roll20 modules for 5e and PF2 were created by the script Token Action Maker . All Pro level subscribers have access to this script. Generating ALL of the token actions you typically see in a module is as quick as selecting one or more tokens and typing "!ta" in chat. It's that quick.
1700508134

Edited 1700713118
Simon G. said: I used to do it, but now have a macro mule that carries a better version around from game to game for me.&nbsp; I would seriously recommend you do the same, Gauss and Jarren both make their mules widely available, hopefully they will drop in later and post links.&nbsp; Just an example, I went in to CoS, dragged a Dretch to the map, opened it, selected Spellcasting NPC as you have done, then dragged fireball, ray of frost and mage hand from the compendium.&nbsp; MAKE SURE you tick the radio button to show spells are prepared, but that's it, literally seconds.&nbsp;&nbsp; Here's the link to my Universal Macro Mule . If you have a free account you are allowed three Character Vault transfers per game, so you could use that to import the Macro Mule character into your game and you should be all set in a few minutes. And FYI I just updated the Macro Mule today (Weds 11/22/23) as well.
Well I thought I posted a response last week but it seems roll20 didn't like me posting from my phone. I got the mule exported into my game and i have the macros on my macro bar and I think I'm getting to where I want to be. Thanks for the help everyone!