I deal with skills in three parts the first of which is inputting them. In this scenario Each skill is its own object optimally i would like to see all skill information under one object as it would clean up the token a bit
Code: Select all
[h:AcrPro = json.get(Acrobatics,"Proficient")]
[h:AcrExp = json.get(Acrobatics,"Expert")]
[h:ArcPro = json.get(Arcana,"Proficient")]
[h:ArcExp = json.get(Arcana,"Expert")]
[h:AthPro = json.get(Athletics,"Proficient")]
[h:AthExp = json.get(Athletics,"Expert")]
[h:DecPro = json.get(Deception,"Proficient")]
[h:DecExp = json.get(Deception,"Expert")]
[h:HisPro = json.get(History,"Proficient")]
[h:HisExp = json.get(History,"Expert")]
[h:HusPro = json.get(Husbandry,"Proficient")]
[h:HusExp = json.get(Husbandry,"Expert")]
[h:InsPro = json.get(Insight,"Proficient")]
[h:InsExp = json.get(Insight,"Expert")]
[h:IntPro = json.get(Intimidation,"Proficient")]
[h:IntExp = json.get(Intimidation,"Expert")]
[h:InvPro = json.get(Investigation,"Proficient")]
[h:InvExp = json.get(Investigation,"Expert")]
[h:MedPro = json.get(Medicine,"Proficient")]
[h:MedExp = json.get(Medicine,"Expert")]
[h:NatPro = json.get(Nature,"Proficient")]
[h:NatExp = json.get(Nature,"Expert")]
[h:PercPro = json.get(Perception,"Proficient")]
[h:PercExp = json.get(Perception,"Expert")]
[h:PerfPro = json.get(Performance,"Proficient")]
[h:PerfExp = json.get(Performance,"Expert")]
[h:PersPro = json.get(Persuasion,"Proficient")]
[h:PersExp = json.get(Persuasion,"Expert")]
[h:PrePro = json.get(Prestidigitation,"Proficient")]
[h:PreExp = json.get(Prestidigitation,"Expert")]
[h:RelPro = json.get(Religion,"Proficient")]
[h:RelExp = json.get(Religion,"Expert")]
[h:StePro = json.get(Stealth,"Proficient")]
[h:SteExp = json.get(Stealth,"Expert")]
[h:SurPro = json.get(Survival,"Proficient")]
[h:SurExp = json.get(Survival,"Expert")]
[h:status = input(
"Tab1|Proficiency||Tab",
"AcrobaticsPro|"+AcrPro+"|Acrobatics|Check",
"ArcanaPro|"+ArcPro+"|Arcana|Check",
"AthleticsPro|"+AthPro+"|Athletics|Check",
"DeceptionPro|"+DecPro+"|Deception|Check",
"HistoryPro|"+HisPro+"|History|Check",
"HusbandryPro|"+HusPro+"|Husbandry|Check",
"InsightPro|"+InsPro+"|Insight|Check",
"IntimidationPro|"+IntPro+"|Intimidation|Check",
"InvestigationPro|"+InvPro+"|Investigation|Check",
"MedicinePro|"+MedPro+"|Medicine|Check",
"NaturePro|"+NatPro+"|Nature|Check",
"PerceptionPro|"+PercPro+"|Perception|Check",
"PerformancePro|"+PerfPro+"|Performance|Check",
"PersuasionPro|"+PersPro+"|Persuasion|Check",
"PrestidigitationPro|"+PrePro+"|Prestidigitation|Check",
"ReligionPro|"+RelPro+"|Religion|Check",
"StealthPro|"+StePro+"|Stealth|Check",
"SurvivalPro|"+SurPro+"|Survival|Check",
"Tab2|Expert||Tab",
"AcrobaticsExp|"+AcrExp+"|Acrobatics|Check",
"ArcanaExp|"+ArcExp+"|Arcana|Check",
"AthleticsExp|"+AthExp+"|Athletics|Check",
"DeceptionExp|"+DecExp+"|Deception|Check",
"HistoryExp|"+HisExp+"|History|Check",
"HusbandryExp|"+HusExp+"|Husbandry|Check",
"InsightExp|"+InsExp+"|Insight|Check",
"IntimidationExp|"+IntExp+"|Intimidation|Check",
"InvestigationExp|"+InvExp+"|Investigation|Check",
"MedicineExp|"+MedExp+"|Medicine|Check",
"NatureExp|"+NatExp+"|Nature|Check",
"PerceptionExp|"+PercExp+"|Perception|Check",
"PerformanceExp|"+PerfExp+"|Performance|Check",
"PersuasionExp|"+PersExp+"|Persuasion|Check",
"PrestidigitationExp|"+PreExp+"|Prestidigitation|Check",
"ReligionExp|"+RelExp+"|Religion|Check",
"StealthExp|"+SteExp+"|Stealth|Check",
"SurvivalExp|"+SurExp+"|Survival|Check")]
[h:Acrobatics = json.set("{}","Proficient",AcrobaticsPro,"Expert",AcrobaticsExp)]
[h:Arcana = json.set("{}","Proficient",ArcanaPro,"Expert",ArcanaExp)]
[h:Athletics = json.set("{}","Proficient",AthleticsPro,"Expert",AthleticsExp)]
[h:Deception = json.set("{}","Proficient",DeceptionPro,"Expert",DeceptionExp)]
[h:History = json.set("{}","Proficient",HistoryPro,"Expert",HistoryExp)]
[h:Husbandry = json.set("{}","Proficient",HusbandryPro,"Expert",HusbandryExp)]
[h:Insight = json.set("{}","Proficient",InsightPro,"Expert",InsightExp)]
[h:Intimidation = json.set("{}","Proficient",IntimidationPro,"Expert",IntimidationExp)]
[h:Investigation = json.set("{}","Proficient",InvestigationPro,"Expert",InvestigationExp)]
[h:Medicine = json.set("{}","Proficient",MedicinePro,"Expert",MedicineExp)]
[h:Nature = json.set("{}","Proficient",NaturePro,"Expert",NatureExp)]
[h:Perception = json.set("{}","Proficient",PerceptionPro,"Expert",PerceptionExp)]
[h:Performance = json.set("{}","Proficient",PerformancePro,"Expert",PerformanceExp)]
[h:Persuasion = json.set("{}","Proficient",PersuasionPro,"Expert",PersuasionExp)]
[h:Prestidigitation = json.set("{}","Proficient",PrestidigitationPro,"Expert",PrestidigitationExp)]
[h:Religion = json.set("{}","Proficient",ReligionPro,"Expert",ReligionExp)]
[h:Stealth = json.set("{}","Proficient",StealthPro,"Expert",StealthExp)]
[h:Survival = json.set("{}","Proficient",SurvivalPro,"Expert",SurvivalExp)]
Then I have the presentation portion where my players can excecute them right from their character sheets
Finally i have the actual execution of the macro That i have Aliasmask to thank for the overwhelming majority of the code I just adapted it for my play style. However if i were to change the structure of the my first macro i would have to adjust this macro and that is something that i has held me back my understanding of Accessing nested objects for use in a macro is limited
Code: Select all
[h:skillName = macro.args]
[h:Skill = skillName]
[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 "Charisma_Save":StatName= Cha;
]
[h:skill = eval(skillName)]
[h:proficient = json.get(Skill,"Proficient")]
[h:expert = json.get(Skill,"Expert")]
[h:proficiency = getProperty("Proficiency")]
[h,if(proficient == 1): SkillMod1 = proficiency;SkillMod1 = 0]
[h,if(expert == 1): SkillMod2 = proficiency;SkillMod2 = 0]
[h:SkillMod = SkillMod1 + SkillMod2]
[h:statMod = floor((statName - 10)/2)]
[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]
[H, if(roll2 < roll1), code: {
[H: disadCheck = roll2 + statMod + SkillMod]
[H: advCheck = baseCheck]
};{
[H: disadCheck = baseCheck]
[H: advCheck = roll2 + statMod + SkillMod]
}]
[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>
</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>")]