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

API to Sum All Dices Rolled on a Template.

Hello, there! I'm playing Dragon Age with my friends and I got Pro subscription to make things easier for us. Could somebody please tell me if there's some API to sum all dices rolled on a template? If there is, please, how do I use it? My current macro for an example (a cunning test) &{template:default}{{name=?{Qual é o teste? |Astúcia,Astúcia}} {{Astúcia: [[@{astúcia}]] + Foco:[[@{astúcia_foco}]] 2D6: [[1d6]] + [[1d6]] Dado do Dragão: [[1d6]]}} The output: I can have everything I need from here, but I really want the individual values and a total sum too, so I can read my dragon dice and I could know the total roll as well. Thanks in advance!
1610195621
David M.
Pro
API Scripter
Looks like something is missing from your name query, as what you posted will return an error. Ignoring that part for now, you can do it without the api by using the reusing dice rolls trick. You will have to display the total first, then can reference the individual rolls later. Here is an example  &{template:default}{{name=Astúcia}} {{Rolo Total: [[@{astúcia}+@{astúcia_foco}+[[1d6]]+[[1d6]]+[[1d6]]]]}} {{Astúcia: [[@{astúcia}]] + Foco:[[@{astúcia_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]]}} Sample output with values of 5 & 1 for the cunning and focus attributes (No idea if these are realistic, as I don't play DA) It's also possible that there are dedicated scripts out there, but I'll leave that to the DA community.
1610208154

Edited 1610209593
David M. said: Looks like something is missing from your name query, as what you posted will return an error. Ignoring that part for now, you can do it without the api by using the reusing dice rolls trick. You will have to display the total first, then can reference the individual rolls later. Here is an example  &{template:default}{{name=Astúcia}} {{Rolo Total: [[@{astúcia}+@{astúcia_foco}+[[1d6]]+[[1d6]]+[[1d6]]]]}} {{Astúcia: [[@{astúcia}]] + Foco:[[@{astúcia_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]]}} Sample output with values of 5 & 1 for the cunning and focus attributes (No idea if these are realistic, as I don't play DA) It's also possible that there are dedicated scripts out there, but I'll leave that to the DA community. I forgot to tell that this above is part of an entire macro. I'm using a input template for my players to select their tests. I tried what you sent here, but I got some type errors because the template. But I went through it and now works perfectly! So, this is the entire macro now: &{template:default}{{name=?{Qual é o teste? |Astúcia,Astúcia}} {{Total do Teste: [[@{astúcia}+@{astúcia_foco}+[[1d6]]+[[1d6]]+[[1d6]]]] Astúcia: [[@{astúcia}]] + Foco:[[@{astúcia_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]] |Comunicação, Comunicação}} {{Total do Teste: [[@{comunicação}+@{comunicação_foco}+[[1d6]]+[[1d6]]+[[1d6]]]] Comunicação: [[@{comunicação}]] + Foco:[[@{comunicação_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]] |Constituição, Constituição}} {{Total do Teste: [[@{constituição}+@{constituição_foco}+[[1d6]]+[[1d6]]+[[1d6]]]] Constituição: [[@{constituição}]] + Foco:[[@{constituição_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]] |Destreza, Destreza}} {{Total do Teste: [[@{destreza}+@{destreza_foco}+[[1d6]]+[[1d6]]+[[1d6]]-@{penalidade_da_armadura}]] Destreza: [[@{destreza}]] + Foco:[[@{destreza_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]] Penalidade da Armadura: [[-@{penalidade_da_armadura}]] |Força, Força}} {{Total do Teste: [[@{força}+@{força_foco}+[[1d6]]+[[1d6]]+[[1d6]]]] Força: [[@{força}]] + Foco:[[@{força_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]] |Magia, Magia}} {{Total do Teste: [[@{magia}+@{magia_foco}+[[1d6]]+[[1d6]]+[[1d6]]]] Magia: [[@{magia}]] + Foco:[[@{magia_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]] |Percepção, Percepção}} {{Total do Teste: [[@{percepção}+@{percepção_foco}+[[1d6]]+[[1d6]]+[[1d6]]]] Percepção: [[@{percepção}]] + Foco:[[@{percepção_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]] |Vontade, Vontade}} {{Total do Teste: [[@{vontade}+@{vontade_foco}+[[1d6]]+[[1d6]]+[[1d6]]]] Vontade: [[@{vontade}]] + Foco:[[@{vontade_foco}]] 2D6: $[[0]] + $[[1]] Dado do Dragão: $[[2]] } }} And when I roll it, it shows me a box to select my test: And after select and submit, it will display on chat the results:           I want to thank you very much! You helped me a lot! I'm gonna use Reusing Dice Rolls on every macro that needs it!
1610218461
David M.
Pro
API Scripter
Nice! Note: one annoying limitation of the re-using rolls trick is that you will not be able to perform any math operations, so anything like [[ [[1d10]] + $[[0]] ]] will not work. Other than that, have fun!
Thank you a lot! This will save a so much time on my tests now. *Casts Bless on you*