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

Ability Command Button in nested Roll Query

March 20 (6 years ago)

Hi all,

First of all, I found it hard to search for this kind of Issue so I'm sorry if it was here before.

I created A Roll query, in the ability section of the Character sheet (5th Edition OGL by Roll20), which asks for the damage die of my Weapon. (I'm playing a Polearm Master with a quarterstaff, so the damage die for the same attack could be a d8, d6 or d4) My staff has a property, where I can deal additional damage when expanding charges, which I want to implement as a Ability command button. 

The attack itself (with a d8 here) looks like this:

&{template:atkdmg} {{mod=[[ @{pb} + @{strength_mod} + 3 ]]}} {{rname=Staff of Striking}} {{r1=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{always=1}} {{r2=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{attack=1}} {{range=Meele}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8 + @{strength_mod} + 3 ]]}} {{dmg1type=Bludgeoning}} {{dmg2flag=}} {{crit1=[[1d8]]}} {{crit2=}} {{save=}} {{saveattr=}} {{savedesc=}} {{savedc=}} {{desc=[Charge](~Baeshra|Staff-Strike)}} {{hldmg=}} {{spelllevel=}} {{charname=Baeshra}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagetype=@{global_damage_mod_type}}} {{globaldamagecrit=[[0]]}}

Put into the roll query I created the following:

?{Damage Die? | 

d8 (Two-Handed), 

&{template:atkdmg} {{mod=[[ @{pb} + @{strength_mod} + 3 ]]}} {{rname=Staff of Striking}} {{r1=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{always=1}} {{r2=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{attack=1}} {{range=Meele}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d8 + @{strength_mod} + 3 ]]}} {{dmg1type=Bludgeoning}} {{dmg2flag=}} {{crit1=[[1d8]]}} {{crit2=}} {{save=}} {{saveattr=}} {{savedesc=}} {{savedc=}} {{desc=[Charge](~Baeshra|Staff-Strike)}} {{hldmg=}} {{spelllevel=}} {{charname=Baeshra}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagetype=@{global_damage_mod_type}}} {{globaldamagecrit=[[0]]}} | 

d6 (One-Handed), 

&{template:atkdmg} {{mod=[[ @{pb} + @{strength_mod} + 3 ]]}} {{rname=Staff of Striking}} {{r1=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{always=1}} {{r2=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{attack=1}} {{range=Meele}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[d6 + @{strength_mod} + 3 ]] }} {{dmg1type=Bludgeoning}} {{dmg2flag=}} {{crit1=[[1d6]]}} {{crit2=}} {{save=}} {{saveattr=}} {{savedesc=}} {{savedc=}} {{desc=[Charge](~Baeshra|Staff-Strike)}} {{hldmg=}} {{spelllevel=}} {{charname=Baeshra}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagetype=@{global_damage_mod_type}}} {{globaldamagecrit=[[0]]}} | 

d4 (Bonus Action), 

&{template:atkdmg} {{mod=[[ @{pb} + @{strength_mod} + 3 ]]}} {{rname=Staff of Striking}} {{r1=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{always=1}} {{r2=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{attack=1}} {{range=Meele}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[d4 + @{strength_mod} + 3 ]] }} {{dmg1type=Bludgeoning}} {{dmg2flag=}} {{crit1=[[1d4]]}} {{crit2=}} {{save=}} {{saveattr=}} {{savedesc=}} {{savedc=}} {{desc=[Charge](~Baeshra|Staff-Strike)}} {{hldmg=}} {{spelllevel=}} {{charname=Baeshra}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagetype=@{global_damage_mod_type}}} {{globaldamagecrit=[[0]]}}

}

And I have the "Staff-Strike" Ability, which is referenced in the description (I also tried to escape the } characters, which doesn't solve my problem. In fact it didn't change anything):

&{template:dmg} {{rname=}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d6]]}} {{dmg1type=Force}} {{dmg2flag=}} {{dmg2=}} {{dmg2type=}} {{crit=1}} {{crit1=[[1d6]]}} {{crit2=}} {{save=}} {{desc=}} {{hldmg=}} {{spelllevel=}} {{charname=}}


Now finally to my problem. The query itself works, as long as I am in editing mode. As soon as I safe the Ability and use it (either directly, as token ability or through the macro list) it doesnt work anymore. The query now has 6 different options, which are:

d8 (Two-Handed)

Baeshra|Staff-Strike)}} {{hldmg=}} {{spelllevel=}} {{charname=Baeshra}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagetype=@{global_damage_mod_type}}} {{globaldamagecrit=[[0]]}}

d6 (One-Handed)

Baeshra|Staff-Strike)}} {{hldmg=}} {{spelllevel=}} {{charname=Baeshra}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagetype=@{global_damage_mod_type}}} {{globaldamagecrit=[[0]]}}

d4 (Off-Hand)

Baeshra|Staff-Strike)}} {{hldmg=}} {{spelllevel=}} {{charname=Baeshra}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagetype=@{global_damage_mod_type}}} {{globaldamagecrit=[[0]]}}


