Variable inside of Token Properties Tabs

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

Post Reply
Remote.DM
Kobold
Posts: 8
Joined: Fri May 22, 2015 12:19 am

Variable inside of Token Properties Tabs

Post by Remote.DM »

I'm still very new to the whole code-writing thing for MT, and just writing code in general.

Can someone help me with my syntax for the following inside the properties for tokens?

Code: Select all

Wisdom (Wis)
WisdomBonus
*ProficiencyBonus
WisdomSave (Wis Save):{WisdomBonus + ProficiencyBonus}
Insight:{WisdomBonus}
*PassiveInsight (Passive Ins):{WisdomBonus + 10}
This gets me the basics of what I need. But, what happens when someone is proficient at Insight? I need to conditionally add it, which where I'm failing to find documentation on. Maybe I just haven't gotten that far into the wiki, but I have been following the links to try to find it.

I will just write out what I hope to do, and hopefully someone will be able to link me or correct me/

Code: Select all

Wisdom (Wis)
WisdomBonus
*ProficiencyBonus
WisdomSave(Wis Save):{WisdomBonus + ProficiencyBonus}
Insight:{WisdomBonus}
InsightProficient:0
*PassiveInsight(Passive Ins):
          {IF"InsightProficient"=0,THEN"WisdomBonus + 10",
           OR 
           IF"InsightProficient"=1,THEN"WisdomBonus + ProficiencyBonus + 10}
I hope that made enough sense to get help from. Thanks again, guys.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Variable inside of Token Properties Tabs

Post by aliasmask »

Not all your variables need to be a token property. In fact, I would recommend only properties to be displayed on the stat sheet be used. I also recommend using names that won't be used or mistakenly used somewhere else. I'm going to keep it simple for you and not mention data structure and scopes.

I recommend always having a default value for things that need to be calculated. That way things won't break. So,

Code: Select all

Wisdom (Wis): 10
WisdomBonus: [r: floor((Wisdom - 10)/2)]
*ProficiencyBonus: 0
WisdomSave(Wis Save): [r: WisdomBonus + ProficiencyBonus]
Insight: [r: WisdomBonus]
InsightProficient:0
*PassiveInsight(Passive Ins): [r, if(InsightProficient): WisdomBonus + 10; WisdomBonus + ProficiencyBonus + 10]
I don't know what your actual numbers are, but at least the above won't crash.

Remote.DM
Kobold
Posts: 8
Joined: Fri May 22, 2015 12:19 am

Re: Variable inside of Token Properties Tabs

Post by Remote.DM »

I have no actual numbers. What you saw was my code, because each of the properties will be what the player fills out for their token.

That's why there was no hard number to calculate from. It's also why I didn't bother with Floor.

Why did you use r: instead of { } to create the variable? If it's going to be a static number filled out for the properties, why "r: oll" for it?

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Variable inside of Token Properties Tabs

Post by aliasmask »

[r: ] is the same as {} more or less. But it better demonstrates that what you put there is just macro code. So, I can have several commands in a single property including creating variables only used for that property.. for example, I could use a for loop.

To put it more plainly, WisdomBonus has no value so you can't use it in your formula WisdomBonus + ProficiencyBonus. So, unless it has a value what you're trying to do doesn't work.

Remote.DM
Kobold
Posts: 8
Joined: Fri May 22, 2015 12:19 am

Re: Variable inside of Token Properties Tabs

Post by Remote.DM »

I must have made a mistake somewhere, using your formulas.

One of my players is trained in Perception and Insight. Both numbers register as "11," despite the proper answer being "13."

Code: Select all

*Name
Class
Level
Race
Alignment
Background

Strength (Str)
Dexterity (Dex)
Constitution (Con)
Intelligence (Int)
Wisdom (Wis)
Charisma (Cha)

*ProficiencyBonus

AcrobaticsProficient: type "1" for proficient, "0" for not
AnimalHandlingProficient: type "1" for proficient, "0" for not
ArcanaProficient: type "1" for proficient, "0" for not
AthleticsProficient: type "1" for proficient, "0" for not
DeceptionProficient: type "1" for proficient, "0" for not
HistoryProficient: type "1" for proficient, "0" for not
InsightProficient: type "1" for proficient, "0" for not
IntimidationProficient: type "1" for proficient, "0" for not
InvestigationProficient: type "1" for proficient, "0" for not
MedicineProficient: type "1" for proficient, "0" for not
NatureProficient: type "1" for proficient, "0" for not
PerceptionProficient: type "1" for proficient, "0" for not
PerformanceProficient: type "1" for proficient, "0" for not
PersuasionProficient: type "1" for proficient, "0" for not
ReligionProficient: type "1" for proficient, "0" for not
SleightOfHandProficient: type "1" for proficient, "0" for not
StealthProficient: type "1" for proficient, "0" for not
SurvivalProficient: type "1" for proficient, "0" for not

*ArmorClass (Armor Class)
*Speed
HitDice (Hit Dice)
*CurrentHitPoints (HP)
*TemporaryHitPoints (Temp HP)
*MaxHitPoints (Max HP)
*Resistances
*Immunities
*Vulnerabilities

StrengthBonus: [r: floor((Strength - 10)/2)]
DexterityBonus: [r: floor((Dexterity - 10)/2)]
ConstitutionBonus: [r: floor((Constitution - 10)/2)]
IntelligenceBonus: [r: floor((Intelligence - 10)/2)]
WisdomBonus: [r: floor((Wisdom - 10)/2)]
CharismaBonus: [r: floor((Charisma - 10)/2)]

StrengthSave(Str Save): [r: StrengthBonus + ProficiencyBonus]
DexteritySave(Dex Save): [r: DexterityBonus + ProficiencyBonus]
ConstitutionSave(Con Save): [r: ConstitutionBonus + ProficiencyBonus]
IntelligenceSave(Int Save): [r: IntelligenceBonus + ProficiencyBonus]
WisdomSave(Wis Save): [r: WisdomBonus + ProficiencyBonus]
CharismaSave(Cha Save): [r: CharismaBonus + ProficiencyBonus]

//--these skills were added after the original post for help went up --//
Acrobatics: [r, if(AcrobaticsProficient): DexterityBonus; DexterityBonus + ProficiencyBonus]
AnimalHandling (Animal Handling): [r, if(AnimalHandlingProficient): WisdomBonus; WisdomBonus + ProficiencyBonus]
Arcana: [r, if(ArcanaProficient): IntelligenceBonus; IntelligenceBonus + ProficiencyBonus]
Athletics: [r, if(AthleticsProficient): StrengthBonus; StrengthBonus + ProficiencyBonus]
Deception: [r, if(DeceptionProficient): CharismaBonus; CharismaBonus + ProficiencyBonus]
History: [r, if(HistoryProficient): IntelligenceBonus; IntelligenceBonus + ProficiencyBonus]
Insight: [r, if(InsightProficient): WisdomBonus; WisdomBonus + ProficiencyBonus]
Intimidation: [r, if(IntimidationProficient): CharismaBonus; CharismaBonus + ProficiencyBonus]
Investigation: [r, if(InvestigationProficient): IntelligenceBonus; IntelligenceBonus + ProficiencyBonus]
Medicine: [r, if(MedicineProficient): WisdomBonus; WisdomBonus + ProficiencyBonus]
Nature: [r, if(NatureProficient): IntelligenceBonus; IntelligenceBonus + ProficiencyBonus]
Perception: [r, if(PerceptionProficient): WisdomBonus; WisdomBonus + ProficiencyBonus]
Performance: [r, if(PerformanceProficient): CharismaBonus; CharismaBonus + ProficiencyBonus]
Persuasion: [r, if(PersuasionProficient): CharismaBonus; CharismaBonus + ProficiencyBonus]
Religion: [r, if(ReligionProficient): IntelligenceBonus; IntelligenceBonus + ProficiencyBonus]
SleightOfHand: [r, if(SleightOfHandProficient): DexterityBonus; DexterityBonus + ProficiencyBonus]
Stealth: [r, if (StealthProficient): DexterityBonus; DexterityBonus + ProficiencyBonus]
Survival: [r, if(SurvivalProficient): WisdomBonus; WisdomBonus + ProficiencyBonus][/color]
//-- end of code edits from original post --//

*Initiative: [r: DexterityBonus]

*PassiveInsight(Passive Ins): [r, if(InsightProficient): WisdomBonus + 10; WisdomBonus + ProficiencyBonus + 10]
*PassivePerception(Passive Per): [r, if(PerceptionProficient): WisdomBonus + 10; WisdomBonus + ProficiencyBonus + 10]
And he has input "1" for "InsightProficient" and "PerceptionProficicent."

(I know MT removes line breaks, but I leave them in the text file so it's easier for me to see and find things.)

EDIT: The eventual goal is to have macros that say something like "/roll 1d20 + StrengthSave" or "/roll 1d20 + Acrobatics" and just have it output the roll, because it checks and adds all the modifiers in beforehand. Won't be able to get those working, until I get the math for passives working first, though.

What did I fail to understand or follow through on?

User avatar
darkeness66
Giant
Posts: 124
Joined: Wed Feb 07, 2007 8:55 pm
Location: Fremont, OH

Re: Variable inside of Token Properties Tabs

Post by darkeness66 »

this is an old post. did you ever get an answer to your question?

Post Reply

Return to “General Discussion”