Page 2 of 2

Re: Get token property from Initiative Json list

Posted: Tue May 21, 2019 10:04 am
by aliasmask
I updated a few things. I separated that line, added the comma to this line:

Code: Select all

[h, if(isNumber(Dex)): DexMod = floor((Dex -10)/2); DexMod = 0]
and changed Dex to DexMod on this line:

Code: Select all

[h: setInitiative(1d20+DexMod)]

Re: Get token property from Initiative Json list

Posted: Tue May 21, 2019 2:10 pm
by AriesBreath
Yes, I noticed and copyed the system to get other properties to sum to the total. But I would like to ask you why did you do that? I mean, isn't it the same if I write "[h, if(isNumber(Dex)): Dex = floor((Dex -10)/2); Dex = 0]", thus using only one variable instead of two?

Re: Get token property from Initiative Json list

Posted: Tue May 21, 2019 4:13 pm
by aliasmask
In programming, it's a best practice to name variables for what they are and not to reuse variables having them serve a multiuse. It leads to confusion and mistakes. So, Dex is the Dexterity and DexMod is the modifier based on Dexterity.

Re: Get token property from Initiative Json list

Posted: Tue May 21, 2019 5:15 pm
by AriesBreath
Ok I got it, thanks aliasmask