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

[Looking for] Script for Dice rolls in Qin: The Warring States

Hello, I am looking for a script which imitates the dice roll mechanic of Qin. Qin uses 2d10 one of those is black (Yin) the other one white (Yan) That is the involved mechanic: 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. On top of that I need to know which of the 2 dice the higher one was. There are some abilities that have positive or negative results based around it. A Yan ability is boosted if the higher dice was the white die. Rolling a  zero is possible in this system, if that happens it should show what results the dice had. I hope this isn't to much of a hassle, since I don't know anything about coding. Thanks for reading.
1459637494
The Aaron
Pro
API Scripter
So, everyone makes the same roll?  No adjustments to one die or the other depending on class/character/circumstance?  
1459639525

Edited 1459639682
There are no adjustments to the roll itself. A Test works as follows = Aspect/Attribute (+ Skill) + The roll vs a target number. Since there is no Character sheet at the moment for the game, I am planning to only use the dice function of roll20 at the moment for the game. Hence there is no need to take the atributes and skills into account. That is why I "only" need a script that rolls 2d10, substracts the lower result from the higher one and tells me if the higher one was the yin or yan dice.
1459639800
The Aaron
Pro
API Scripter
Ok, I threw something together real quick.  It's not a full featured script, more of a snippet but it should get the job done until I have time to write something better.  Let me know if it needs any changes. Commands : !qin -- does a roll of two d10s, one black, one white and presents the results.  A black background indicates black was higher, a white background indicates white was higher, a grey background indicates equality.  Pointing to the roll will show what the dice were.  You can add a message after the command and it will be displayed after the result. !wqin -- the same as !qin, but the result is whispered to the player !bqin -- the same as !qin, but the result is sent to the gm (blind). Examples :  (note, I added the speaking as name of who issued the command toward the bottom, but all messages will have it) Source: on('ready',function(){     "use strict"; on('chat:message',function(msg){ var content,black,white,cmd,res,colors,who,src; cmd =msg.content.match(/^!(w|b)?qin\b/); if('api' === msg.type && cmd ){ content = _.rest(msg.content.split(/\s+/)); black=randomInteger(10); white=randomInteger(10); res = Math.abs(black-white); colors = ( black > white ? {b: '#000',f:'#fff'} : white > black ? {b: '#fff',f:'#000'} : {b: '#ccc',f:'#666'} ); who = ('w' === cmd[1] ? '/w "'+getObj('player',msg.playerid).get('displayname')+'" ' : 'b' === cmd[1] ? '/w gm ' : '' );             src = ' ['+msg.who+']' ; sendChat('Qin'+src, who+'<div><span title="'+black+' [Black] | '+white+' [White]" class="showtip tipsy-n" style="display:inline-block;background-color:'+colors.b+';color:'+colors.f+';border: 2px solid '+colors.f+';padding: .1em .2em;">'+res+'</span> '+content.join(' ')+'</div>'); } }); });
I just grabbed a friend of mine to try it and it works just fine. We didn't notice any problems. Thank you very much.
1459643605
The Aaron
Pro
API Scripter
No problem, I'm happy to help!  Let me know if you come across some enhancements you'd like. Happy rolling!