Get token property from Initiative Json list

Talk about whatever topic you'd like, RPG related or not. (But please discuss things related to our software in the Tools section, below.)

Moderators: dorpond, trevor, Azhrei

User avatar
aliasmask
Deity
Posts: 8609
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Get token property from Initiative Json list

Post 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)]

User avatar
AriesBreath
Cave Troll
Posts: 32
Joined: Thu May 02, 2019 10:37 am

Re: Get token property from Initiative Json list

Post 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?

User avatar
aliasmask
Deity
Posts: 8609
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Get token property from Initiative Json list

Post 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.

User avatar
AriesBreath
Cave Troll
Posts: 32
Joined: Thu May 02, 2019 10:37 am

Re: Get token property from Initiative Json list

Post by AriesBreath »

Ok I got it, thanks aliasmask

Post Reply

Return to “General Discussion”