
So with Dark Heresy second edition they changed the RAW formula for successes. In a paraphrase you know get 1 success (or failure) for meeting or exceeding the roll. Then you get a number of additional success or failures based on subtracting the 10s digits of (the roll) and the (target number + Modifiers). The closest I can come, just using macros is this (ex. Melee attack): round(((@{selected|WeaponSkill} + ?{Modifier|0})-1d100)/10) This solves for the additional success or failures, but you will always need to increase the absolute value by 1 for the total, and note if it was a success or failure based on the sign of the results (Positive = Success, Negative = Failure). I am looking to undertake writing and API that will do the full calculation and provide a clean result back to the user. That said, I am very new to roll20 and while I have coded in several other languages I am rapidly learning Javascript now just for this purpose. I thought I would post here to see how others, if interested, might code this for roll20. Desired Call: !roll40k tokenName, attribute, modifer or !roll40k tokenName, attribute //Modifer will be acquired from user as part of the API Desired Output: I am looking to make the final output something like this: ' Jack 's target number is 45 and they rolled a 32 getting 2 success(es) !' or ' Jack 's target number is 45 and they rolled a 84 getting 5 failure(s) !' "[Token Name]'s target number is [baseTarget + totalMod] and they rolled a [rollResult] getting [numOfSuccess] [resultType]!' - rollResult = 1d100 - Parameters should include the token making the roll, and the attribute that would make up the baseTarget number. - The modifier could either be a passed parameter or be generated in the API, but should ask the user to enter it. Advanced: 100 is an automatic failures, while 1 is an automatic success so eventually this would account for those two and ensure that the right number of failures and successes are calculated even if one of those results in the normal calculation would prove otherwise. I have coded this for another tool (gasp) once before and here is my code: [h: attackType = "Melee, Ranged"] [h: actionVal = 0] //Prompt user to select if this is a Melee attack or Ranged attack //Prompt user to check if they are attacking a vehicle, used to determine hit results [h: status = input( "attack|"+ attackType +"|Attack Type|RADIO|ORIENT=H SELECT=1", "vehicle|0|Attacking a vehicle|CHECK")] [h: abort(status)] [h, if(attack == 0), CODE: { [attackChar = getProperty("Weapon Skill")] [attackDesc = "Weapon Skill"] [outputAttack = "Melee"] }; { [attackChar = getProperty("Ballistic Skill")] [attackDesc = "Ballistic Skill"] [outputAttack = "Ranged"] }] [h, if(vehicle == 1), CODE: { [locTypeList = "Hull, Side, Rear"] }; { [locTypeList = "Arm, Body, Head, Leg"] }] //Prompts user to input a modifier for the roll //Allows user to call a shot to a specific location on target [h: status = input( "junkVar||"+ outputAttack +" Attack|LABEL|TEXT=FALSE", "mod|0|Enter Modifier", "tgt|"+ attackChar +"|"+ attackDesc, "callShot|"+ locTypeList +"|Called Shot Location|LIST|VALUE=STRING")] [h: abort(status)] [h: roll = 1d100] [h: modifier = mod] [h: modTgt = tgt + mod] [h: output1 = "You rolled a <B>"+ Roll +"</B> with a modified target of <B>"+ modTgt +"</B>.<BR>"] //generate output results [h: output3 = ""] [h, switch(Roll), CODE: case 1: { [autoRoll = 1] }; case 100: { [autoRoll = 100] }; default: { [autoRoll = 0] }] [h,if(Roll <= modTgt),CODE: { [h, if(autoRoll == 100), CODE: { [output2 = "<FONT COLOR=RED>You automatically fail by <B>1 degree</B>.</FONT>"] }; { [variance = modTgt - Roll] [DegOfSuc = floor(variance/10)+1] [output2 = "<FONT COLOR=GREEN>You succeed by <B>"+ DegOfSuc +" degree(s)</B>.</FONT>"] [if(actionVal == 0): output3 = "Your <b>"+ outputAttack +"</b> attack strikes your target's <b>"+ hitLoc(Roll,vehicle) +"</b>."] }] }; { [h, if(autoRoll == 1), CODE: { [output2 = "<FONT COLOR=Green>You automatically succeed by <B>1 degree</B>.</FONT>"] }; { [variance = Roll - modTgt] [DegOfSuc = floor(variance/10)+1] [output2 = "<FONT COLOR=RED>You fail by <B>"+ DegOfSuc +" degree(s)</B>.</FONT>"] }] }] [h: output = "<p>"+ output1 + output2 + output3 +"</p>"] [h: macro.return = output]