ChapelR / custom-macros-for-sugarcube-2

A collection of systems and macros for Twine.
https://macros.twinelab.net/
The Unlicense
166 stars 44 forks source link

Dice function not working for dices with 10 or more faces #51

Closed 80jota4U closed 3 years ago

80jota4U commented 3 years ago

Dice function seems not to behave correctly when used with dice with 2 digit or more e.g. dice('1d10'). It always retun 1.

Reviewing js code it seems that there is a typo in the regex: string.match(/(\d+[d][\df]d*)(.*)/i) Should be instead: string.match(/(\d+[d][\df]\d*)(.*)/i)

Tested locally and after dice('1d10') correctly returns a number between 1 and 10.

Thanks a lot for your work!

ChapelR commented 3 years ago

Thanks I'll look into it.