I don't know which one is exactly your problem, but I'll point out these things:
1) You didn't add the damage value at the end, so it won't ever be displayed. The last piece should be changed to [r, if(d20roll >= THAC0-TargetAC): "Damage = " + DamRoll].
2) If the problem is with getProperty(), remember that in order to use it, you must do one (just one) of the following:
- set Wiki: getProperty()'s id parameter, as specified in its wiki page;
- switch the current token to the desired one by using Wiki: switchToken();
- have the macro in your Campaign or Global panel, with the "Apply to Selected Tokens" box checked, and run it after selecting the desired token;
- have the macro on each specific token's Selection panel (it acts automatically as if "Apply to Selected Tokens" is checked).
3) When a token is selected and you're using a macro that applies to selected tokens, you don't need to use getProperty() to take the values of its properties; if it has the THAC0 property, you just need to use THAC0 as if it was a variable you already set in that macro.
Also, if you change their values directly in the macro, for example writing something like [h: THAC0 = 10], you are effectively editing their token property; the selected token's THAC0 will become 10, if you write that. In fact, in the case of DamRoll, I assume you added it in token properties as "DamRoll:{1d8}", but if you call it in the macro by evaluating and redefining it with "[h: DamRoll =", it will be set to the random result determined in that moment. In fact, using [h: DamRoll = getProperty(DamRoll)] takes the DamRoll property, evaluates it, and let's say that the result is 5, and stores that 5 in the DamRoll variable that is used in the macro and also edits the token property by setting DamRoll to a fixed value of 5.
So, here's how I'd change your code (after putting it into a macro in the Selection panel or anyway one with "Apply to Selected Tokens" checked):
Code: Select all
[h:status = input(
"TargetAC|10|Enter Target AC")]
attacks with his [r:Weapon = "Sword"]! <br>
Attack Roll: <b>[r: d20roll=d20]</b> vs. AC: <b>[r:TargetAC]</b>
[r, if(d20roll >= THAC0-TargetAC): "and HITS!"]
[r, if(d20roll >= THAC0-TargetAC): "<br>Damage = " + DamRoll]