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

Help with an ability macro

1721467709

Edited 1721482284
I have a player that is trying to channel cantrips into his weapon to change the damage type of the weapon and add the rider effect of the cantrip, if any. I am trying to make a ability macro that uses a query to return damage type, spell save, and Effect based on a spell selected on the list. I can get the templet to return one of the 3 pieces of information but I cant get all three.   BASE TEMPLATE &{template:atkdmg} {{mod=mod}} {{rname=Spellstrike}} {{range=5 feet}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[d8+@{Dexterity_Mod}]]}} {{dmg1type=PH1}} {{save=1}} {{saveattr=PH2}} {{savedesc=Disadvantage on save}} {{savedc=[[8+@{PB}+@{Intelligence_mod}]]}} {{desc=PH3}} {{hldmg=hldmg}} {{spelllevel=spelllevel}} {{ammo=ammo}} {{charname=@{character_name}}} DAMAGE TYPE PH1 = ?{Spell|Acid Splash,Acid|Chill Touch,Necrotic|Fire Bolt,Fire|Frostbite,Cold|Glitterbeam,Radiant|Lightning Lure,Lightning|Poision Spray,Poison|Ray of Frost,Cold|Shocking Grasp,Lightning|Sword Burst,Force} SPELL SAVE TYPE PH2 =  ?{Spell|Acid Splash,Dexterity |Chill Touch,No|Fire Bolt, No|Frostbite,Constitution |Glitterbeam,No|Lightning Lure,Strength |Poision Spray,Constitution|Ray of Frost,No|Shocking Grasp,No|Sword Burst,Dexterity} EFFECT DESCRIPTION PH3 =  ?{Spell|Acid Splash,None |Chill Touch,Creature can't regain hitpoints untill the start of your next turn, if undead also has disadvantage on attack rolls against you until the end of your next turn. |Fire Bolt, A flammable object hit by this spell ignites if it isn't being worn or carried. |Frostbite,Creature has disadvantage on its next weapon attack it makes before the end of it's next turn. |Glitterbeam,Until Creature uses an action to remove the glitter it glows and has disadvantage on Desterity (Stealth) to hide or conceal itself. |Lightning Lure,Target is pulled up to 10 feet in a straight line toward you. |Poision Spray,None |Ray of Frost,target's speed is reduced by 10 feet until the start of your next turn |Shocking Grasp,You have advantage on the attack roll if the target is wearing armor made of metal.Target can't take reactions until the start of its next turn|Sword Burst,None} If i use two of the above at the same time I get It is pulling the information from PH1 and applying it to both areas. What I am looking for it to do is give me a choice Choose frostbite for instance and then return the changes Any help is appreciated
Unfortunately the  Roll20 Roll Query system  only allow for a single option to be selected/output from each unique query within a chat message.  Each query can only be 'used once' - you cannot have different outputs based on a single input (query name).   All of your queries have the same name, but only the outputs from the first query are used.  As an example, these two macros will have the same output: ?{Query Name|Item A,OutputA|Item B,Output B) ?{Query Name|Item C,OutputC|Item D,Output D)  ?{Query Name|Item A,OutputA|Item B,Output B) ?{Query Name)  If you run either macro you'll only be prompted a single time, and if you choose 'Item A', then you'll get 'Output A Output A' in chat.  There are two workarounds: using HTML entity replacements, which in your case will be fairly complex, or using chat menus. If you provide some more details on the specific spell effects and how the cantrips work (describe them how you would describe them in person NOT using Roll20 - the game mechanics are important, not how you are trying to solve them on Roll20) then there may be other better ways to accomplish what you are trying to do.
1721491263

Edited 1721491299
timmaugh
Pro
API Scripter
Hi, Xakleu... sorry if this aims beneath your knowledge... If you use a query, every time you reference that query later, you get the same answer. So if you do: First I like ?{Color|Blue|Red|Orange} but then I like ?{Color}. You will get the same color in both places in the line. You have a couple of options for getting around this. 1) Use different queries in the different places. One can be "Spell Damage Type," one "Spell Description," and one "Spell Save." The downside is you'll have to make 3 choices -- all choosing the same thing -- every time you use the command. You'd have to pick Acid Splash for the damage type, then Acid Splash for the description, and then one more time Acid Splash for the save. 2) You can embed ALL of the template syntax that would span from the first query to the last query in a single query. That is... all of this: PH1}} {{save=1}} {{saveattr=PH2}} {{savedesc=Disadvantage on save}} {{savedc=[[8+@{PB}+@{Intelligence_mod}]]}} {{desc=PH3 ...would be in the query, and it would be in there multiple times (once for each option). The Acid Splash option would have "Acid" for PH1, "Dexterity" for PH2, and the Acid Splash description for PH3. The downside of this method is that you have to perform HTML substitutions on the above snippet so that it doesn't break your query. Every right brace that isn't a part of an attribute or ability call would need to become }, every comma would become ,, and every pipe character not part of an attribute or ability call would become |. Not only is that a pain, but it makes the final command line a lot less readable if you ever need to edit it, later. 3) You can use scripts and use a single query to drive multiple responses. Either ScriptCards or the Metascript Toolbox can do something like this. Metascript Solution To utilize this solution, you'll need the Metascript Toolbox installed in your game. We're going to break out the queries into tables we can later reference, so to begin, we're going to set up a character to act as a mule for all of this info. Let's call that character "LibraryCharacter." On this character we'll create an ability for each query we want to service... so one for SpellDamageType, one for SpellDescription, and one for SpellSave. Set them up like this example for SpellDamageType: AcidSplash=Acid ChillTouch=Necrotic FireBolt=Fire Frostbite=Cold Glitterbeam=Radiant LightningLure=Lightning PoisonSpray=Poison RayofFrost=Cold ShockingGrasp=Lightning SwordBurst=Force Think of this as a key/value pair. The key has no spaces, followed by an equal sign. Use these same no-space-key designations for the other abilities. So the SpellSave entry for Acid Splash would look like: AcidSplash=Dexterity We've used the same keys across all 3 abilities (each of them use "AcidSplash"... each of them use "RayofFrost", etc.). Now we're going to modify your command line that will use a single query return but reference each of these different mule-tables. First, the query we'll use will now connect the spells with their no-space-key versions: ?{Spell|Acid Splash,AcidSplash|Chill Touch,ChillTouch|Fire Bolt,FireBolt|Frostbite,Frostbite|Glitterbeam,Glitterbeam|Lightning Lure,LightningLure|Poison Spray,PoisonSpray|Ray of Frost,RayofFrost|Shocking Grasp,ShockingGrasp|Sword Burst,SwordBurst} Then, anywhere we need to pull info from a mule table, we'll use the query as our "key" in a "get" statement: get.character name.mule-ability.key/get So, to get the damage type (PH1), we'd use: get.LibraryCharacter.SpellDamageType.?{Spell}/get Finally, in order to get the metascripts to work, we have to start the line with a bang. Then, to get it to output to chat, we need to include a {&simple} in the line. Remembering that the FIRST time you encounter a query, you have to include the options but every time after that you don't have to, your final command line should look more like this: !&{template:atkdmg} {{mod=mod}} {{rname=Spellstrike}} {{range=5 feet}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[d8+@{Dexterity_Mod}]]}} {{dmg1type=get.LibraryCharacter.SpellDamageType.?{Spell}/get}} {{save=1}} {{saveattr=get.LibraryCharacter.SpellSave.?{Spell}/get}} {{savedesc=Disadvantage on save}} {{savedc=[[8+@{PB}+@{Intelligence_mod}]]}} {{desc=get.LibraryCharacter.SpellDescription.?{Spell}/get}} {{hldmg=hldmg}} {{spelllevel=spelllevel}} {{ammo=ammo}} {{charname=@{character_name}}} {&simple}
1721519430

