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 .
×
Advertisement Create a free account

[Request?] Script to highlight rolls of 1 / 20 (Fumbles/Criticals)

Caveat:  I have limited programming experience (basic PHP), and know next to nothing about programming in JS for the API.  But, I'm wondering if anyone could point me in the right direction to start working on a script that would highlight rolls of 20 or 1?  Even better, I'd love to have a script that, on specific macros (attack macros), automatically generates a result from a rollable table.   But at the most basic -- if you roll a 20 from a macro tagged in a specific way (named a certain way?), or from a certain critical range (18-20, etc.), then highlight the roll when it occurs with some kind of effect (border, ding, something fun to create player excitement). Hard?  Or, easy?
I'm not sure how hard that is with a script, but the normal dice roller already highlights a 1 in red and the highest number on the dice in green. Highlighting an 18-20 or so isn't possible that way though. Not sure about the rest of your questions, sorry.
1371642114
Alex L.
Pro
Sheet Author
We cant change any of the highlighting for the default rolls but it is possible to do your rolls totaly in the API and have it highlight its output.
I don't know those answers, but I am interested in a script for this as well. I play D&D 4e and with some spells the damage dice change with a crit, so this would be a big feature in gameplay. I think an If Then macro would work for both changing what happens on rolls of 1s and 20s, but also changing the critical hit range to include 18 or 19, but can we yet use If Then macros in Roll20? 
Actually not that hard - at work though 
ok, off work now. as of yet, if/then functions within macros do not exist - I admit, it would be cool, but I have no idea if its a possibility to include them.  Using the API it is possible to write a script that will basically resolve an attack for you - with the right inputs from the character sheet attributes it is possible to have it competely resolve a critical threat chance (3.5) or apply damage appropriately (4ed etc). I suspect the easiest way to simulate what you want though would be to write a die rolling script that outputs the value and prints natural 20s and natural 1's in a different format - something that I'm not familiar with yet. I don't play 4ed so i couldnt really write that script, but its in my plans to write an attack script for 3.5 that will internalize all the rolling and produce only a single line chat message that gives you your results. As there are several different types of attacks, I suspect this will take a while, as i'm not actually a coder. I have to figure out exactly what goes into each attack and have the script simulate that, and provide for all the information required on the character sheet itself. So kinda a big thing to undertake. Still, as I said, Working on it. Currently have my character sheet generator up[ and running, though it may need some work yet as I get into other parts of the combat process, 
TL:DR: Yes, you can do what you ask, but it involves a bit of work and coding. Another guy and myself in our playgroup have built a custom roller for the Dungeonslayers RPG in the API. With it we handle Coups(1's rolled) and Fumbles (20's rolled) and Slaying Dice (Which is like exploding dice on 1's). You always have to roll lower than your CTN (Check target number) but it can be larger than 20, so it breaks down into multiple rolls vs 20's + leftovers. In addition, we can handle <= rolls with math involved which the current /roll command can not do. (You can't do /r 1d20<5 + 1). We take into account player racials/talents/stats (Which they enter in the attribute section of their character journals). We also do this for all the skill checks available in the game.  Here is a current screenshot of the roller we made, still a work in progress. The +60 on the end is to increase the roll to test multiple die rolls as our current stats are not quite breaking 20 on our CTN's yet. A green vs is a coup (automatic max damage and potential slaying dice if it is the first dice rolled) a vs prefixed with S is an exploding slaying dice, a coup without a slaying dice after it is a roll that was 1 without being the first dice rolled (you can allocate your rolled dice to all your checks as you see fit). A fumble (not seen here) is a critical fail and is a purple background on the vs. a red vs would be a miss (only possible on a CTN less than 20). (If this seems confusing dice rolling rules, it is at first). The CTN = part is what stats/talents add in to the final check. Since there are 3 20's and a 15 that means the final check was 75.
must... have... copy...of....your....code! that is a brilliant and well laid out output - I would really like to see the code that produced that. Its what I plan on doing for 3.5 - obviously not as complicated a method, but would love to see the code for this kind of output. 
Well be posting our Dungeonslayer scripts after we make them not so hack and slash and finish up some features our playgroup has been asking for. The outputs looks is just some styling with the /direct command on a table, nothing fancy.
I love the layout/style of the SS above, by Nietsnie. Nicely done! Posted this in the specific use forum as well, but it may be more appropriate here, so: Given the above screenie, I assume it is possible to turn the macro result shown below: into this: or something similar, using the API system already in place. If so, I'd love to speak with someone who could do the coding for me, as I have neither the skill, time or inclination to do so myself. I will happily consider compensation for such, if necessary. Thanks!
1372774058
Alex L.
Pro
Sheet Author
<a href="https://app.roll20.net/forum/post/223290/bug-slash-problem-message-order#post-223290" rel="nofollow">https://app.roll20.net/forum/post/223290/bug-slash-problem-message-order#post-223290</a> the code i am using here formats it the way you want, but currently i am having problems as the thread describes.
DM Giantsauce said: ... OMG why is that not the default Roll20 dice roll formatting! &nbsp;:p
The code Alex L. provides is great! I am new to scripts though. How would I take advantage of a script like that? Not sure how to set it up to pull attributes from the character journal in that script? We play D&amp;D 4E, so it would be pulling things like melee weapon proficiency, strength modifier, feat bonuses, and magic weapon bonuses. I love that this script will display where all the roll bonuses are coming from! Also, since we have a warlord who provides temporary round attack bonuses.. So it would be great (although probably complicated) if I could make or find a code that gives other players and attack bonus if there is a status marker active on another character or if players are inside of an aura.. If anyone has any ideas or links that would help, I would be grateful!
1374615642
Alex L.
Pro
Sheet Author
Christopher said: The code Alex L. provides is great! I am new to scripts though. How would I take advantage of a script like that? Not sure how to set it up to pull attributes from the character journal in that script? We play D&amp;D 4E, so it would be pulling things like melee weapon proficiency, strength modifier, feat bonuses, and magic weapon bonuses. I love that this script will display where all the roll bonuses are coming from! Also, since we have a warlord who provides temporary round attack bonuses.. So it would be great (although probably complicated) if I could make or find a code that gives other players and attack bonus if there is a status marker active on another character or if players are inside of an aura.. If anyone has any ideas or links that would help, I would be grateful! I would sugest just using inline rolling.
All I see on Inline Rolling is from the Roll20 Wiki with the example roll /roll [[2d6]]d5. Is this what you mean?
1374730224
Alex L.
Pro
Sheet Author
Christopher said: All I see on Inline Rolling is from the Roll20 Wiki with the example roll /roll [[2d6]]d5. Is this what you mean? you can just type: "Christopher strikes with his mighty sword dealing [[2d6+6]] damage" or something and it will put the number in the line