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

Using Abilities in Either Queries or Chat Menu

Hello,      I am having a lot of trouble getting these to work properly. I want to have a single button click bring up a list of abilities for me to try, but it keeps breaking on me. When I use the query method, it breaks and rolls the entire list of abilities I want to query.  This would be mo1, the ability search is with the character name is %{Katia|mo1} and works from the chat box, or by itself. All four of my abilities have a similar set up, named mo2, mo3, and mo4 respectively. &{template:default} {{name=Bone Rush}} {{Type = Ground}} {{Rank = @{M1}}} {{Accuracy=[[1d20+@{LVL}]]}} {{Damage=[[2d[[@{M1}*2]]+@{ATK}]]}} {{Five Strike = [[1d8]]}} {{Damaging move, Five-strike Standard Action The user rolls 1d8 when they hit with Bone Rush.}} {{1-2 3-4 5-6 7-8 = - [[1d4]] + 0 + [[1d4]] + [[2d4]]}} {{Max Rank Effect: Once per battle, the user may roll their Five-strike die twice.}} But when placed in a query as below ?{Choose a Move| %{Katia|mo1}| %{Katia|mo2}| %{Katia|mo3}| %{Katia|mo4}} It rolls all four abilities instead and gives me an error for rendering the roll template. I also removed the new lines, but the same thing happened. Next I tried chat menus &{template:default} {{name=Chat Menu }} {{[Bone Rush](%{Katia|mo1})}} All I got was the title portion of the template. Nothing else. I should add, that the attributes these abilities are tethered to work. During the query, all four roll, and they roll correctly. I just do not receive a drop down, and it rolls all four at one button click. Each ability has been thoroughly been tested and work independently just fine. Any help is greatly appreciated.
1724109358

Edited 1724109530
Gauss
Forum Champion
HI Corvus B.,  Short version, use Chat Menu buttons instead of queries.  The reason is while you see:  ?{query|%{ability1}|%{ability2}}  Roll20 sees:  ?{query|EVERYTHING in Ability1|EVERYTHING in Ability2} And that is almost certainly going to contain command characters that break the query.  You can use HTML substitution in your Abilities to make them safe for the query, but that is not worth it. Use Chat Menus instead.  A simple Chat Menu setup for you would look like:  /w Katia &{template:default} {{name=Choose a Move}} {{Select one= [Movename1](Katia|mo1) [Movename2](Katia|mo2) [Movename3](Katia|mo3) [Movename4](Katia|mo4)}}
Thank you for getting back to me. That was what I was suspecting was happening with the queries, but I wasn't 100% sure. That was why I tried to use Chat Menus, however they would not load up right. The one you coded sends me to a new URL though. It doesn't roll the move. 
1724116713

Edited 1724116781
GiGs
Pro
Sheet Author
API Scripter
Gauss's syntax left out one character. If those are Abilities on a character sheet, you should be able to use this: /w Katia &{template:default} {{name=Choose a Move}} {{Select one= [Movename1](~Katia|mo1) [Movename2](~Katia|mo2) [Movename3](~Katia|mo3) [Movename4](~Katia|mo4)}}
1724117014
Gauss
Forum Champion
Oops, good catch GiGs, that's what I get for writing that up right as I got back home. 
IT WORKS! THANK YOU GUYS! How would I input this for other rolls using attributes?
1724185494

Edited 1724185701
Gauss
Forum Champion
Corvus B. said: IT WORKS! THANK YOU GUYS! How would I input this for other rolls using attributes? Not sure what you mean by your question, but the basic premise for Chat Menus is this:  [button name](~abilityname) or [button name](`#macroname) So if your ability is %{abilityname} you use strip off the %{ } and plug it into (~) as (~abilityname) If a charactername is required then it is (~charactername|abilityname) How and where you use it is up to you, it can be used in many places, the example above was via a template.  If you have any other problems where you need help please ask. 
I got it all working. Thank you.
1724204232

Edited 1724204273
timmaugh
Forum Champion
API Scripter
For completeness of the information in this thread (should others come to it searching for an answer)... if you need to create a button to an attribute, you have to take a couple of different steps. Step 1 - API Button Form First, you have to use the API button form, including the HTML entity for "new line":  
   That means you *can* create a button pointing to an attribute like this: [Click Here](!
@{SomeAttribute}) (Obviously, this example would be generated from a character sheet since we used the shorthand attribute reference where we don't have to supply the character name.) The problem with this formation is that the attribute is retrieved and evaluated at the time that the button is rendered . That means that all the expanded verbiage is in the link the button points to -- and is probably breaking it. An easy example to see this in effect is an attribute that contains a die roll. If the attribute DefenseRoll contains the value: [[1d10]] ...and you ask for a button pointing to it: [Defense](!
@{DefenseRoll}) ...you will notice that the die is rolled at the time the button is rendered. The value has already been evaluated. Worse, if you hover over the button to examine the link it will take you to, it contains a bunch of the HTML formatting that makes an inline roll look like an inline roll in the chat output. (click the image to make it large enough to read). Worse, the button doesn't even output the result of the inline roll, because that code was not all preserved. Something similar would happen if the expanded text contained a closing parentheses, as that would trigger the parser to think the button syntax had ended. Step 2 - Use HTML @ Entity In order to prevent the early rendering of the attributes referenced by a chat button, you will need to escape the @ symbol with the corresponding HTML entity. You can use either  @   or  @  ... but there is still one problem. This form won't work: [Defensek](!
@{DefenseRoll}) That won't work because we've asked the attribute to *not* resolve when the button is rendered from the character sheet, but instead when the button is pushed in chat. At that point, we've lost the context of the character sheet, so the shorthand reference to @{DefenseRoll} no longer resolves without the character name. For that, there's one last step... Step 3 - Include the Character Name It seems obvious that you would fix this by including the character name -- and you could. However, it bears mentioning that you can also make use of the shorthand reference to the character_name attribute, instead:  @{character_name}  The shorthand for this attribute will work because we don't care if the character name resolves at the time the button is rendered (rather than when the button is clicked)... the character's name will be the same. That makes our final, "generalized" attribute button form something more like: TL;DR [ Click Here](!
@{@{character_name}|SomeAttribute})