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

Macro while casting spell

Hello, We are running custom wild magic option in our campain. Rule: while casting spell of level 1 or higher roll d20 + spell slot level. On roll lower of equal to roll, roll wild magic table. I wonder if there is a posibilty to run macro while casting spell. Cast spell->choose spell level->spell effect+rolld20+spell level if <= spell level then roll wild magic table ([[ [[1d20<spellLevel+1]]t[Wild-Magic] ]]) BR/ Damian
might be possible with API but i dont think it is unless you run a custom sheet and program it into the sheet via sheet workers 
This could be accomplished with an API Command Button (Pro subscription NOT required for this) placed in the spell's description. [Wild Magic](!
[[ [[1d20<[[spellLevel+1]] ]]t[Wild-Magic] ]]) The spellLevel portion would depend on which character sheet you are using.
Thanks! Thats exacly what I needed. Now does anyone know how spelLevel is passed in a code? I'm using standard 5e character sheet
The OGl commands are all listed on the OGL sheet wiki. This is the spell section for PC's: Spellbook Cantrip %{selected|repeating_spell-cantrip_$0_spell} Spellbook Level 1 %{selected|repeating_spell-1_$0_spell} Spellbook Level 2 %{selected|repeating_spell-2_$0_spell} Spellbook Level 3 %{selected|repeating_spell-3_$0_spell} Spellbook Level 4 %{selected|repeating_spell-4_$0_spell} Spellbook Level 5 %{selected|repeating_spell-5_$0_spell} Spellbook Level 6 %{selected|repeating_spell-6_$0_spell} Spellbook Level 7 %{selected|repeating_spell-7_$0_spell} Spellbook Level 8 %{selected|repeating_spell-8_$0_spell} Spellbook Level 9 %{selected|repeating_spell-9_$0_spell}
1516213150

Edited 1516213219
Silvyre
Forum Champion
Damian P. said: Now does anyone know how spelLevel is passed in a code? Are you referring to the "Cast at what level?" Roll Query ? You can reference any Roll Query using its name, e.g. by replacing spellLevel with ?{Cast at what level?}
Silvyre said: Damian P. said: Now does anyone know how spelLevel is passed in a code? Are you referring to the "Cast at what level?" Roll Query ? You can reference any Roll Query using its name, e.g. by replacing spellLevel with ?{Cast at what level?} A problem I have found with this approach is that the description is referenced before the spell level part of the roll template. So by only using ?{Cast at what level?} you will be prompted to enter the level in a text box instead of selecting from a dropdown as intended. The only way I have been able to get it to work is to copy the entire query from the roll (click on the roll from the character sheet, then click the up arrow while in the chat box to get the roll's code) and use that in the description.
Oh, I tought that you could get somehow level of casted spell when clicking button in a chat. Thanks for input, I'll come back with my results if someone wants to use it :)
1516288818

Edited 1516289179
Silvyre
Forum Champion
Damian P. said: I tought that you could get somehow level of casted spell when clicking button in a chat. That's possible, too. Try this: [Wild Magic](!
[[ [[1d20<[[?{Cast at what level?|Base Level,0|Level +1,1|Level +2,2|Level +3,3|Level +4,4|Level +5,5|Level +6,6|Level +7,7|Level +8,8}+1]] ]]t[Wild-Magic] ]])
1516289241
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Shaped Sheet: I could not find a way to get level of a spell as it is being cast without invoking the "cast as level" query. Since I didn't want to add the step of answering a dialog box every time I cast a spell, I opted instead to create a separate attacher for each spell level. (We use the same formula in our game—What's the point of a Wild Magic Sorcerer without Wild Magic?)
Great, thats exacly what I needed. Only not working part is rolling d20 dice [Wild Magic](!
[[ [[ 1d20 <[[?{Cast at what level?|Base Level,0|Level +1,1|Level +2,2|Level +3,3|Level +4,4|Level +5,5|Level +6,6|Level +7,7|Level +8,8}+1]] ]]t[Wild-Magic] ]])
1516313789
Silvyre
Forum Champion
If you'd like to see the d20 roll, try this: [Wild Magic](!
/r [[ 1d20<[[?{Cast at what level?|Base Level,0|Level +1,1|Level +2,2|Level +3,3|Level +4,4|Level +5,5|Level +6,6|Level +7,7|Level +8,8}+1]] ]]t[Wild-Magic])
Hello, rolling d20 still doesn't work. Only way to make it work: [Wild Magic](! [[ [[ ?{Dice|1d20} <[[?{Cast at what level?|Base Level,0|Level +1,1|Level +2,2|Level +3,3|Level +4,4|Level +5,5|Level +6,6|Level +7,7|Level +8,8}+1]] ]]t[Wild-Magic] ]]) But with this there is additional pop up (r/1d20) and strange behaviour: wild magic table is now (a;b;c;d;e) button output:  c+a+b+c+c+b+b+c+a+c+d+a+c+e+a+e+a+e)'>c
1516977000
Silvyre
Forum Champion
Try this: [Wild Magic](!
/r [[ 1d20<[[?{Cast at what level?|Base Level,0|Level +1,1|Level +2,2|Level +3,3|Level +4,4|Level +5,5|Level +6,6|Level +7,7|Level +8,8}+1]] ]]t[Wild-Magic])
Thanks @Silvyre, its works almost perfectly. Now api never calculates aditional damage when casted on higher levels.
1517627448
Silvyre
Forum Champion
This should fix that: [Wild Magic](!
/r [[ 1d20<[[?{Cast at what level?|Base Level,0|Level +1,1|Level +2,2|Level +3,3|Level +4,4|Level +5,5|Level +6,6|Level +7,7|Level +8,8}+1]] ]]t[Wild-Magic])
Thanks! now it works perfectly :D
1517976725
Silvyre
Forum Champion
Great!