So for me (this is basically the second time I ever did something with the macros/abilities) this looks like the ~ ends the first selection somehow. But only when the ability is saved. Does anybody know, where I went wrong and what the issue seems to be? I'm happy to give more information if required.

Also, I'm glad I tried this in my own game, where I can freely delete the chat history, since I destroyed my chat multiple times doing this ;)

Thank you all

March 20 (6 years ago)
GiGs
Pro
Sheet Author
API Scripter
Now finally to my problem. The query itself works, as long as I am in editing mode. As soon as I safe the Ability and use it (either directly, as token ability or through the macro list) it doesnt work anymore. The query now has 6 different options, which are:

What is more likely happening, that once you save it, you can use it. But once you reopen the macro in editing mode, it breaks.

This is because whenever you open a macro in editing mode, the html entities get converted to the characters they represent. So you have two options:

  1. Once you save your macros, never reopen them. they'll keep working. If you go this route, keep a copy of the macro somewhere so you can restore it easily later, if you ever do need to re-edit it.
  2. Save the Macro as an Ability on a character sheet, instead of a macro. Abilities don't get replaced in this way, so macros stored as abilities are safe.

What many people do is create a new character, call it Macros, and use it to store their universal macros as Abilities. If you allow this character to be controlled by all players, all players can use the ability.


March 20 (6 years ago)


David V. said:

I created A Roll query, in the ability section of the Character sheet 

Did I do it in the wrong place then?

Also, I just tested that by saving the ability and then go back into editing mode and do the roll while in editing (so that I roll it after I saved it and I reopened it) and it still works in editing mode. So the difference really seems to be between editing and not-editing


March 20 (6 years ago)
GiGs
Pro
Sheet Author
API Scripter

Oh, I missed that you made an Ability. Weird. I honestly dont know why it would behave differently in edit mode and saved. Maybe someone else has a clue?

March 20 (6 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Not sure if this has something to do with it, but an ability that is called by another, but is toggled open, will not be called as written, but as last saved.

March 20 (6 years ago)

Edited March 20 (6 years ago)


David V. said:

And I have the "Staff-Strike" Ability, which is referenced in the description (I also tried to escape the } characters, which doesn't solve my problem. In fact it didn't change anything)


I guess that's the reason, why it worked even when I escaped all the } character in the "Staff-Strike" Ability, since I still had it open at the point of testing. (I just tested it again and noticed it doesn't work at all with escaped } characters, since then it just outputs the code into the chat window)

As for my actual Problem, it doesn't matter what state the other ability is in, as long as I am editing the main ability it works as expected, but not otherwise


edit: Clarification

March 20 (6 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

I know it's sort of a frame challenge, but you might want to look into Chat Menus. Much simpler syntax.

March 21 (6 years ago)

Thanks for the tip, but since I am a player in the campaign I'm not exactly overloaded with buttons in the macro list. So for me it is actually easier to have it in there.

I kind of "solved" my problem. Not really since I assume it has something to do with the query is processed internally, but I was able to change the query in a way that the problem doesn't occur.

For anyone curious, my workaround was the following

&{template:atkdmg} {{mod=[[ @{pb} + @{strength_mod} + 3 ]]}} {{rname=Staff of Striking}} {{r1=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{always=1}} {{r2=[[ d20 + @{pb} + @{strength_mod} + 3 ]]}} {{attack=1}} {{range=Meele}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[?{Damage die? |d8 (Two-Handed),d8|d6 (One-Handed),d6|d4 (Bonus Action),d4} + @{strength_mod} + 3 ]] }} {{dmg1type=Bludgeoning}} {{dmg2flag=}} {{crit1=[[?{Damage die? |d8 (Two-Handed),d8|d6 (One-Handed),d6|d4 (Bonus Action),d4}]]}} {{crit2=}} {{save=}} {{saveattr=}} {{savedesc=}} {{savedc=}} {{desc=[Expend Charges](~Baeshra|Staff-Strike)}} {{hldmg=}} {{spelllevel=}} {{charname=Baeshra}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagetype=@{global_damage_mod_type}}} {{globaldamagecrit=[[0]]}}

Since the query only affected 2 parts of the  template I just added the query to the dmg and crit parts of the template. With this it works perfectly fine. (Also, while writing this I found out that I could have put the query into a normal attack in the repeating_attack section of the character sheet)

However, I kind of want to know if anybody experienced something similar or if my code works for other people. 

And lastly a minor question: If I put a description into the templates "desc" section, is there a way to format it? Like get rid of the standard pink box for ability button commands or write something into a new line or center something?

Thanks GiGs and keithcurtis for your efforts

March 21 (6 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

You are kind of limited to whatever your sheet provides for a roll template, or the default template. IMHO, the default template really, really needs a full column, left justified field, just for displaying notes. Not everything is tabular data. If you want to format for just yourself (i.e. the appearance onlty changes on the local browser, you can make changes with the Stylus plug in. Here is an example.