Generic D&D 5e Playtest Macro

Show off your RPG maps, campaigns, and tokens. Share your gaming experiences and stories under General Discussion and save this forum for things you've created that may help others run their own games. Use the subforums when appropriate.

Moderators: dorpond, trevor, Azhrei, Gamerdude

Post Reply
Esheon
Giant
Posts: 115
Joined: Mon Dec 26, 2011 12:53 am

Generic D&D 5e Playtest Macro

Post by Esheon »

In a few days I'm playing in a 5e playtest on Maptool with a few friends, so I decided to come up with a macro to handle most of my rolls. The DM won't be using a framework, so the macro is as all-inclusive as I could make it without spending too much time on it.
Generic 5e Macro

Code: Select all

[h: abort(input(
  "rollType|Advantage, Normal, Disadvantage|Roll Type|RADIO|SELECT=1 VALUE=STRING",
  "d20Bonus|0|d20 Roll Bonus|TEXT|WIDTH=10",
  "dmgRoll|0|Damage Roll (optional)|TEXT|WIDTH=10",
  "critDamage|0|Critical Damage (optional)|TEXT|WIDTH=10"
))]

[h: d20roll1 = 1d20]
[h: d20roll2 = 1d20]
[h, if (! isNumber(dmgRoll)): dmgRoll = eval(dmgRoll)]
[h, if (! isNumber(critDamage)): critDamage = eval(critDamage)]

<table border="0">
  <tr bgcolor="green">
    <td style="padding:0px 5px;">
      <span style="color:white"><b>[r: if(dmgRoll == 0, "Basic", "Attack")] Roll ([r:rollType])</b></td>
  </tr>
[switch(rollType), code:
case "Advantage": {
[h,if(d20roll1 > d20roll2): d20roll=d20roll1; d20roll=d20roll2]
[h: rollTT = "Highest of ("+d20roll1+", "+d20roll2+")"]
};
case "Normal": {
[h:d20roll = d20roll1]
[h: rollTT = "single d20 roll ("+d20roll1+")"]
};
case "Disadvantage": {
[h,if(d20roll1 < d20roll2): d20roll=d20roll1; d20roll=d20roll2]
[h: rollTT = "Lowest of ("+d20roll1+", "+d20roll2+")"]
}]
[h:tooltip1 = strformat("<html><table><tr><td>+%{d20roll}: %{rollTT}</td></tr><tr><td>+%{d20Bonus}: Roll Bonus </td></tr></table></html>")]
  <tr>
    <td style="padding:0px 5px;" white-space: nowrap;>
        <b>Roll:</b> 
        <span title="[r:tooltip1]">[r:d20roll + d20Bonus]</span>
[if(d20roll==20), CODE:
  {
    <font color=red>, <b>Critical Success!</b></font>
  };{}]
[if(d20roll==1), CODE:
  {
    <font color=blue>, <b>Failure!</b></font>
  };{}]
[if(dmgRoll!=0 && d20roll!=1 && d20roll!=20), CODE:
  {
    , [dmgRoll] damage.
  };{}]
[if(dmgRoll!=0 && d20roll==20), CODE:
  {
    , [critDamage] damage.
  };{}]
</table>
Essentially, it prompts you with four options:
Roll Type: Advantage takes the highest of two d20 rolls, Normal just rolls 1d20, and Disadvantage takes the lowest of two d20 rolls. The option defaults to "Normal".
d20 Roll Bonus: text field for a numerical bonus to the roll
Damage Roll (optional): standard dice expression or flat number. Leave at zero if this is not an attack.
Critical Damage (optional): standard dice expression or flat number. If Damage Roll is zero, this does nothing.

The macro output is just two lines in the chat window.
The first line just a header describing the roll. If the Damage Roll box is left at 0, the header reads "Basic Roll (RollType)". If the Damage Roll box has anything other than 0, the header reads "Attack Roll (RollType)".
The second line holds the roll results. The d20 result comes first, with a Rumble Slim style tooltip. A roll of 1 or 20 will have either "Failure!" or "Critical Success!" just after this. If the Damage Roll box has anything other than 0, damage results are printed next, otherwise the line ends.

It's not much, but it should help run a playtest character.

EDIT: And I just realized I posted this in the User Creations forum instead of the Drop-In Resources forum... Sorry, mods :oops:
Attachments
Generic5e.mtmacro
(1.39 KiB) Downloaded 111 times

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Generic D&D 5e Playtest Macro

Post by wolph42 »

hi eshelon, had a quick look and I noticed you are not yet familiar with: Wiki: max() and Wiki: min(). have a look

also the last 4 if statements can also be written as:

Code: Select all

            [if(d20roll==20):"<font color=red>, <b>Critical Success!</b></font>"]
            [if(d20roll==1):"<font color=blue>, <b>Failure!</b></font>"]
            [if(dmgRoll!=0 && d20roll!=1 && d20roll!=20):", [dmgRoll] damage."]
            [if(dmgRoll!=0 && d20roll==20):", [critDamage] damage."] 

Esheon
Giant
Posts: 115
Joined: Mon Dec 26, 2011 12:53 am

Re: Generic D&D 5e Playtest Macro

Post by Esheon »

wolph42 wrote:hi eshelon, had a quick look and I noticed you are not yet familiar with: Wiki: max() and Wiki: min(). have a look

also the last 4 if statements can also be written as:

Code: Select all

            [if(d20roll==20):"<font color=red>, <b>Critical Success!</b></font>"]
            [if(d20roll==1):"<font color=blue>, <b>Failure!</b></font>"]
            [if(dmgRoll!=0 && d20roll!=1 && d20roll!=20):", [dmgRoll] damage."]
            [if(dmgRoll!=0 && d20roll==20):", [critDamage] damage."] 
Sweet, thanks! I'm always happy to learn a better way of doing things. :)

EDIT: After looking at min() and max(), is there a way to get both of the d20 rolls into the tooltip I'm using there? I've grown attached to that style of tooltip for attack rolls.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Generic D&D 5e Playtest Macro

Post by wolph42 »

i dont see why not you use three vars, e.g.:

Code: Select all

    [h:d20roll = min(d20roll1,d20roll2)]
    [h: rollTT = "Lowest of ("+d20roll1+", "+d20roll2+")"]
 
this leaves roll1 and 2 unchanged and thus available for the tooltip

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Generic D&D 5e Playtest Macro

Post by aliasmask »

I have some code and screenshots here: http://forums.rptools.net/viewtopic.php ... 92#p225246

Esheon
Giant
Posts: 115
Joined: Mon Dec 26, 2011 12:53 am

Re: Generic D&D 5e Playtest Macro

Post by Esheon »

Cool. The min/max thing will trim out a good bit, and it'll come in handy in some of my 4e stuff.

Of course, Aliasmask's macro blows mine out of the water :P

Post Reply

Return to “User Creations”