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

Dice math is hard on roll20 - Need help with dice mechanic.

Hey everyone. So the group have picked up a new game with a new dice mechanic. At the table it's really simple, but trying to automate it in roll20 is way beyond me. The normal roll is a standard 1d100 equal or lower than the skillvalue. So if Mr.Fighter have 75 in Swordsmanship, failure is 76 or above on the d100. However, what complicates things is that the roll can also be " open " or " closed " which is how difficult the roll is. An open roll always succeeds if the single digit is equal or less than a specific number, lets say 3 for a very easy roll. If Mr.Fighter with his 75 skill rolls 82 on a open (3) roll then he still succeeds as the single digit (2) is less than (3). In the same way a closed roll always fail if the single digit is equal or less than that specific number, so a closed (5) roll will have a 50% risk of failure even before you start rolling. To further screw with my meager "scripting" skills there are exceptional results . Any time both the ten-digit and single-digit is the same, 11, 22, 33, 44 etc, the roll is exceptional. If the roll is successful and exceptional it's an Exceptional success . Likewise the roll can also be an exceptional failure in the same way. The script would need to check if it's open or closed and if the single-digit is <= than the value, then it would need to check if roll <= than the Skill value, and lastly check if the ten-digit and single-digit is the same, while also check if the roll was successful or a failure. So, anyone feel the need to earn my everlasting gratitude in helping my group back to roll20 instead of having to awkwardly socialize around a real table?
1480198106

Edited 1480198314
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I think this lies within my scripting ability. How would you prefer the interface, as in how would you see being able to designate each of these special roll results? I could see doing something like !roll[open/closed:target number] normal contents of chat message Are there always exceptional results, or is that only sometimes? also, how would you see the output differentiating between the various rolls? Solely by tooltip text or by some special formatting similar to critical/fumble in base roll20 dice engine? And then finally, what system is this? Is there a place I could go to look at the rules?
1480206814

Edited 1480207140
Oden
KS Backer
Hi Scott, and thanks for helping out. :) At first just something everyone can use to roll, so a simple command prompt for the chat. This would be enough to start playing. !roll skillvalue oX for an open roll, ex !roll 75o3 and !roll skillvalue cX, ex !roll 83c4 for a closed one sounds about right. Exceptional results can happen on all rolls so no exceptions.Using the green and red colors from roll20's standard crit/fail as you said would be sweet. I also forgot that sometimes the result of the roll is used. The result is always the sum of the two digits, so on a roll of 65, the result would be 6+5=11. Perhaps squeeze that in somewhere. So a roll like !roll 57o1 would tell me if it's either a Exceptional success , Success , Fail  or Exceptional Fail  and what the result is. If possible perhaps hide the checks and die-rolls unless you hover over it. Later when i'm done with the sheet i'd like to use roll buttons at each skill. This would perhaps need a prompt to open asking you to type in a positive number (open roll) or a negative number (closed). Even later, or sooner if it's easier, perhaps some kind of fancy roll template but i do believe this has nothing to do with the main rolling api script am i right? The system is a swedish one called "Hjältarnas tid" (Time of Heroes). There is a demopack  HERE that is free as a tryout but as i said only in swedish. The whole game is only available in book form for order right now. Edit for typos.
1480209047
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, I can certainly do the API script stuff, the roll templates (and the sheet roll buttons) will be part of the sheet which I have no experience with. You could set the sheet up so that the roll buttons have the API call in them. im thinking that roll tags to define the open/close points would be the best way: !d100 [[1d100>85[type:open,target:4]]] as an example
That should work fine. So if the player want to roll, what would he type into the chat? Knowing my players the shorter the command the lower the risk of mucking it up. :) Also since i posted in the API forum that's what i need help with. Don't worry about templates or sheets as i'm still trying to learn that for myself first.
1480258417
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The API command can be whatever you want. ATM, I'm just using "!roll " as the triggering API command. I'm also setting it up so that you would simply put the API command in front of whatever you would normally have put in chat, so "/w gm [[1d100<50]]", with an open roll target of 4, would be typed as "!roll /w gm [[1d100<50[type:open,target:4][a Roll label if you want to have one in the output] ]]". The script will get rid of the "!roll " before outputting the final, processed roll result. Speaking of the final processed roll result, what information do you need available from the chat output, and how would you like it displayed? whether the success/fail was due to an open/closed situation? only shown in the tooltip? Formatting for results Display just 0/1 for fail/success like base Roll20 chat parser does, or show words - success, failure, or exceptional success/failure Color coding of dice results? use the same inline roll appearance as the base chat parser?
1480260448

