For reference, I've got class and level stored in a json object so that the key represents the class, and the value is the level in that class, i.e. {"Barbarian":3,"Fighter":1}.
Here's what I have so far:
Code: Select all
[h:addToInitiative()]
[h,if(isPC()==1),code:{
[h,if(json.contains(ClassLevel,"Barbarian")==1&&json.get(ClassLevel,"Barbarian")>=7):Init=2d20k1+Initiative;Init=1d20+Initiative]
};{
[h:Init=1d20+table("Ability Bonuses",Dexterity)]
}]
[h:setInitiative(Init)]
[h:sortInitiative()]
For some reason, it fails if the Barbarian key doesn't exist, but succeeds if it does, regardless of if the value is 7 or higher.
So, why isn't this working?