Edited 1721520440
There is a way, though it is a lot of setup - what you need to do is set up a character sheet for each spell, have all the attributes for them set  up in those sheets, and have your query output not the template, but a button with that template within it. What your query does in this scenario is complete the attribute calls for the spells, so  |damage} and  |description} for instance both get completed by @{acid splash from your query, and clicking the button in the chat finishes the attribute calls and prints them out to chat. This method is fairly complicated, though, and you need to do a whole lot of html replacements for it to work - I just spent an evening troubleshooting something similar for a macro of my own. EDIT: A much easier way is to nest queries - so your first query is ?{spell? |, and for each of the entries, nest three more queries, named ?{damage type?, ?{spell save type? |  and ?{effect description |, with the information you want for that specific spell for that specific field after the bar - then, you place this query between the template rows right after the first so that it's not displayed, and place second copies of those three queries as ?{damage type?}, ?{spell save type?} and ?{effect description?} in the template where you want them - and when you select a spell and click through the three follow-up queries, which already have the correct information filled in, that information gets filled in in your macro. Though you do have to do some simple html replacement in those nested queries - namely, every one of {}, | has to be replaced for the query around them to complete.
1721534603

Edited 1721535351
OR... you could take the simple approach and just put all the variables in the description and just have one query.  I'm making a couple of assumptions since you left out some details in your post:  1) Since they are attacking with a weapon there is an attack roll.  2) The damage die vary with the cantrip used.  3) If the spell has a saving throw it is used to determine if any secondary effects take place.  Here is a partial query that I used for testing: ?{Spell|Acid Splash,**Acid Splash** On a hit the target takes [[2d6]] acid damage.|Chill Touch,**Chill Touch** On a hit the target takes [[2d8]] necrotic damage and it can’t regain hit points until the start of your next turn. Undead targets also have disadvantage on attack rolls against you until the end of your next turn.|Fire Bolt,**Fire Bolt** On a hit the target takes [[2d10]] fire damage. A flammable object hit by this spell ignites if it isn’t being worn or carried.|Frost Bite,**Frost Bite** On a hit the target takes [[2d6]] cold damage and must make a DC @{spell_save_dc} CON save or have disadvantage on the next weapon attack roll it makes before the end of its next turn.} Sample output: A couple of additional notes:  I just manually added an attack and pasted the query in the description rather than creating a template.  Don't include commas or pipes in the returned text or they will break the query.
For more clarity of what I am needing, and all of these are helpful I think I understand most of it, is the player is using a homebrew class. This class has the ability to apply spells to his weapon, where he hits with the weapon and does damage as the weapon, but the damage type and potential spell riders will still apply.  So it basically makes all his spells act like a booming blade or green-flame blade type of spell. For cantrips it does not add the damage, but just the rider effect and the damage type. If the spell requires an attack roll it is ignored because you already hit with the weapon, if it needs a save then the target has disadvantage on the save. For example lets say you are using a long sword (1D8/1D10), the damage does not change but if you apply acid spray it will change the damage type from slashing to acid.  If you use shocking grasp you get a lightning damage type and has advantage against metal armor and the target cant use reactions. You can use any spell available to the class for this feature but the spell is used if the weapon attack hits or not. I figure that using the cantrips to start would be a good start, since using leveled spells would have the same procedure mostly. 
If you post the exact details of the homebrew class abilities it’ll be easier to give you a specific answer. But otherwise it sounds like you could look for Booming Blade or Green Flame Blade solutions for something similar. 
Thank you for the help, the code is ugly but it works.