Edited 1480261625
Oden
KS Backer
Hmm. As little clutter as possible at a first look. This would mean only showing the outcome and the result, like "Mr.Fighter Succeeds by 15". The tooltip can instead contain why he succeeded. I'm on the fence about colorcoding the exceptional results. It may not be needed if the text says Exceptionally succeeds/fails.  If possible i think the result should be something like [Player or token name] [Outcome] at [Skill if mentioned] by [Result]. So it could look like: Mr.Fighter succeeds at Swordsmanship by 12. Mr.Fighter fails at Alchemy by 17. Mr.Fighter succeeds exceptionally at Sneaking by 5. Mr.Fighter fails exceptionally at Swimming by 12. Player123 fails by 13. Goblin succeeds by 3.
1480264103

Edited 1480264147
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, passing the skill is possible, but would require a bunch of extra command syntax as the api doesn't actually see attribute calls like @{Swordsmanship}; it just sees the value that that call was replaced with. Most of the format you demonstrate could be achieved by placing the roll in the proper place with the syntax I've got going at the moment. !roll @{selected|character_name} [[1d100<30[type:open,target:3] ]] at Swordsmanship Could give: Mr. Fighter succeeds by 12 at Swordsmanship Mr. Fighter succeeds exceptionally by -5 at Swordsmanship -- If you want the number by which the character succeeded/failed; this is an example of what would happen if the success was due to an open roll that succeeded because the ones digit was less than/equal to the target number. Does the amount by which the character succeeds/fails matter though? Currently I've got it set up (once I get the formatting finished at least) so that !roll [[1d100<30[type:open,target:3] ]] Will give chat output: Exceptional Success, Success, Failure, or Exceptional Failure  with a tooltip: Rolling 1d100<30 = 20<30 Would that work? Scott EDIT: Also, would you like the output in Swedish or in English? I'll need you to translate if you want it in Swedish, but it's certainly possible.
1480266673

Edited 1480266826
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Here's the output that I've got so far (failures and exceptional failures also work, just didn't capture them with the screenshot): From this chat command: !roll &{template:default} {{name=Success Test}} {{Roll=[[1d100<40[type:open,target:3] ]]}} {{damage=[[1d6]]}} The beta code is available from my  gists . Let me know what you think, what works, and what needs to be changed. Scott
Thanks Scott. I will try them tomorrow as the workload is devouring my free time again so i haven't had time to look at it yet. But i can atleast say no need to translate anything, English is fine.
1480369595
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Sounds good, I totally understand about work tho. Mine is also ramping up
Hi Scott, i'm back. I have played around with the script a bit now and as functions go the only thing left i feel is the result. Otherwise it's mostly complete and ready to go already.  After that i can take my time finishing the sheet and any macros, oh and give you a cookie or something for your help. =)
1480576500
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
And, I just realized I misread one of your earlier posts about how the system works. I can definitely get that result in there (sum of the two digits). I'll also work on getting the amount by which the roll was beaten/failed in there.
Hi Scott, thanks again for the help. I have tested the script some more and also begun to integrate it into the sheet by roll buttons. Right now When you click the button a query window pops up asking for the target number modifier. All of this works as intended except for one small bug. If the target number is left at 0, as in no special target number, any roll with a single digit 0 (10,20,30,40,50,60,70,80,90,100) shows as a success. Is it possible to make an exception for the 0 target number to fix this? 
1480875556
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
so, when the target number is at 0, the roll is essentially neither open or closed correct?
Scott C. said: so, when the target number is at 0, the roll is essentially neither open or closed correct? Indeed. When target number is 0 the only thing that should matter is the Skillvalue you roll against.
1480892978
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, ok. I can probably work that in. In the meantime you can fib it by adjusting your macro to not create a target # on a 0.
Oh, is it that simple? Didn't know you could do that trough the macro. I will see if i can find how to do that.  =)
1481048941

