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

Bug in API rolling of Inline Dice Rolls containing text

1442662280
Lucian
Pro
API Scripter
I've been working on a spellbook that operates as closely as possible with Mark's 5e shaped character sheet. As a result I've been sending some fairly gnarly roll templates with lots of embedded rolls through sendChat. One of these causes the API to blow up on me, and it looks like it's a bug because the same expression works fine in the chat window. I've simplified it down as far as I am able. If you sendChat the following: [[[[2]]dc]] you get this from the api: undefined:197 throw e; ^ Could not determine result type of: [{"type":"M","expr":2},{"type":"C","text":"dc"}] The same expression gives a "2" in the chat window, with a hover text of "Rolling 2dc=2", which is what I would expect. Mark makes quite extensive use of these sort of "hidden" text labels for his inline rolls in the character sheet, but luckily I've only found one instance where the planets are misaligned enough to cause this particular issue. Obviously the real expression in his sheet was *much* more complicated and built up out of dozens of nested variables, but this is the simplest case I can find to reproduce the problem. Cheers, Lucian
1442676692

Edited 1442676782
Placing text that is not wrapped in square brackets at the end of an inline roll provides the illusion of function (notice that [[[[2]]dc+foo+bar+2]] will also "equal 2"). The API is apparently not so easily fooled. To be safe: [[ [[2]][dc] + 0d0 ]]
1442677309

Edited 1442677525
Lucian
Pro
API Scripter
Hmmm, To be fair, in the original example, the "dc" was wrapped in square brackets, I just simplified things a bit to get to the minimal test case. This also breaks: [[[[2]][dc]]] as does [[ [[2]][dc] ]] ... and every other variant that I could think of trying.  In fact, I've just gone back and tested your suggestion and that doesn't work for me either! I get: undefined:197 throw e; ^ SyntaxError: Expected "[" or [ |\t] but "2" found. Does anyone know if there's a formal grammar for all this stuff somewhere? It's a bit of a nightmare trying to double-guess what's supposed to work and what isn't, particularly when different parts of the platform implement things differently! Cheers, Lucian
1442686099
Lucian
Pro
API Scripter
FWIW, I've found another relatively simple inline roll expression that breaks things when used via the API but not in the chat window: [[d20cs>20]] [[d20 + [[2]] ]] In this case it doesn't crash, it just fails to roll the second d20 and outputs it as Lucian
We’ve got a major overhaul of the API on our roadmap, which will hopefully resolve some of these systemic API issues.
1442908354
Lucian
Pro
API Scripter
Hi Ryan, Thanks for replying, it's good to know that this is on the radar. You probably hate this sort of question, but are you able to give a vague indication of what "on our roadmap" means in practice? Different people use that phrase very differently... For you is it closest to: "we know we're going to do it but we really don't know when" "we're intending to do it in the next ~6 months" "we're intending to do it in the next ~3 months" "it's one of the next things we're going to work on" I ask because I'm investing a certain amount of time in building arcane workarounds for some of the problems, and if this is something that's likely to go away in e.g. a month's time I might just wait for an update! Cheers, Lucain
1443143932

Edited 1443145082
Hi Ryan, Just to follow-up on Lucian's request; I would also like a firmer timeline on when the API/die-rolling problems are going to be fixed.  It is pretty galling to purchase "Pro" membership in order to have access to the API functionality and then to find that the functionality isn't fully workable and has bugs that block some pretty fundamental things.  If we could get an approximate timeline on when the API will be fixed (specifically in regards to the rolling issues detailed here and in  other posts on this forum), that would go a long way. Thanks, Remi
Lucian H. said: FWIW, I've found another relatively simple inline roll expression that breaks things when used via the API but not in the chat window: [[d20cs>20]] [[d20 + [[2]] ]] In this case it doesn't crash, it just fails to roll the second d20 and outputs it as Lucian Try putting the 1 in front... as in 1d20.
1443181391
Lucian
Pro
API Scripter
HoneyBadger said: Lucian H. said: FWIW, I've found another relatively simple inline roll expression that breaks things when used via the API but not in the chat window: [[d20cs>20]] [[d20 + [[2]] ]] In this case it doesn't crash, it just fails to roll the second d20 and outputs it as Lucian Try putting the 1 in front... as in 1d20. Nope, same behaviour on [[1d20cs>20]] [[1d20 + [[2]] ]] :