My first macro. I'm digging in to learn some macro coding to better understand things like BOT and Frameworks. I looked at the code in BOT and a D&D5e framework and it's daunting for me atm.
To get my feet wet I started coding from scratch.
Started out to be simple combat roll calculator, with both hard-coded and prompted inputs, with an output to CHAT, which evolved to this rather verbose macro, to be trimmed down later as I gain confidence.
So I did the following;
In Campaign Properties I created a new Token Type named CHARACTER (shown below).
Then, created a new Token and on the SELECTED panel wrote a macro named THE WHITE SPEAR (shown below).
It works nicely, but now I realize I'd have to code every different Token, so I want to eventually make this macro more generic.
Been googling, but not stumbled onto just what I need yet.
For now I want just the weapon values, and the ProfBonus value within the token itself, or other data source.
I'm sure a common task, but for me atm, daunting!
I'll tackle searching for and choosing enemy tokens to query Armor Class and other stuff later.
So please, advise me. I'm not asking you to code it, I want to learn this, so snippets, links to code examples etc. would be very much appreciated.
PS: Wondering if I should delve into Library Tokens for storing data? idk if that's necessary unless its best practice. I dont plan on doing the entire Players Handbook, just the stuff we need to semi automate our F2F game.
tyvm!
----------------------------------------------
I created a Token Type named CHARACTER with these properties;
Code: Select all
*LEVEL
*HP
*MaxHP
*AC
*INIT
*STR
*DEX
*CON
*INT
*WIS
*CHA
*SPEED
*PROFBONUS
*PASSIVE WIS
*Weap1
*WepAtt1Bonus
*WepAtt1Damage
*Weap2
*WeapAtt2Bonus
*WepAtt2Damage
Name: THE WHITE SPEAR
Code: Select all
<b><font color="teal">
Roars: "I BEAR THE WHITE SPEAR!"<br>
------------------------<br>
<b><font color="red">
TAKES AN ATTACK ACTION USING;
<b><font color="green">
(THE WHITE SPEAR), Spear-Long,(Versitile), Reach(10ft)
<br>
Speartip:1d6 Pierce, Butt:1d4 Bludgeoning
<br>
Attack Bonus +2 (Proficiency Bonus)
<br>
[h:dice=0]
[h:ProfBonus=2]
[h:DamageTip=0]
[h:DamageButt=0]
[h:RageBonus=0]
[h:AttackRoll=0]
[h:TargetNumber=0]
<br>
<b><font color="black">
[h: dice=1d20]
Your Attack Roll: d20=[dice] + Prof Bonus:[ProfBonus]- Total:[dice + ProfBonus]
[h: AttackRoll = dice + ProfBonus]
<br>
Attack Roll: [AttackRoll]
[h: input("RageCheck | 0 | Raging? | CHECK")]
[h,if(RageCheck==1): RageBonus = 2; RageBonus = 0]
[h:input("TargetNumber | 10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 |Enemy Armor Class| LIST |SELECT=0 VALUE=STRING")] <br>
Enemy Armor Class: [Targetnumber]
<br><br>
[if(AttackRoll >= TargetNumber), code:
{
<b><font color="blue">
---------- YOUR ATTACK HITS ----------<br>
PRIMARY DAMAGE ROLLED 1d6= [DamageTip = 1d6] <br>
SECONDARY DAMAGE ROLLED 1d4= [DamageButt= 1d4]<br>
Rage Bonus: [RageBonus]<br>
GRAND TOTAL DAMAGE from this Attack=[DamageTip + DamageButt + RageBonus]<br>
};
{
<b><font color="blue">
"Your Attack MISSES"<br>
}]
<b><font color="teal">
--------------------------------