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

Variable from other dropdown query in this dropdown query

1577237484

Edited 1577237563
Hi, I'm having some issue. My spells hit chances depends on a "scaling" variable. I can set the scaling one, and the hit part works aswell. But when I try to add the scaling variable to the hit chance dropdown query it breaks. Current hit chance dropdown (dropdown since it has two ways of being): {{slag=?{Slagtyp|Summa, @{maginamn_display} = [[@{magifv_display}+1d20+@{magimod_display}]]|Motstånd, @{maginamn_display} <-> [[@{magifv_display}-1d20+@{magimod_display}]]}}}" when I try to incorporate the scaling variable (E - bolded and italiced) as shown here  it breaks: {{slag=?{Slagtyp|Summa, @{maginamn_display} = [[@{magifv_display}+1d20+@{magimod_display} -?{E} ]]|Motstånd, @{maginamn_display} <-> [[@{magifv_display}-1d20+@{magimod_display}]]}}}" I'm used to scripting but new to roll20, what am I doing wrong?
1577241293
GiGs
Pro
Sheet Author
API Scripter
My first guess would be html entities and query interaction. This part -?{E} is representing a query that looks like this? -?{E} It looks like it should work, but your expressions do look a bit weird. What do the expressions you are building actually do? if we understood that we may be able to suggest a better way of building the expressions. For instance, the <-> symbol is confusing me. One thing to do to simplify testing: paste the parts into chat that you need to test. For instance, get ride of the outer {{slag=}} part. Another thing you should be trying to do: move everything outside the query you can, like the @{maginam_display} at the start of each term.
GiGs said: My first guess would be html entities and query interaction. This part -?{E} is representing a query that looks like this? -?{E} That's correct. I'm using a template and one of the fields is this multiplier {{Effektgrad = ?{E|1}}} GiGs said: It looks like it should work, but your expressions do look a bit weird. What do the expressions you are building actually do? if we understood that we may be able to suggest a better way of building the expressions. For instance, the <-> symbol is confusing me. It's creating two different strings with different logic. The dropdown selects which of the two modes that should be used. A sum of the skill and 1d20 and any modification Jump = 27 A comparison of the skill to 1d20 to see the difference, along with any modifications Jump <-> -4 They look the same, so I distinguish between them vith the signs "=" and "<->". My original plan was to use this dropdown value, which mode, as a subheader in the template, but couldn't find a way to get what value that had been selected i.e for ?{demo|first, [[some logic goes here]]}, "?{demo}" results in the logic being run again, not returning "first".
1577302154
GiGs
Pro
Sheet Author
API Scripter
Necris said: GiGs said: My first guess would be html entities and query interaction. This part -?{E} is representing a query that looks like this? -?{E} That's correct. I'm using a template and one of the fields is this multiplier {{Effektgrad = ?{E|1}}} GiGs said: It looks like it should work, but your expressions do look a bit weird. What do the expressions you are building actually do? if we understood that we may be able to suggest a better way of building the expressions. For instance, the <-> symbol is confusing me. It's creating two different strings with different logic. The dropdown selects which of the two modes that should be used. A sum of the skill and 1d20 and any modification Jump = 27 A comparison of the skill to 1d20 to see the difference, along with any modifications Jump <-> -4 They look the same, so I distinguish between them vith the signs "=" and "<->". My original plan was to use this dropdown value, which mode, as a subheader in the template, but couldn't find a way to get what value that had been selected i.e for ?{demo|first, [[some logic goes here]]}, "?{demo}" results in the logic being run again, not returning "first". If you call a query with the same name multiple times in a macro, it will return the same result each time after the first. So in the above example, lets say you run this ?{demo|first, [[some logic goes here]]} and select first.  If you then have ?{demo} again, it will use  [[some logic goes here]] because that is the result of the query. The "first" part is just the label displayed to the user, the bit after the comma is actual result of the query.
Thanks. Not the answer I was hoping for, but atleast now I know :)
1577581961
GiGs
Pro
Sheet Author
API Scripter
As a Pro user, you can overcome the limitations of the basic macros with an API script. It can be a bit much to make scripts to replace individual macros though. It's extra work, so it's better if they serve a general purpose that you'll reuse a lot.