I've created a Lib token that I'm using to call a ToHit() function and a Damage() function. I've created Basic Attack buttons that call the functions to resolve the attack. I've got them working with one small oddity.
If I click on a PC/NPC Token and click on the basic attack button that is in the Campaign Window the macro runs correctly. It hides all of the variables, math showing only the result. Neatly stuffing all the vars and math into a tooltip.
If I then copy the button from the Campaign section to the PC/NPC token itself and run press the button. The function runs but does NOT hide the variables or the math or the result.
Why does it function this way and how can I get all my macros to function as if they were in the campaign window?
Screen shots and code snips below:
Code:
ToHit:
Code: Select all
[IF( argCount() <= 0 || argCount() > 1), CODE: {
[assert(0,'<b><font color="#FF0000">ToHitLib Function: Incorrect number of arguments to this function!</font></b><br>')]
};{}]
[H:StatBonus = arg(0)]
Using <b>{WeaponCName}</b>!<br>
[H:DiceRoll = 1d20]
[IF( DiceRoll == 20), CODE: {
<b><font color="#FF0000">Critical Hit!</font></b><br>
[H:macro.return = 2]
};{}]
[IF( DiceRoll == 1), CODE: {
<b><font color="#FF0000">feces! You rolled a 1! You miss.</font></b><br>
[H:macro.return = 1]
};{}]
Attack roll: <b>[DiceRoll + LevelBonus + WeaponCBonus + StatBonus + MiscAttBonus]</b><br>
Code: Select all
[IF( argCount() <= 0 || argCount() > 3), CODE: {
[assert(0,'<b><font color="#FF0000">DamageLib Function: Incorrect number of arguments to this function!</font></b><br>')]
};{}]
[H:CritFlag= arg(0)]
[H:NumW = arg(1)]
[H:DmgBonus = arg(2)]
Damage roll: <b>
[IF(CritFlag == 2), CODE:{
<b><font color="#FF0000"> [NumW * WeaponCMaxDamage + WeaponCDamBonus + DmgBonus + MiscDamBonus + eval(WeaponCCrit)]</font></b>
};{
[NumW * eval(WeaponCDamage) + WeaponCDamBonus + DmgBonus + MiscDamBonus]
}]
</b>
When run from the Token Selection Window - Screen Shot:
Thanx for any help or insight!
Kizan
Edit: Using MT1.3b54