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

Macro needing two extra "]]"

I have the following macro: {{coluna=[[-?{Modificador de defesa?|0}+?{Tipo de defesa do alvo?|L,[[@{weapontotal}+@{weaponL}]]]] | M,[[@{weapontotal}+@{weaponM}]]]] | P,[[@{weapontotal}+@{weaponP}]]]]}}} The property {{coluna}} gets the defense mod (a number) and a defense type (a letter). Then, it convert this letter to a number (thru the math that follows the ","). It is working properly. However, it seems strange that I had to write to extra "]]" at the end of this inline roll, otherwise it results in an error. Besides, if I invert the elementes order, i.e., write first the "Tipo de Defesa" and second the "Modificador de defesa" it simple does not work. In this case, the final output would be something like "[[-3+L". I tried to put extras "]]" at the end, but it didn't work. Why is this happenning? Is it a bug?
1510855157

Edited 1510855685
chris b.
Pro
Sheet Author
API Scripter
I think you have to replace the } for each @{weaponx}&nbsp; with & #125; otherwise the query ?{.... ends at the first } , it doesn't know how to nest @{field} inside a ?{query|,|,} so here I made one change: you can simplify it even more by only having the query choose weaponL, weaponP, weaponM then add @{weapontotal} outside of your query: {{coluna=[[-?{Modificador de defesa?|0}+[[@{weapontotal}+?{Tipo de defesa do alvo?|L,@{weaponL}|M,@{weaponM}|P,@{weaponP}}]] ]]}} Then to actually fix your problem,&nbsp;then replace } from the references to weaponL, weaponM, weaponP with & #125; (remove space between & and # this makes the code for }&nbsp; <a href="http://www.theukwebdesigncompany.com/articles/enti" rel="nofollow">http://www.theukwebdesigncompany.com/articles/enti</a>... {{coluna=[[-?{Modificador de defesa?|0}+[[@{weapontotal}+?{Tipo de defesa do alvo?|L,@{weaponL&amp;#125;|M,@{weaponM&amp;#125;|P,@{weaponP&amp;#125;}]] ]]}} it is the same problem as in this post: <a href="https://app.roll20.net/forum/post/5748625/%7Bchoose-op1-x1-opt2-x2%7D-with-template" rel="nofollow">https://app.roll20.net/forum/post/5748625/%7Bchoose-op1-x1-opt2-x2%7D-with-template</a>
It's working now! :D Thanks. I don't know why the "}" is different from & #125, though :S
@chris b. Attributes calls (@{}) are exempt from needing to have HTML encoded values. This is because of the order of operations in the chat window. Attribute calls (@{}) are handled before queries (?{}). @Fabio_CM the reason you need the extra ]] in the query is because you start the query with [[, so you need to close it. You can simply move the extra ]] outside of the query and it should still work for you. {{coluna=[[-?{Modificador de defesa?|0}+?{Tipo de defesa do alvo?|L,[[@{weapontotal}+@{weaponL}]] | M,[[@{weapontotal}+@{weaponM}]] | P,[[@{weapontotal}+@{weaponP}]]}]]}}
1511176039
Ziechael
Forum Champion
Sheet Author
API Scripter
To help reinforce what the users above have already mentioned check out the wiki for the&nbsp; full details :)