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

brackets and html code, none of them have worked

September 05 (5 years ago)
ThiagoR
Sheet Author

In another topic I was having the following difficulty, I got help from Scott and I was able to move on but I haven't solved the problem yet:


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=}]]]}}

With his tips I came to this:

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=}]]]}}


Following the querys wiki replaces the brackets with the equivalent html symbol, I've had changes, but it still didn't work:


Using the html code the macro assembles all the rollable table equation I need 1 [tprofXrdfY] (where X and Y are the results of queries) except that it doesn't turn the equation into the rollable table result I need.


Would anyone know how to solve?

September 05 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

I wouldnt be surprised if you needed to replace that last ? with its html replacement (and maybe one or more characters).

I'm curious about your tables, and if there's a way to convert it into a roll instead of relying on a table lookup. Many tables can be reduced to a dice roll.

September 05 (5 years ago)
ThiagoR
Sheet Author

I made these replacements but the error persists.

{{Teste=[[1t[prof[[?{Proficiência--}+?{Modificador=?}]]rdf?{RDF=}]] ]}}


This is the table:

September 05 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

when making html replacements, you need to use a light touch. Replace only the characters that are needed, starting with the ones most likely to be the culprit. replacing the wrong ones will cause it to error, too.

That does look like a tricky table to convert into an expression. i see something tricky: the modifier column has gaps, likewise the ROF. If uses dont enter the extact numbers, you'll end up with an invalid table name. Imagine someone enters a proficiency of 3 and a valor of 1. Are proficiency modifiers always odd, and valor modifiers always even? If not, you;ll have a problem.

September 05 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

On thing to try is removing any arithmetic operators from your query names.

Change

Proficiência--

to

Proficiência

and 

RDF=

to

RDF

I doubt they are causing issues, but it's worth a try.

It occurs to me there may be in issue in your rolltemplate. Does this code work if you just enter it in chat:

[[1t[prof[[?{Proficiência}+?{Valor}]]rdf?{RDF}] ]]

I'd also put a space in at the end there, between the table closing and the inline rolls closing. That has been known to cause issues.


September 05 (5 years ago)
ThiagoR
Sheet Author
I made the HTML substitutions one by one and always fall into one of the following:

1 - the code is interrupted at: [[1t [profX, as in the image:



or the code completes but does not return the value of the table.


I removed all arithmetic operators but the error persists as you predicted.

This code didn't work in chat either, it gave the same error:

[[1t[prof[[?{Proficiência}+?{Valor}]]rdf?{RDF}] ]]


I put the space between the brackets as suggested by you and Scott but it didn't work either!
The roll template i'm using is the default.

I am not sure which way to go to try to unravel this mystery :(

September 05 (5 years ago)
ThiagoR
Sheet Author

The complete code is:

&{template:default}{{name=@{selected|token_name} atacou @{target|character_name} }}{{Proficiência(Nível)=?{Proficiencia|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=?{Modificador}}}{{Proficiência modif.=[[?{Proficiencia}+?{Modificador}]]}}{{RDF=?{RDF|1|3|5|10|20|50|100|150|200|250} }}{{Teste=[[1t[prof[[?{Proficiencia}+?{Modificador}]]rdf?{RDF}]]]}}
September 05 (5 years ago)

Edited September 05 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

I've just done some testing, and its the inline rolls inside the table name that are breaking it

This will work

[[1t[prof?{Proficiência}rdf?{RDF}] ]]

But any attempt to have an inline roll inside the table name fails.

So if you dont use Proficiência and valor, but just ask for the total of the two, you can get it working.

September 05 (5 years ago)
ThiagoR
Sheet Author

but how to order the total of both?

September 05 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

You have to let players add the total up in their heads and enter that total as a single number.

September 05 (5 years ago)
ThiagoR
Sheet Author

Can't declare a variable that stores this total?

September 05 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

No, it has to be a single number.

You could create a separate table for each combination of proficiency and valor in the table name, which would likely by a lot of tables. that looks like its the only way to do it using a macro like this.

You are probably better off using a custom script to deal with this if you absolutely want people to enter separate queries for proficiency and valor. That has the advantage that you wouldnt need to use a set of tables at all.

September 05 (5 years ago)
ThiagoR
Sheet Author

This is as close as I get so far, it assembles the whole equation to invoke the table but for some reason it is not invoked.


{{Teste=[[1t[prof[[?{Proficiencia}+?{Modificador}rdf?{RDF}] ]] }}
September 06 (5 years ago)

Edited September 06 (5 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

Ok, so, it looks like there is a hiccup in using inline rolls nested in a table call. The inline roll has to be the first part of the table name. If you change your table name format to be:

XprofYrdf

It should work. The inline roll code would look like this:

[[1t[[[?{Proficiencia}+?{Modificador}]]prof?{RDF}rdf] ]]

EDIT: Note, should work as long as RDF doesn't have to be a calculated value.

September 06 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

good investigative work, Scott. Nice to know for the future.

September 06 (5 years ago)
ThiagoR
Sheet Author

Many thanks to you two, Scott and GiGs, I was almost giving up trying to solve this problem!

May the dice gods always give you good results!

September 06 (5 years ago)
GiGs
Pro
Sheet Author
API Scripter

You're welcome. roll20's macros can be very tricky!