Edited 1481050030
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Assuming I programmed it correctly, then yes. That may be a big assumption though ;). EDIT: To be safe, I'd set it up so that there just isn't the [type:closed/open,target:#] after the d100. EDIT the SECOND: Something like this should work for the query: [[1d100>40?{Open/Close|Open,[type:open,target:?{Open Target #|1,2,3,4,5,6,7,8,9}]|Closed,[type:closed,target:?{Closed Target #|1,2,3,4,5,6,7,8,9}] |Neither, }]]
1481050070
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Just realized that that should have been 1d100<40, but not gonna edit it since then the forum will eat the html replacements for the nested roll queries.
1481142667
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Mark 2 is  here . The tooltip now displays the result of the sum of the digits of the d100 result. Also put handling in so that you don't need that complicated roll query any more for target numbers of 0.
1481464325

Edited 1481464371
Oden
KS Backer
Hiya Scott. Just tested out the Mk II and very nice work. Everything now works as intended and i can't find any other bugs. Also thanks for adding the result to the tooltip, is there a query/name for it if i want the result to show up in the template and not only in the tooltip?
1481466257
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, I can add that into the result easily enough. Just did the tooltip because I wasn't sure how much you wanted in the chat result. Something like: Exceptional result with result of X or X is an exceptional success or Exceptional success/failure Result:X Or something else?
Preferably show it on successful rolls but not on fails like below. Exceptionally succeeds by X.            *X is the result. Succeeds by X.                                  *X is the result. Exceptionally fails.                             No result as it doesn't matter on fails. Fails.                                                  Same here. no result because failure.
1481470001
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
ah, ok, that's certainly doable. Will you ever need to use the result in another roll (I'm not sure off the top of my head how we might handle that if you do)?
1481471789

Edited 1481472196
Oden
KS Backer
The only thing i ever need to get out of the roll is the [Exceptional success, Success, Fail, Exceptional fail] state and the [Result] number.  The order of which it's shown i can fix in the macro. Edit:  Ah i guess you meant if i would need to use the actual result for some other things. I'm a bit slow today. The answer is no. The result is there as a measure of how well  you succeed and as a tiebreaker if two opponents both succeed, then the highest result wins. It has no further functions that need to be coded.
1481996468

Edited 1481996564
Oden
KS Backer
Well, after a weeks work i read the rules again today and feel stupid. The result is simply the dice result, for example if you roll 76 your result is 76, or if you roll is 45 your result is 45. I have no idea where the other drivel came from, probably some other system i had in my head. o.0 So if it's possible, that's what i would want showing in the chat. Exceptional/Success/Fail and the dice result. In either case happy holidays.
1482000939
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Easily done
1482352719
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Would you ever have a modifier on your roll (e.g. 1d100 - Y < X)? and if so, would you want the displayed result to be the dice roll, or the dice roll +/- the modifier(s)?
Yes there are a few instances when that happens, for example Swordskill +20 or Searching +10 due to some abilities. Some other abilities raise only the Result in case of a success.  For example Ability 1 raises the chance to succeed by +20, so a skill of 56 becomes 76 to succeed and gives a higher result ceiling. Ability 2 raises the result of a successful roll by +20, so a roll of 50 have a result of 70, but does nothing if the roll failed. Both of these are rather uncommon abilities and that's the reason i didn't mention it for the script. But if you could add one or the other that would be a nice touch. I'm not sure how it would be displayed in a clean manner though.