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

Table rollables, roll template and math operations

I'm making a roll template that calculates the chance of a firearm hit, it should: (1) - take the value of a proficiency (2) - receive a modifier value (3) - receive the amount of shots Of these three factors the system uses a table of the difference between proficiency (1) and modifier (2) as a function of the number of shots (3). Thus the macro should look in the scrollable tables for a table named 1t [profXrdfY] at where: X = (1) - (2) Y = (3) I am using the following code: {{Teste=[[1t[prof?{Proficiência--}+?{Valor}rdf?{RDF=}]]]}} However, it has not worked, would anyone know how to solve?
1567533211
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You need to resolve the addition of Proficiencia and Valor. You can do this using an inline roll: {{Teste=[[1t[prof [[ ?{Proficiência--}+?{Valor} ]] rdf?{RDF=}]]]}} Because of the order of operations, this works because inline rolls are resolved from the inside out (so the most deeply nested roll is resolved first). Also, make sure that you have an actual table made for all the possible value combinations. Personally, it sounds like you are going to need an unreasonable number of tables, but I don't know the system.
Hi Scott, I followed your tip but the code is crashing in the following part for some reason it interrupts and does not read this part of the code: rdf? {RDF =}]]]}} The complete code is: &{template:default}{{name=@{selected|token_name} atacou @{target|character_name}}}{{Proficiência(Nível)=?{Proficiência--|Armadura,@{selected|armadura}|Armas brancas(@{selected|armas_brancas})|Armas de Energia(@{selected|armas_energia})|Armas de projéteis(@{selected|armas_projeteis})|Armas pesadas(@{selected|armas_pesadas})|Arremesso(@{selected|arremesso})|Artes Marciais(@{selected|artes_marciais})|Canhões(@{selected|canhoes})}}}{{Modificador=?{Valor}}}{{Proficiência modif=[[?{Proficiência--}+?{Valor}]]}}{{RDF=?{RDF=|1|3|5|10|20|50|100|150|200|250}}}{{Teste=[[1t[prof[[?{Proficiência--}+?{Valor}]]rdf?{RDF=}]]]}} and yes I have many tables! :) 
1567535857

Edited 1567535890
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, this is an old intermittent bug. Sometimes when doing an inline roll on a table, the parser errors out when you have closing inline roll brackets right after a table call. Just put a space between your table call and the closing inline roll brackets: rdf? {RDF =} ] ] ]}} There's a similar (maybe related?) bug that can happen if you have lots of nested inline roll ending at the same place.
Hello Scott, with your help I managed to move a little but is not perfect yet, see. This code works: {{Test=[[1t[prof?{Proficiency-}rdf?{RDF=}] ]]}} But I need to enter another value that will be added proficiently: +? {Value} If I do like this: {{Test=[[1t[prof?{Proficiency-}+?{Value}rdf?{RDF =}] ]]}} doesn't work, dry out the macro and fill in something in chat. If I do like this: {{Test=[[1t[prof[[?{Proficiency-}+?{Value}]]rdf?{RDF =}] ]]}} He again makes the mistake of interrupting at [[1t [prof15 (where 15 is the sum proficiency + value).