Code: Select all
[h:skillName = macro.args]
[b][h:proficient = json.get(skillName,"Proficient")]
[h:expert = json.get(skillName,"Expert")]
[h:proficiency = getProperty("Proficiency")][/b]
[h:Str = getProperty("Strength")]
[h:Dex = getProperty("Dexterity")]
[h:Con = getProperty("Constitution")]
[h:Int = getProperty("Intelligence")]
[h:Wis = getProperty("Wisdom")]
[h:Cha = getProperty("Charisma")]
[h, switch(skillName):
case "Acrobatics": statName = Dex;
case "Arcana": statName = Int;
case "Athletics": statName = Str;
case "Deception": statName = Cha;
case "History": statName = Int;
case "Husbandry": statName = Wis;
case "Insight": statName = Wis;
case "Intimidation": statName = Cha;
case "Investigation": statName = Int;
case "Medicine": statName = Wis;
case "Nature": statName = Int;
case "Perception": statName = Wis;
case "Performance": statName = Cha;
case "Persuasion": statName = Cha;
case "Prestidigitation": statName = Dex;
case "Religion": statName = Int;
case "Stealth": statName = Dex;
case "Survival": statName = Wis;
case "Strength_Save":StatName= Str;
case "Constitution_Save":StatName= Con;
case "Dexterity_Save":StatName= Dex;
case "Intelligence_Save":StatName= Int;
case "Wisdom_Save":StatName= Wis;
case "CharismaSave":StatName= Cha;
]
[h,if(proficient == 1): SkillMod1 = proficiency; SkillMod1 = 0]
[h,if(expert == 1): SkillMod2 = proficiency; SkillMod2 = 0]
[h:SkillMod = SkillMod1 + SkillMod2]
[h:skill = eval(skillName)]
[H: hasFumble = 0]
[H: hasCrit = 0]
[H: bothCrit = 0]
[H: isFumble = 0]
[H: isCrit = 0]
[H: output = ""]
[H, code: {
[H: roll1 = d20]
[H: roll2 = d20]
[H, if(roll1 == 20 || roll2 == 20): hasCrit = 1]
[H, if(roll1 == 20 && roll2 == 20): bothCrit = 1]
[H, if(roll1 == 1 || roll2 == 1): hasFumble = 1]
[H, if(roll1 == 20): isCrit = 1]
[H, if(roll1 == 1): isFumble = 1]
[H: baseCheck = roll1 + statMod + SkillMod + misc]
[H, if(roll2 < roll1), code: {
[H: disadCheck = roll2 + statMod + SkillMod + misc]
[H: advCheck = baseCheck]
};{
[H: disadCheck = baseCheck]
[H: advCheck = roll2 + statMod + SkillMod + misc]
}]
[H:
tip = strformat('<html><table style="border-style:solid;border-width=1pt;padding:0px;">
<tr style="padding:0px;"><td style="padding:0px;padding-right:5px;text-align:right;">Roll 1:</td><td style="padding:0px;padding-right:5px;">%{roll1}</td></tr>
<tr style="padding:0px"><td style="padding:0px;padding-right:5px;text-align:right;">Roll 2:</td><td style="padding:0px;padding-right:5px;">%{roll2}</td></tr>
<tr style="padding:0px"><td style="padding:0px;padding-right:5px;text-align:right;">Skill Proficiency:</td><td style="padding:0px;padding-right:5px;">%{SkillMod}</td></tr>
<tr style="padding:0px"><td style="padding:0px;padding-right:5px;text-align:right;">Stat Mod:</td><td style="padding:0px;padding-right:5px;">%{statMod}</td></tr>
<tr style="padding:0px"><td style="padding:0px;padding-right:5px;text-align:right;">Misc:</td><td style="padding:0px;padding-right:5px;">%{misc}</td></tr>
</table></html>'
)]
[H: tip = replace(tip,'"',""")]
[H, if(hasFumble): disadCheck = "<font color=red size=+1>"+disadCheck+"</font>"]
[H, if(hasCrit): advCheck = "<font color=green size=+1>"+advCheck+"</font>"]
[H, if(bothCrit): disadCheck = "<font color=green size=+1>"+disadCheck+"</font>"]
[H, if(isFumble): baseCheck = "<font color=red size=+1>"+baseCheck+"</font>"]
[H, if(isCrit): baseCheck = "<font color=green size=+1>"+baseCheck+"</font>"]
[H:
output = json.append(output,strformat('
<span title="%{tip}"><b>
%{skillName}'
))]
[H:
output = json.append(output,strformat('
Result:%{baseCheck} (Adv: %{advCheck} / Dis: %{disadCheck})<br></b>
</span>'
))]
}]
[R: json.toList(output,"<br>")]
the result i get is this
Code: Select all
Statement options (if any): h Statement Body : proficient = json.get(skillName,"Proficient")
i know its likely something i am overlooking and i know i am going to feel very dumb
my skill properties are set up like this
Acrobatics:{"Proficient":0,"Expert":0} so each skill is its own object eventually i want to condense the entire skill list down into a singular object but one step at a time