Created
April 30, 2018 13:09
-
-
Save morepurplemorebetter/a0ca94a5ed014ea45da3e9fd84403737 to your computer and use it in GitHub Desktop.
Swap the display of the ability score and the ability modifier for MPMB's Character Record Sheet (Printer Friendly)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
>>> WHAT DOES IT DO? <<< | |
This script offers a way to swap the displayed numbers in the ability score and ability modifier fields for MPMB's Character Record Sheet (Printer Friendly). | |
*/ | |
/* | |
>>> HOW DO YOU USE IT? <<< | |
1) Open the JavaScript console (a.k.a. JavaScript debugger). This can be done from any of the 'Import' dialogs in the sheet. | |
2) Copy the code below to the console. | |
3) Select all the code. Make sure that all what you just copied is highlighted. | |
4) While the code is highlighted, press Ctrl+ENTER (Command+ENTER on Mac) to run all the code. | |
5) See that where you enter the ability scores did not change, but that it did change what number is displayed where. | |
Note that you will only need to run it once, and the PDF will be forever changed. | |
*/ | |
var aScores = ["Str", "Dex", "Con", "Int", "Wis", "Cha", "HoS"]; | |
var AScompA = What("Template.extras.AScomp").split(","); | |
for (var i = 0; i < aScores.length; i++) { | |
if (!typePF) continue; | |
tDoc.getField(aScores[i]).setAction("Format", "event.value = What('"+aScores[i]+" Mod') > 0 ? '+'+What('"+aScores[i]+" Mod') : What('"+aScores[i]+" Mod');"); | |
tDoc.getField(aScores[i]+" Mod").setAction("Format", "event.value = What('"+aScores[i]+"');"); | |
if (aScores[i] == "HoS") continue; | |
for (tA = 0; tA < AScompA.length; tA++) { | |
var compSc = AScompA[tA] + "Comp.Use.Ability." + aScores[i]; | |
var compForm = "event.value = What('"+compSc+".Mod') > 0 ? '+'+What('"+compSc+".Mod') : What('"+compSc+".Mod');"; | |
tDoc.getField(compSc + ".Score").setAction("Format", compForm); | |
tDoc.getField(compSc + ".Mod").setAction("Format", "event.value = What('"+compSc+".Score');"); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment