The long version:
I want to use MapTool for HarnMaster and I thought of creating a framework for it. I starting tinkering a bit with macros and I found out that I hate passionately the syntax. So I decided to keep macros to a bear minimum. I thought of posting them because someone else may find them useful (also I welcome any feedback).
I have two campaign macros accessible by players. A macro for skill checks:
Code: Select all
[h: fail = input(
"tval | 0 | Skill EML | TEXT | WIDTH=3"
)]
[h: abort(fail)]
[h:dval=1d100]
[r: "EML: " + tval + ", Roll: " + dval]
[r,if(dval<=tval),CODE:
{
[r, if(math.mod(dval,5)>0):
'<br><span style="color:#0000cd">Marginal Success</span>';
'<br><span style="color:#0000cd"><b>Critical Success</span>']
};
{
[r, if(math.mod(dval,5)>0):
'<br><span style="color:#dc143c">Marginal Failure</span>';
'<br><span style="color:#dc143c"><b>Critical Failure</span>']
}
]
The other macro available to players is the initiative one:
Code: Select all
[H: fail = input(
"EML | 0 | Initiative EML | TEXT | WIDTH=3"
)]
[H: abort(fail)]
[h:dval=1d100]
[h:tval=EML]
[h,if(dval<=tval),CODE:
{
[h, if(math.mod(dval,5)>0):
addToInitiative(0, 200+tval, getSelected());
addToInitiative(0, 300+tval, getSelected())]
};
{
[h, if(math.mod(dval,5)>0):
addToInitiative(0, 100+tval, getSelected());
addToInitiative(0, tval, getSelected())]
}
]
[r: "EML: " + tval + ", Roll: " + dval]
[r,if(dval<=tval),CODE:
{
[r, if(math.mod(dval,5)>0):
'<br> Initiative check: '+2+tval+'<br><span style="color:#0000cd">Marginal Success</span>';
'<br> Initiative check: '+3+tval+'<br><span style="color:#0000cd"><b>Critical Success</span>']
};
{
[r, if(math.mod(dval,5)>0):
'<br> Initiative check: '+1+tval+'<br><span style="color:#dc143c">Marginal Failure</span>';
'<br> Initiative check: '+tval+'<br><span style="color:#dc143c"><b>Critical Failure</span>']
}
]
I also have two skill check GM macros. Both of them are slight modifications of the campaign macro. The first one shows the players only the success level to the players:
Code: Select all
[h: fail = input(
"tval | 50 | Skill EML | TEXT | WIDTH=3"
)]
[h: abort(fail)]
[h:dval=1d100]
[g: "EML: " + tval + ", Roll: " + dval]
[r,if(dval<=tval),CODE:
{
[r, if(math.mod(dval,5)>0):
'<br><span style="color:#0000cd">Marginal Success</span>';
'<br><span style="color:#0000cd"><b>Critical Success</span>']
};
{
[r, if(math.mod(dval,5)>0):
'<br><span style="color:#dc143c">Marginal Failure</span>';
'<br><span style="color:#dc143c"><b>Critical Failure</span>']
}
]
Code: Select all
[H: fail = input(
"tval | 50 | Skill EML | TEXT | WIDTH=3"
)]
[H: abort(fail)]
[h:dval=1d100]
[g,if(dval<=tval),CODE:
{
[g, if(math.mod(dval,5)>0):
'<br><span style="color:#0000cd">Marginal Success:</span> ' + dval + "<br>EML: " + tval;
'<br><span style="color:#0000cd"><b>Critical Success:</span> ' + dval + "</b><br>EML: " + tval]
};
{
[g, if(math.mod(dval,5)>0):
'<br><span style="color:#dc143c">Marginal Failure:</span> ' + dval + "<br>EML: " + tval;
'<br><span style="color:#dc143c"><b>Critical Failure:</span> ' + dval + "</b><br>EML: " + tval]
}
]
Code: Select all
Duration
Initiative
Source
Target
Description
EffectName
TriggerRound
Code: Select all
[H: fail = input(
"EffectNameTmp | " + listGet( token.name, 1, "-") + " | Spell / Effect Name | TEXT",
"InitiativeTmp | 0 | Initiative | TEXT | WIDTH=3",
"DurationTmp | 1 | Duration in rounds | TEXT | WIDTH=3",
"SourceTmp | | Source | TEXT",
"TargetTmp | | Target(s) | TEXT",
"DescriptionTmp | | Description | TEXT"
)]
[H: abort(fail)]
[H: StartRound = getInitiativeRound()]
[H: StartRound = if( StartRound > 0, StartRound, 1)]
[H: TriggerRoundTmp = StartRound + DurationTmp]
[H: token.name = EffectNameTmp + ": [until round " + TriggerRoundTmp + "]"]
[H: token.label = if( SourceTmp == 0, "", SourceTmp)]
[H: setProperty("Duration",DurationTmp)]
[H: setProperty("Initiative",InitiativeTmp)]
[H: setProperty("Source",SourceTmp)]
[H: setProperty("Target",TargetTmp)]
[H: setProperty("Description",DescriptionTmp)]
[H: setProperty("EffectName",EffectNameTmp)]
[H: setProperty("TriggerRound",TriggerRoundTmp)]
[H: addToInitiative()]
[H: token.init = InitiativeTmp ]
[H: sortInitiative()]
Code: Select all
[h: CurRound = getInitiativeRound()]
[h: tok = getInitiativeToken()]
[h: RoundsLeft = getProperty("TriggerRound",tok) - CurRound]
[r, if(RoundsLeft>0): getProperty("EffectName",tok) + " has " + RoundsLeft + " round(s) left."]
[r, if(RoundsLeft==0): getProperty("EffectName",tok) + " ends."]
[r, if(RoundsLeft<0): getProperty("EffectName",tok) + " should have ended in turn " + getProperty("TriggerRound",tok) + "."]
[h: eval( if( RoundsLeft > 0, '0', 'removeFromInitiative(tok)'))]
[h: nextInitiative()]