HarnMaster macros

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
gmg
Kobold
Posts: 5
Joined: Mon Aug 17, 2020 8:15 am

HarnMaster macros

Post by gmg »

TL;DR: I have listed some macros for HarmMaster skill checks and initiative. I have also listed a couple of macros for duration tracking, which can be useful in a more general setting. I would appreciate if someone could tell me how to stop a macro from executing if the player is not the owner of the selected token or if the selected token has already an initiative entry.

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>']
}
]
This macro just asks for the EML of the skill (the effective skill level) and gives the degree of success. The macro also print the die roll and since the player has to type the EML, the macro also prints the EML.

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>']
}
]
This is a house rule where the initiative order depends both on the skill EML and the success level. A problem that I have with this is that the players can use it with any token regardless of ownership multiple times. Is there any easy way to restrict usage to tokens they own that are not already in the initiative list?

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>']
}
]
The second one shows nothing to the players:

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]
}
]
Finally I modified some old macro I found in this forum to create a token that tracks and effect's duration. I have define a token type called Effect with properties:

Code: Select all

Duration
Initiative
Source
Target
Description
EffectName
TriggerRound
A token of this type should have the following setup macro:

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()]
When I need to keep track of an effect, I copy the token, run the macro and it adds the token to the initiative. If a PC caused the effect, I give the token to the PC and they can run the macro. After that I have a GM macro that counts the duration and prints a message for everyone. I just have to click this every time it's the effect's initiative. The macro is:

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()]
I plan to use google sheets for character sheets, so this should be enough automation for my needs.
Last edited by gmg on Mon Aug 17, 2020 5:28 pm, edited 1 time in total.

User avatar
bubblobill
Giant
Posts: 167
Joined: Sun Jan 24, 2010 3:07 pm

Re: HarnMaster macros

Post by bubblobill »

This will produce an error message and stop macro execution it player is not the owner of the current token or the token initiative has been set to a number.

Code: Select all

[h: assert(isOwner()||isNumber(getInitiative()), "I won't let you do that")]
Bubblobill on the forum.
@Reverend on the MapTool Discord Server

Responsible for less atrocities than most... I do accept responsibility for these though: SmartDoors, Simple d20 Framework - barebones, Drop-in: All 3.5 SRD Monsters, Drop in: Simple Character Editor, Battletech Framework

gmg
Kobold
Posts: 5
Joined: Mon Aug 17, 2020 8:15 am

Re: HarnMaster macros

Post by gmg »

bubblobill wrote:
Mon Aug 17, 2020 10:16 am
This will produce an error message and stop macro execution it player is not the owner of the current token or the token initiative has been set to a number.

Code: Select all

[h: assert(isOwner()||isNumber(getInitiative()), "I won't let you do that")]
Thank you! I split it into two different checks:

Code: Select all

[h: assert(isOwner(), "You are not the owner of the token")]
[h: assert(!isNumber(getInitiative()), "The token already has initiative")]

Post Reply

Return to “Macros”