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

Script Help: Die Roller

Hello. I hope this is not considered too cheeky but I thought I'd chance my arm with a script request. I am hoping to run Qin: The Warring States through roll20. The basic die mechanic is: Roll the two ten-sided dice and subtract the lower result from the higher to get the final result of the roll, which can of course never be a negative number. A zero is a real zero, and not a ten, as in many role playing games. The final result will be a number between 0 and 9, a player defined modifier will be added to this total. I am trying to learn scripting by working through the Codeacademy, but hope to play this game sooner than I think I'll be able to write my own dice roller script. So as stated in the opening paragraph I am hoping someone will be kind enough to code this for me. Many thanks to anyone who can help with this. Thanks in advance.
1399749629
Lithl
Pro
Sheet Author
API Scripter
There's no need for the API to accomplish this on the Dev server right now, which has access to the absolute value function in the dice roller. /roll abs(d10-d10)+?{Modifier|0} or [[abs(d10-d10)+?{Modifier|0}]] . Once the stuff on Dev is pushed to production (which I believe is scheduled for later this month), you'll be able to do that in any game. Note that the "0-9" bit doesn't really matter, since the math is: (d10-1)-(d10-1) = d10-1-d10+1 = d10-d10 . The above will look a little odd if you like using the 3D dice and you're expecting 10s to be 0 (1s will be 0, 10s will be 9), but the API wouldn't help on the front, anyway.
Thanks. I'll give this a try. I thought I would need a script to ensure that the lower rolled D10 was taken from the higher rolled d10. It's great if that can be achieved with the dev roller.
Over the moon with that. Thank you.
Apologies I have run into an issue with this macro. The zero on a D10 being read as a Zero does have an impact on the mechanic. With the above macro the 2 d10's roll a 10 and a 1, the macro will give a total of 9 for this roll. As the mechanic reads the 10 as a zero the total of this roll should be 1 (1-0). Can this be achieved through the roller or would a script be required? Thanks
1399811353

Edited 1399814683
Mister Sinister
Sheet Author
I guess this would work rolling a d10-1 rather than a d10 but I can't work out how to make the macro take the lowest number from the highest. Edit- Apologies I should have tried harder this seems to work: [[abs((1d10-1)-(1d10-1))+?{Modifier|0}]]
1399849006
Lithl
Pro
Sheet Author
API Scripter
(1d10-1)-(1d10-1) is exactly equal to 1d10-1d10. Seeing a "10 and a 1" is what would be equivalent to seeing a "9 and a 0", not a "0 and a 1".