[Script] "One Roll Engine" style dice matching

1500148538

Edited 1500148647
Ean M
Pro
API Scripter
I've run One Roll Engine a bunch of times, and one of the most tedious parts is easily finding sets of dice in Roll20. In realspace you just arrange the dice, and Roll20 lets you sort them, but it's very annoying if you accidentally forget that modifer. My solution? A quick script to watch for an appropriately-shaped dice pool and count the sets in it for you! https://gist.github.com/eepMoody/c363bf1da384f2b56... Intentionally pretty lightweight: doesn't intercept rolls or mess with them in any way, just makes a notes of any sets if the dice pool is the right kind of die (or a !sets modifier was included) For convenient macro purposes I also included a !sets API command that will intercept the roll, append sorting and the !sets roll modifier, and submit that result back. Example output:
1500173329
The Aaron
Pro
API Scripter
Nice!  Looks like you're getting it ready for the 1-click (saw you're globalconfig stuff)?
1500173471
Ean M
Pro
API Scripter
Yep, submitted a PR today, but wanted to make sure I was getting eyes on it at the same time. :)
This is really cool. I've been doing an Reign game for awhile, and we had to switch to a different program since it had built in support. This is going to bring us back to roll20, I think. Is there support for expert and master dice?
1500345397
Ean M
Pro
API Scripter
Technically yes, in that you can write them down when you do your roll and it won't delete them. :) I've been talking to a couple folks about this and think I have a solution for expert dice, but Master Dice I think will always be better to just handle the old-fashioned way. The only way I can see doing Master dice properly would be to do a query popup after every roll that includes one, and I suspect it would get very annoying.  My current thinking is to do something like: /roll 5d10 + 3ed7 + 1md ... if you want to roll 3 expert dice at a value of 7, and 1 master dice that you decide later. 
That's great, thanks. I personally don't think I'd be annoyed by the whole master dice query prompt, but that's up to you.
That looks like a godsend for Hero/Champions players, who have to count 1s and 6s. Good work!
1500832963
Trying this out, as it seems like it would be a good fit for systems like OVA too, where you have to check matches very frequently. Not clear on how it is supposed to work, though - the API one-click install has a user customization option window that asks you to define the die size to watch for, and I set that to 6 (I assume that would mean d6, which is what OVA uses) and saved. In the game, though, it still seems to listen for sets of d10s, not d6s...am I mixing up what's supposed to happen there? (Sorry if I am, I'm a bit of a techidiot. :-P ) Regardless, I can tell this is a very cool bit of code - I mean, sure, you can sort things and count 'em up manually, but it's nice to have something like this to add a line that specifically calls this sort of thing out. Makes it less likely that you'll miss something! And with me...it's always a good thing to have something that makes it less likely that I'll miss something... :-P
1500836162

Edited 1500836197
Ty
Pro
Weird, I just tried it and found the same problem. However, there is a workaround right now. If you type !sets 6d6, for example, it'll get the script to roll the dice and then find sets for them, regardless of what dice size you set.
1500901353
Ah, okay - that's an easy workaround. :-) Can just set up macros / character abilities that way easy enough. Thanks!
1500907623

Edited 1500907771
Ean M
Pro
API Scripter
@Robert thanks for letting me know! The user config settings are tough to test, so I'll have to look into what went wrong. If you want to customize it, you can always download the script and paste it in manually. The line setting the default die size is and right at the top so you can change it to the size of your choice. You're looking for 'Die Size: 10' Maybe one of the arcane scriptomancers like The Aaron can help me review this and figure out what's up...
1500908954
The Aaron
Pro
API Scripter
globalconfig is a bit of a strange beast.  You kind of ran onto this with your code:     var useroptions = (globalconfig &&        ( globalconfig.MatchSets || globalconfig.matchsets )) ||       {'Die Size': 10}; You didn't know what to reference it off of, so tried MatchSets and matchsets both, which is perfectly reasonable.   As it turns out the name of the key that your script is under is assigned manually by the devs when they import and set up the script in the 1-click install.  In this case, they picked something different: {    "onerollengine": {       "version": "latest",       "Die Size": "6",       "lastsaved": "1500908651945"    } } If you change the above code to:     var useroptions = (globalconfig && globalconfig.onerollengine) || {'Die Size': 10}; it should start working.