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

Is it possible to display a button though API with unresolved @{selected|token_id} ?

Hello, I created a script for my D&d 3.5 game to memorize buff/debuff on character based on a selfmade compendium using json gmnote. It worked quite well for every personnal or targeted spell. My concerns is about multitargeted spell like prayer. For spell like that I would like to display a button, (2 infact :1 for taking the buff and 1 for the debuff) calling my script with some parameters and more specifically the token_id (or at least the characted id of the person clicking on the button). Usually I used @{selected|token_id} as parameter but it seems it is resolved when the API send the command and not when someone click on the button. Am I missing something ?
1646410093
The Aaron
Roll20 Production Team
API Scripter
You need to HTML escape it to cause the payload to end up in the button, and not in the original message to create the button: [test](!some-command @{selected|token_id}) You might consider using @{target|token_id} instead. @{selected|...} will only give you the first selected token's information, which is often not as useful. You can select tokens you don't control, so players could bless other characters or curse monsters, etc.  You can also give a label to the selection and each unique label will be a different prompt, allowing you to collect more than one ID.  (In the case where there are fewer tokens to deal with, I just have my players click one several times and deduplicate the IDs on the API side). [test](!some-command @{target|Whom to Bless [1]|token_id}) @{target|Whom to Bless [2]|token_id}) @{target|Whom to Bless [3]|token_id})
Perfect as always ! Totally forgot the html escape. For now each player need to clik to take the buff for himself soI stay on selected (and I will apply it on monster) but I keem in mind for the future :)