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 with parameters?

Greetings & Salutations, I was wondering if there is either a way natively or a script that allows players to use an ability (via chat) and add parameters to it so that the ability can utilize it. Example: "%{My Player|attackWithModifier} 5" So that attackWithModifier has access to the parameter '5' Do you know of any way to do this?
1515181660

Edited 1515181783
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
There are a couple ways to do this. I'm assuming that you want it to add 5 to the result of the check, if that's true, then you can do one of the following: You can do like you have, and simply put a +/- there (or have it in the ability) Pros: simple, and can work with just chat, no popups necessary Cons: Doesn't work with roll templates, or if you need the mod in multiple places/not at the end of the ability You can utilize roll queries to add the modification into your ability wherever you need it. Pros: The same mod can be used as many times as you need it from one entry. Works with roll templates. Cons: You'll be asked for a mod every time you roll that ability. Requires rewriting your ability.
Thank you for the answer. I see now that I wasn't clear with my initial post. The solutions you proposed I have already looked at and sadly they won't cut it. Let me give you an example: &{template:5eDefault} {{weapon=1}}{{title=Flying @{Flying}}} {{subheader=Handicap}} {{showclassactions=1}}{{AG=@{AG} ⨠ [[d20cs1cf20]]}} {{IN=@{IN} ⨠ [[d20cs1cf20]]}} {{ST=@{ST} ⨠ [[d20cs1cf20]]}} Using the template above as an ability called flying, I want to be able use parameters, as I described in the initial post, to modify the roll results. so for example I might want to roll: %{Me|flying} 5 1 6 So that I could use three parameters to modify the rolls for AG, In and ST. As far as I know this cannot be done with anything roll20 offers for free-users. So I assume some that the API will solve the problem somehow. I'm currently looking at the chat:message event and how one could replace part of the underlying JSON roll-structure to get this effect (assuming one uses tokens inside the ability to do so). Do you know an easy way to solve this? If not, do you know any way to solve this?
1515185271

Edited 1515185532
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I think that roll queries are what you want. Let me demonstrate using your flying example: &{template:5eDefault} {{weapon=1}}{{title=Flying @{Flying}}} {{subheader=Handicap}} {{showclassactions=1}}{{AG= [[@{AG}+?{AG Modifier|0}]] ⨠ [[d20cs1cf20]]}} {{IN= [[@{IN}+?{IN Modifier|0}]] ⨠ [[d20cs1cf20]]}} {{ST= [[@{ST}+?{ST Modifier}]] ⨠ [[d20cs1cf20]]}} I may have misunderstood where you want the modifier to be placed, but you can put the modifiers in the actual rolls instead if that is what you want. I'll also note that the API cannot change anything that has been sent to chat. It can only react to it. If for some reason the roll query method above does not work, then you would need to create a script that reacts to a chat message (probably with an api command that included the roll template you wanted to roll. The API would then reroll that roll template to chat with your modifications. However, it'll be a lot of extra coding for a feature that is already supported in base chat.
Thank you for answering so quickly. The reason why I don't like this solution: - You cannot specify default values - These horrendous pop up windows break the flow and take time to fill. If you mistype, there is no undo. you have to enter EVERY value, cannot skip any. The entire reason why I am looking for a solution that is purely text-based is that it is faster and more intuitive. Imagine windows or linux shell asking you to enter values for parameters every time you want to execute a command. That would break the flow, be slow and feel awful.  About the second paragraph: If there is no way to delete a roll that was send or modify it, is there a way to send a roll that will evaluate to an empty line or no line at all but at the same time is registered as a message event? Maybe an invalid template?
1515188138
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
In a roll query, the number after the pipe is a default value. If you don't want to add values via popup box, how do you envision using them? What would be the ideal point to enter a value? Is the value going to be different every time you make the roll?
Hello keith, first I wanted to thank you for helping me with my previous problem of getting ownership of an adventure I was only GM in. I asked the roll20 team and they set me as the owner. Secondly: I envision it (in my specific case) to work like this // With three parameters %{MyCharacter|theAbility} 5, 4, 4 // With some default values %{MyCharacter|theAbility} 5, , Then I would envision that one uses placeholder tokens to be replaced in the ability: // Example of theAbility /roll d6 + ${0} + ${1} + ${2} // Example with sepcified defaults so that ${0|1} evalutes to 1 if there is no paremeter given /roll d6 + ${0|1} + ${1|5} + ${2|0} It would be pretty easy to type since there is no switching to mouse.
1515189190
Lithl
Pro
Sheet Author
API Scripter
If your ability was: /roll d6 Then calling: %{MyCharacter|theAbility} + 5 + 4 + 4 Would roll as expected. There is no mechanism for substituting in variable at arbitrary points in the ability text (you can append to the beginning or end simply because the macro system is doing string replacement) beyond roll queries, as mentioned above.
Update & Solution: After working with the API for a bit I found a simple solution: The autocomplete for abilities always works! just typing "%" will trigger it. So writing "!%{...|...} 5 5 5" one can write a listener that will parse this and look up the abilitie's text, replace tokens in that text and execute the new text as a roll.