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

Spells

I have created a number of macros for individual spells, but to avoid having too many macros as token actions I want to place them in the spell list, and then have a macro that gives you a drop down menu for all your spell, which would then roll the macros set in the spell list. So, my question is, how can you reference a spell macro from the spell list in another macro that is put as a token action?
1501923028
Ziechael
Forum Champion
Sheet Author
API Scripter
This is how i handle it currently... each spell is a macro in the collections tab so I put this as a token action which uses nested drop down menus to produce a button in the chat for the player to click to actually cast the spell without having to clutter their character: /w "@{selected|character_name}" ?{What Level| 0,?{Spell| Create Water,[Create Water](!
#createwater)| Cure Minor Wounds,[Cure Minor Wounds](!
#cureminorwounds)| Detect Magic,[Detect Magic](!
#detectmagic)| Flare,[Flare](!
#flare)| Know Direction,[Know Direction](!
#knowdirection)| Light,[Light](!
#light)| Mending,[Mending](!
#mending)| Read Magic,[Read Magic](!
#readmagic)| Resistance,[Resistance](!
#resistance)}| 1,?{Spell| Aspect of the Wolf,[Aspect of the Wolf](!
#aspectofthewolf)| Aura Against Flame,[Aura Against Flame](!
#auraagainstflame)| Calm Animals,[Calm Animals](!
#calmanimals)| Cure Light Wounds,[Cure Light Wounds](!
#curelightwounds)| Enrage Animal,[Enrage Animal](!
#enrageanimal)| Entangle,[Entangle](!
#entangle)| Faerie Fire,[Faerie Fire](!
#faeriefire)| Goodberry,[Goodberry](!
#goodberry)| Lesser Vigor,[Lesser Vigor](!
#lesservigor)| Longstrider,[Longstrider](!
#longstrider)| Metal Fang,[Metal Fang](!
#metalfang)| Produce Flame,[Produce Flame](!
#produceflame)| Snakes Swiftness,[Snakes Swiftness](!
#snakesswiftness)| Speak with Animals,[Speak with Animals](!
#speakwithanimals)| Winter Chill,[Winter Chill](!
#winterchill)}| 2,?{Spell| Animalistic Power,[Animalistic Power](!
#animalisticpower)| Barkskin,[Barkskin](!
#barkskin)| Bite of the Wererat,[Bite of the Wererat](!
#biteofthewererat)| Blinding Spittle,[Blinding Spittle](!
#blindingspittle)| Briar Web,[Briar Web](!
#briarweb)| Bull's Strength,[Bull's Strength](!
#bullsstrength)| Cat's Grace,[Cat's Grace](!
#catsgrace)| Chill Metal,[Chill Metal](!
#chillmetal)| Decomposition,[Decomposition](!
#decomposition)| Easy Trail,[Easy Trail](!
#easytrail)| Flame Blade,[Flame Blade](!
#flameblade)| Flaming Sphere,[Flaming Sphere](!
#flamingsphere)| Frost Breath,[Frost Breath](!
#frostbreath)| Healing Sting,[Healing Sting](!
#healingsting)| Heat Metal,[Heat Metal](!
#heatmetal)| Hold Animal,[Hold Animal](!
#holdanimal)| Lesser Restoration,[Lesser Restoration](!
#lesserrestoration)| Master Air,[Master Air](!
#masterair)| Metal Fang,[Metal Fang](!
#metalfang)| Nature's Favour,[Nature's Favour](!
#naturesfavour)| Resist Energy,[Resist Energy](!
#resistenergy)| Saltray,[Saltray](!
#saltray)| Snakes Swiftness, Mass,[Snakes Swiftness, Mass](!
#snakesswiftnessmass)| Soften Earth and Stone,[Soften Earth and Stone](!
#softenearthandstone)| Spider Climb,[Spider Climb](!
#spiderclimb)| Splinterbolt,[Splinterbolt](!
#splinterbolt)| Tree Shape,[Tree Shape](!
#treeshape)| Warp Wood,[Warp Wood](!
#warpwood)| Winters Embrace,[Winters Embrace](!
#wintersembrace)| Wood Shape,[Wood Shape](!
#woodshape)}| 3,?{Spell| Bite of the Werewolf,[Bite of the Werewolf](!
#biteofthewerewolf)| Call Lightning,[Call Lightning](!
#calllightning)| Charge of the Triceratops,[Charge of the Triceratops](!
#chargeofthetriceratops)| Corona of Cold,[Corona of Cold](!
#coronaofcold)| Cure Moderate Wounds,[Cure Moderate Wounds](!
#curemoderatewounds)| Daylight,[Daylight](!
#daylight)| Dominate Animal,[Dominate Animal](!
#dominateanimal)| Downdraft,[Downdraft](!
#downdraft)| Evard's Menacing Tentacles,[Evard's Menacing Tentacles](!
#evardsmenacingtentacles)| Giant's Wrath,[Giant's Wrath](!
#giantswrath)| Girallon's Blessing,[Girallon's Blessing](!
#girallonsblessing)| Hypothermia,[Hypothermia](!
#hypothermia)| Icelance,[Icelance](!
#icelance)| Lion's Charge,[Lion's Charge](!
#lionscharge)| Magic Fang, Greater,[Magic Fang, Greater](!
#magicfanggreater)| Nature's Rampart,[Nature's Rampart](!
#naturesrampart)| Neutralise Poison,[Neutralise Poison](!
#neutralisepoison)| Primal Form,[Primal Form](!
#primalform)| Protection from Energy,[Protection from Energy](!
#protectionfromenergy)| Remove Disease,[Remove Disease](!
#removedisease)| Resist Energy, Mass,[Resist Energy, Mass](!
#resistenergymass)| Speak with Plants,[Speak with Plants](!
#speakwithplants)| Spirit Jaws,[Spirit Jaws](!
#spiritjaws)| Vigor,[Vigor](!
#vigor)| Vigor, Mass Lesser,[Vigor, Mass Lesser](!
#vigormasslesser)| Wreath of Flames,[Wreath of Flames](!
#wreathofflames)}| 4,?{Spell| Arc of Lightning,[Arc of Lightning](!
#arcoflightning)| Bite of the Wereboar,[Bite of the Wereboar](!
#biteofthewereboar)| Control Water,[Control Water](!
#controlwater)| Creeping Cold, Greater,[Creeping Cold, Greater](!
#greatercreepingcold)| Cure Serious Wounds,[Cure Serious Wounds](!
#cureseriouswounds)| Dispel Magic,[Dispel Magic](!
#dispelmagic)| Flame Strike,[Flame Strike](!
#flamestrike)| Healing Spirit,[Healing Spirit](!
#healingspirit)| Ice Storm,[Ice Storm](!
#icestorm)| Lay of the Land,[Lay of the Land](!
#layoftheland)| Magic Fang, Superior,[Magic Fang, Superior](!
#superiormagicfang)| Meteoric Strike,[Meteoric Strike](!
#meteoricstrike)| Reincarnate,[Reincarnate](!
#reincarnate)| Rusting Grasp,[Rusting Grasp](!
#rustinggrasp)| Spike Stones,[Spike Stones](!
#spikestones)| Sudden Stalagmite,[Sudden Stalagmite](!
#suddenstalagmite)| Vortex of Teeth,[Vortex of Teeth](!
#vortexofteeth)| Wind at Back,[Wind at Back](!
#windatback)}| 5,?{Spell| Awaken,[Awaken](!
#awaken)| Baleful Polymorph,[Baleful Polymorph](!
#balefulpolymorph)| Bite of the Weretiger,[Bite of the Weretiger](!
#biteoftheweretiger)| Blood Creepers,[Blood Creepers](!
#bloodcreepers)| Call Lightning Storm,[Call Lightning Storm](!
#calllightningstorm)| Cloak of the Sea,[Cloak of the Sea](!
#cloakofthesea)| Contagion, Mass,[Contagion, Mass](!
#contagionmass)| Control Winds,[Control Winds](!
#controlwinds)| Cure Critical Wounds,[Cure Critical Wounds](!
#curecriticalwounds)| Death Ward,[Death Ward](!
#deathward)| Dire Hunger,[Dire Hunger](!
#direhunger)| Enlarge Animal,[Enlarge Animal](!
#enlargeanimal)| Hibernate,[Hibernate](!
#hibernate)| Ice Flowers,[Ice Flowers](!
#iceflowers)| Ice Shield,[Ice Shield](!
#iceshield)| Inferno,[Inferno](!
#inferno)| Insect Plague,[Insect Plague](!
#insectplague)| Longstrider, Mass,[Longstrider, Mass](!
#longstridermass)| Panacea,[Panacea](!
#panacea)| Phantom Stag,[Phantom Stag](!
#phantomstag)| Quill Blast,[Quill Blast](!
#quillblast)| Rejuvenation Cocoon,[Rejuvenation Cocoon](!
#rejuvenationcocoon)| Stone Shape, Greater,[Stone Shape, Greater](!
#stoneshapegreater)| Stoneskin,[Stoneskin](!
#stoneskin)| Transmute Stone to Sand,[Transmute Stone to Sand](!
#transmutestonetosand)| Tree Stride,[Tree Stride](!
#treestride)| Vigor, Greater,[Vigor, Greater](!
#vigorgreater)| Wall of Fire,[Wall of Fire](!
#walloffire)}| 6,?{Spell| Anger of the Noonday Sun,[Anger of the Noonday Sun](!
#angerofthenoondaysun)| Animate Snow,[Animate Snow](!
#animatesnow)| Antilife Shell,[Antilife Shell](!
#antilifeshell)| Aspect of the Earth,[Aspect of the Earth](!
#aspectoftheearth)| Awaken Sand,[Awaken Sand](!
#awaken sand)| Bite of the Werebear,[Bite of the Werebear](!
#biteofthewerebear)| Bull's Strength, Mass,[Bull's Strength, Mass](!
#bullsstrengthmass)| Call of the Twilight Defender,[Call of the Twilight Defender](!
#callofthetwilightdefender)| Chasing Perfection,[Chasing Perfection](!
#chasingperfection)| Cometfall,[Cometfall](!
#cometfall)| Crumble,[Crumble](!
#crumble)| Dinosaur Stampede,[Dinosaur Stampede](!
#dinosaurstampede)| Dispel Magic, Greater,[Dispel Magic, Greater](!
#dispelmagicgreater)| Drown,[Drown](!
#drown)| Energy Immunity,[Energy Immunity](!
#energyimmunity)| Entomb,[Entomb](!
#entomb)| Enveloping Cocoon,[Enveloping Cocoon](!
#envelopingcocoon)| Extract Water Elemental,[Extract Water Elemental](!
#extractwaterelemental)| Find the Path,[Find the Path](!
#findthepath)| Fire Seeds,[Fire Seeds](!
#fireseeds)| Fires of Purity,[Fires of Purity](!
#firesofpurity)| Hungry Gizzard,[Hungry Gizzard](!
#hungrygizzard)| Liveoak,[Liveoak](!
#liveoak)| Miasma,[Miasma](!
#miasma)| Mummify,[Mummify](!
#mummify)| Protection from All Elements,[Protection from All Elements](!
#protectionfromallelements)| Stone Tell,[Stone Tell](!
#stonetell)| Stonehold,[Stonehold](!
#stonehold)| Summon Greater Elemental,[Summon Greater Elemental](!
#summongreaterelemental)| Thunder Field,[Thunder Field](!
#thunderfield)| Tidal Surge,[Tidal Surge](!
#tidalsurge)| Transport via Plants,[Transport via Plants](!
#transportviaplants)| Wall of Stone,[Wall of Stone](!
#wallofstone)| Wooden Blight,[Wooden Blight](!
#woodenblight)}| 7,?{Spell| Animate Plants,[Animate Plants](!
#animateplants)| As the Frost,[As the Frost](!
#asthefrost)| Aura of Cold, Greater,[Aura of Cold, Greater](!
#auraofcoldgreater)| Brilliant Aura,[Brilliant Aura](!
#brilliantaura)| Control Weather,[Control Weather](!
#controlweather)| Cure Moderate Wounds, Mass,[Cure Moderate Wounds, Mass](!
#curemoderatewoundsmass)| Firestorm,[Firestorm](!
#firestorm)| Haze of Smoldering Stone,[Haze of Smoldering Stone](!
#hazeofsmolderingstone)| Heal,[Heal](!
#heal)| Master Earth,[Master Earth](!
#masterearth)| Storm of Elemental Fury,[Storm of Elemental Fury](!
#stormofelementalfury)| Storm Tower,[Storm Tower](!
#stormtower)| Sunbeam,[Sunbeam](!
#sunbeam)| Swamp Lung,[Swamp Lung](!
#swamplung)| Transmute Metal to Wood,[Transmute Metal to Wood](!
#transmutemetaltowood)| True Seeing,[True Seeing](!
#trueseeing)| Waterspout,[Waterspout](!
#waterspout)| Wind Walk,[Wind Walk](!
#windwalk)| Word of Balance,[Word of Balance](!
#wordofbalance)| Wrack Earth,[Wrack Earth](!
#wrackearth)} }
1501924988
Andrew C
Marketplace Creator
Spell-a-geddon
1501943427
Ziechael
Forum Champion
Sheet Author
API Scripter
To be fair i should have used the bard or sorcerer as an example rather than the Druid lol
I appreciate the sample, but it is rather complicated. Could you break that down and simply show how to reference a single spell rather than the full list. For instance, my sorcerer has Magic Missile in the first spell slot for first level arcane spells. How can I reference that specific spell slot in a macro. Oh, and I should have probably mentioned that we are playing 3.5, if that changes anything.
1502445121
Ziechael
Forum Champion
Sheet Author
API Scripter
Yes, sorry, it is a lot to take in lol. Here is a quick break down of the how and why of it (I also run 3.5e but don't really use the sheets in built spell section for more than just recording known spells for my players). Step 1 - I set up a global macro for the spell Step 2 - I build the spell list for my players abilities section (annotated and condensed below) /w "@{selected|character_name}" ?{What Level| \\ Starts the spell level query (base query) and ensure the result is whispered to the player only to avoid chat clutter. 0,?{Spell| \\ Defines option 1 (level 0) and starts the spell list query (nested query) Create Water,[Create Water](!
#createwater)| Cure Minor Wounds,[Cure Minor Wounds](!
#cureminorwounds)| ... \\ add each spell as needed using the format above (option name,[button name](button macro to call) }| \\ ends the nested spell level query and starts the next spell level option 1,?{Spell| \\ Defines option 2 (level 1) and starts the spell list query (nested query) Aspect of the Wolf,[Aspect of the Wolf](!
#aspectofthewolf)| Aura Against Flame,[Aura Against Flame](!
#auraagainstflame)| ... \\ add each spell as needed using the format above (option name,[button name](button macro to call) }| \\ ends the nested spell level query and starts the next spell level option ... \\Rinse and repeat the above for all spell levels and known spells, use the following in place of '}|' for the last spell level required. ... }} \\ end the last nested spell level query and closes the base query too.
1502453033
Ziechael
Forum Champion
Sheet Author
API Scripter
As for referencing the repeating rows, you have to use the following syntax: @{selected|repeating_spells 1 2 _$0_spellname 1 2 } With the bold number being the spell level (0-10) and the italicised number being the spell column (1 = divine, 2 = arcane). The $0 represents the row id, so the example above would give you the name of the spell in the first slot of the 1st level arcane spells (magic missile in your sorcerer's example). You can also replace the $0 with the exact id for the row which is another level of meh I tend to ignore but useful if you are prone to reordering your rows using the modify option... Finally the 'spellname' can be replaced with any of the following to reference the particular repeating sections: spellused spellprep spellname spelllevel spellmacro spellcast Hope that helps?
Thank you. That is exactly what I was looking for.
1502464139
Ziechael
Forum Champion
Sheet Author
API Scripter
No worries, happy to help. Repeating sections can be a bit of a pain but if in doubt dig through the sheet's code ;) Happy rolling!
I thank you for the assistance so far, but I am having more trouble. While what you gave me works perfectly I can't seem to get it to work in a dropo down menu. This is what I tried doing. Could you tell me what is wrong? ?{choose|@{selected|repeating_spells12_$0_spellname12}, @{selected|repeating_spells12_$0_spellmacro12}| @{selected|repeating_spells12_$1_spellname12}, @{selected|repeating_spells12_$1_spellmacro12}| @{selected|repeating_spells12_$2_spellname12}, @{selected|repeating_spells12_$2_spellmacro12}| @{selected|repeating_spells12_$3_spellname12}, @{selected|repeating_spells12_$3_spellmacro12}} As you can see, I want the name of the spell to be what is listed in the drop down menu, and then have it roll the macro. While using the syntax for each element separately works, when I try to use this menu it just comes up with a single option that basically lists the name and the macros (though it may only list the first one). What can be done?
1502487024
Andrew C
Marketplace Creator
The Query closes itself at the first } it finds.
1502487264
Andrew C
Marketplace Creator
to build something like this I use ABility Command Button tricks and dump a bunch of Command buttons into Chat where you choose one. The one I use just creates a Token Action that strips the spells from the Player Spell repeating section of the 3.5E sheet and converts them to a list in a templates table.
Thanks for the information, Andrew, but it doesn't make sense. I have other drop down menus in macros that don't have this problem. For instance, this grapple macro has a drop down menu to choose to start, maintain, or break a grapple, and it works perfectly. /em ?{Choose|Start, @{selected|character_name} attempts to grapple @{target|token_name}. @{target|token_name} gets an Attack of Opportunity and @{selected|character_name} attempts a touch attack against [[@{target|touchac}]] with a [[1d20+@{selected|meleeattackbonus}]]. If they hit then the two of them make the following grapple checks; @{selected|character_name} gets a [[1d20+@{selected|grapple}]] and @{target|token_name} gets a [[1d20+@{target|grapple}]].|Maintain, @{selected|character_name} tries to maintain their grapple against @{target|token_name}; @{selected|character_name} gets a [[1d20+@{selected|grapple}]] and @{target|token_name} gets a [[1d20+@{target|grapple}]].|Break, @{selected|character_name} tries to break the grapple @{target|token_name} has on them; @{selected|character_name} gets a [[1d20+@{selected|grapple}]] and @{target|token_name} gets a [[1d20+@{target|grapple}]].} I have others for ability checks and saves, and some for skills, and they all work. So why is the spells query closing after the first } when my others are not.
1502558349
Ziechael
Forum Champion
Sheet Author
API Scripter
It's because your spell macro is calling the macros held in the sheet which contain }, you'd need to replace all instances of , | and } in the spell macros with their html equivalents for it to work. See  here for full details.
1502561169

Edited 1502561237
So, in the spell macro I change | to & # 124; but leave the | in my drop down menu?
1502565344
Ziechael
Forum Champion
Sheet Author
API Scripter
That's right, also the same for , (,) and } (}) The alternative is to use a similar method to my original example which creates a button to call the macro and therefore bypasses the need to replace all the symbols.
Well, now I have run into another problem. My original Magic Missile macro contained this [[{floor(@{selected|casterlevel}/2+.5),5}kl1 ]] to calculate how many missiles the caster could create, and this works fine. But, after changing the symbols to the html I get a syntax error. When I try to use the drop down (which does work, so thanks for that) it simply doesn't do anything. Oh, and is there a different html for the { and the } or do they use the same thing?
1502599328

Edited 1502599410
You don't have to convert the left { as it won't end the macro early. You also don't have to convert any attribute calls because those get converted to their values before the drop down query in the order of operations. So leave the @{selected|casterlevel} intact but change the right } before the kl to }
1502672317
Andrew C
Marketplace Creator
Shem A. said: Thanks for the information, Andrew, but it doesn't make sense. I have other drop down menus in macros that don't have this problem. What I would do is this... /w @{selected|token_name} &{template:default}{{name= @{selected|token_name}'s Spells }} {{Level 0 = [@{... insert reference to the spell NAME on the sheet}](~selected|... insert reference to the SPELL MACRO on the sheet) ... insert other Level 0 spells here ... }} {{Level 1 = Rinse and repeat }} And that will drop a bunch of pink buttons into the chat, and they can click the one they want. For a Grapple, I just modify an attack roll in Diana Ps 3.5E. &{template:DnD35AttkRoll}{{pcflag=true }}{{name=@{selected|token_name} }}{{subtags= tries to grapple @{target|token_name} }}{{attack1= [[1d20+(attack modifiers)]] to touch }}{{critconfirm1=}} }}{{damage1=@{selected|token_name} [[1d20+(grapple modifiers)]] @{target|token_name} [[1d20+(grapple modifiers)]] }}{{critdmg1= }} So if that isn't your sheet system, then you'll have to change it. Maybe make it just a @{template:default} but if you have 3.5E D&D by Diana P, that should do your grapple needs. If it's not the players, just change {{pcflag=true}} to {{npcflag=true}}
1506830262

Edited 1506830379
Hey, thank you for all the help. I know it has been a while here, but I finally got everything square away and my macros work now. However, there is still a small problem. The spell macros have the initial text as a /em, but when I use the drop down macro it simply posts it with the /em as part of the text. Is there a way to make it emote like it is supposed to do? For example, my macro for enlarge person is as follows: /em @{selected|character_name} casts the spell ENLARGE PERSON on @{target|token_name} who is within [[floor(25 + {{@{selected|level}/2}*5})]] feet, and is a humanoid. @{target|token_name} instantly grows into the next size category, gaining a +[[2]] to strength and a –[[2]] to dexterity. /em If there is insufficient room @{target|token_name} makes a [[1d20+@{selected|str-mod}+1]] strength check. If this is sufficient they burst the enclosures as they grow. If not they remained confined, but unharmed. /w gm Multiple effects that increase size do not stack. /w gm Enlarge Person counters and dispels Reduce Person. /w gm This is a Transmutation spell that requires a pinch of iron powder and has V and S components. A Fortitude save (DC [[floor(@{selected|spelldc1}+(@{selected|casterlevel}/2))]]) negates the effect and SR applies Now, the second emote and the three whispers all work fine, but the first emote simply has it in the text.
1507091968
Silvyre
Forum Champion
Shem A. said: it simply posts it with the /em as part of the text. Is there a way to make it emote like it is supposed to do? Make sure there is no space before the /em in the macro.
There isn't.
1507133923

Edited 1507133988
Silvyre
Forum Champion
Perhaps a broken Roll Query could adversely affect the /em. I notice that your first emote has problematic characters in it; it's possible that you missed some that required escaping. Try this version, which does not contain any problematic characters: /em @{selected|character_name} casts the spell ENLARGE PERSON on @{target|token_name} who is within [[floor(25 + (@{selected|level}/2)*5)]] feet and is a humanoid. @{target|token_name} instantly grows into the next size category and gains a +[[2]] to strength and a –[[2]] to dexterity.
Thank you for pointing out those extra brackets. I thought I have removed them. But it still just puts the /em in the text. The macro works and all the calculations are fine. It is just that it won't emote on the first section. I figure I will just remove the emote from the spell macro and not worry about it, unless there is a solution.
1507134877

Edited 1507135007
Silvyre
Forum Champion
Last thing to try is replace the entire macro with this: /em @{selected|character_name} casts the spell ENLARGE PERSON on @{target|token_name} who is within [[floor(25 + (@{selected|level}/2)*5)]] feet and is a humanoid. @{target|token_name} instantly grows into the next size category and gains a +[[2]] to strength and a –[[2]] to dexterity. /em If there is insufficient room @{target|token_name} makes a [[1d20+@{selected|str-mod}+1]] strength check. If this is sufficient they burst the enclosures as they grow. If not they remained confined but unharmed. /w gm Multiple effects that increase size do not stack. /w gm Enlarge Person counters and dispels Reduce Person. /w gm This is a Transmutation spell that requires a pinch of iron powder and has V and S components. A Fortitude save (DC [[floor(@{selected|spelldc1}+(@{selected|casterlevel}/2))]]) negates the effect and SR applies (I additionally removed one comma.) If that fails to help, posting the macro (e.g. to pastebin.com, to ensure the HTML entities are intact) will allow further investigation.
I was just looking at some other macros and it seems that if I have only one part to a macro the emote works, but if I put more than one in than the first emote doesn't. I will have to experiment with this a little more.
1507158760
Silvyre
Forum Champion
Sure, feel welcome to post the macro if you get stuck.
Thanks for the help