Closed Daniel-Leinberger closed 4 months ago
Never mind... seems like I forgot to copy-paste the dice regex underneath the "advanced"-tab to my new layout... Maybe this was prefilled in the old version, and that's why I didn't noticed it to need it...
So for everyone having the same problem, just follow these steps:
Sorry for the useless issue. Great job this plugin :)
I am reopening this because it should inherit the old defaults if none are provided.
I have the exact same issue. Before the last update, the formula : Damage: 5 (1d5+3) in my custom layout would show the dice roller as in the Basic 5e Layout.
Now as you can see on the screenshot, on the left, the custom layout does not work anymore, but the Basic 5e Layout does.
@Daniel-Leinberger I followed your instructions, but in the "Advanced" tab of the Basic 5e Layout, there is no Regex to copy/paste. Same with any other layouts.
@GladLantern
Interesting... I've got the following and I clearly did not code it myself because I don't know anything about this specific stuff 😅
([+-])(\d+) to hit
let [, sign, number] = matches;
let mult = 1;
if (sign === "-") {
mult = -1;
}
if (!isNaN(Number(number))) {
return {
text: 1d20+${mult * Number(number)}
,
original
}
}
(\d+)\s((\d+d\d+(?:\s[+-]\s\d+)?)) let [, base, dice] = matches; let text; if (!isNaN(Number(base)) && dice) { text = dice; } return { text, original };
. ([+-]\d+)
let [, save, sign, number] = matches;
let mult = 1;
if (sign === "-") {
mult = -1;
}
let text;
if (!isNaN(Number(number))) {
text = 1d20+${mult * Number(number)}
;
original = ${save} ${sign}${number}
;
}
return { text, original };
Do you may have a different Version?
@Daniel-Leinberger thank you, it worked :) I had to copy/past the code in my custom layout json file.
Hey, the UX around this should be better. Could you please check?
@valentine195 I updated the plugin yesterday and yes, it works and the UX is clearer. Thank you !
Check for existing bug reports before submitting.
Expected Behavior
When I used a custom layout in the past, I was able to use the formula
0 (1d20 + 1)
to activate the dice roller addon inside a string or any kind of block.I used it in my own layout to describe the value of ability and had the formula after that to see my base value and then my rolled value like
strength: 14 | 0 (1d20+2)
orstrength: "14 | 0 (1d20+2)"
, which allowed me to see my strength of 14 at all times but roll for it if needed.Current behaviour
Within a few newer patches (I didn't updated in a long time - last time I know it worked was Fantasy Statblocks v 3.8.4 and Dice Roller 9.30) the parser for dices is not correctly displayed for Property lines (see picture below).
I just updated one of my vaults where I had the formula given in "expected behavior" and after the update, it just parses the formula as plain string.
But if I use the standard Base 5e Layout it's working all fine. see in the picture below:
I don't know what I'm doing wrong here and before the update it was all working fine. Therefore, I assume it's a little bug. But if not I'm happy to hear, what's the solution for the problem.
Reproduction
You should see the same statblocks as in my screenshot. Everything in the Base layout is transforming properly but nothing inside my own layout.
Which Operating Systems are you using?
Obsidian Version Check
1.5.3
Plugin Version
3.19.2
Confirmation
Possible solution
No response