Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Healing potion macro for TokenMod help

January 17 (3 weeks ago)

I've found functional macros for automatically applying healing potion effects to tokens, which work great. What I'd like to do if possible:

  1. Instead of using the --report function to report healing done, I'd like to have it output with a 5e OGL template. Example:
  2. Have a dropdown menu to choose the type of potion, and then have the effects work as above (this one isn't that important, would just be nice).


I feel like the first entry must be possible and I just can't figure it out, the second one sounds like a pipe dream. Any help would be appreciated!

January 17 (3 weeks ago)
timmaugh
Pro
API Scripter

The Metascript Toolbox can batch up commands and let you use rolls across lines (so you can report the correct numbers as a part of the same command, but as a separate message). Can you share the text of your TokenMod command?

January 17 (3 weeks ago)

Edited January 17 (3 weeks ago)


timmaugh said:

The Metascript Toolbox can batch up commands and let you use rolls across lines (so you can report the correct numbers as a part of the same command, but as a separate message). Can you share the text of your TokenMod command?


For sure:

!modattr --silent --name @{selected|token_name} --repeating_resource_$0_resource_right|-1
!token-mod {{
  --set
    bar1_value|+[[2d4+2]]!
 --report
    all|"{name} takes a healing potion and regains {bar1_value:abschange}hp."
    gm:control|"{name} hp change: {bar1_value:before} -> {bar1_value} (+{bar1_value:abschange}hp)"
}}
/w gm @{selected|token_name} has [[@{selected|repeating_resource_$0_resource_right}-1]] healing potions left
I'm not even aware of what Metascripts are ha

January 17 (3 weeks ago)

Edited January 17 (3 weeks ago)

1. Not only with TokenMod - it doesn't have a way to output in a roll template (that I'm aware of).  But you could probably construct your own output into a roll template that references the current HP and healed amount.

2. Yes:

!token-mod {{
  --set
    bar1_value|+[[?{Healing Potion?|Regular,2d4+2|Greater,4d4 + 4|Superior,8d4 + 8|Supreme,10d4 + 20}]]!
 --report
    all|"{name} takes a healing potion and regains {bar1_value:abschange}hp."
    gm:control|"{name} hp change: {bar1_value:before} -> {bar1_value} (+{bar1_value:abschange}hp)"
}}
January 17 (3 weeks ago)


Jarren said:

1. Not only with TokenMod - it doesn't have a way to output in a roll template (that I'm aware of).  But you could probably construct your own output into a roll template that references the current HP and healed amount.

2. Yes:

!token-mod {{
  --set
    bar1_value|+[[?{Healing Potion?|Regular,2d4+2|Greater,4d4 + 4|Superior,8d4 + 8|Supreme,10d4 + 20}]]!
 --report
    all|"{name} takes a healing potion and regains {bar1_value:abschange}hp."
    gm:control|"{name} hp change: {bar1_value:before} -> {bar1_value} (+{bar1_value:abschange}hp)"
}}


That works perfectly for the drop down functionality. I can live without the pretty template. Thanks :)

January 18 (3 weeks ago)
timmaugh
Pro
API Scripter


Sandwich said:

I'm not even aware of what Metascripts are ha



I...

I just... need a second...

Metascripts work with other scripts to provide functionality otherwise unavailable on Roll20. You can watch this video to learn more.

If you want to do what I'm about to show, you'll need to install the Metascript Toolbox (available in the 1-click). The Toolbox is a set of scripts that perform discrete jobs. One handles special operations with selected tokens, one provides IF/THEN logical constructions to command lines, one provides access to game information not normally available to macros, etc.

Starting with what Jarren showed, we'll move the report out to it's own command in a ZeroFrame batch (ZeroFrame is part of the Toolbox).

!{{
  !token-mod --set bar1_value|+[[?{Healing Potion?|Regular,2d4+2|Greater,4d4 + 4|Superior,8d4 + 8|Supreme,10d4 + 20}]]!
  (^){^&template:simple}({)rname=Healing Potion(}) ({)r1={^&math @^(selected.bar1)-@(selected.bar1)} (}) ({)normal=1(})({)charname=@{selected|token_name} (})
}}

I also use Fetch (another Metascript) to get info from the token, and MathOps (yep, another Metascript) to perform math at the appropriate time.

There's probably more you could do to pretty it up or to convey more information (and the Toolbox can help with that, should you like), but this gets the basic idea across.

January 24 (2 weeks ago)

I have a PRO subscription.
I’ll ask a question here: if I want the healing ability to automatically calculate the healing using the formula and adjust the target's health to a certain amount, BUT if a natural 1 (fail) is rolled, it won't heal, how can I do that?

I managed to create an auto-heal system with commands, yes, but the issue remains with the fail and the cancellation of the healing because of it, as well as displaying how much was healed in the ability's output in the chat.

January 24 (2 weeks ago)
timmaugh
Pro
API Scripter

Probably a few ways, but with the Metascript Toolbox, just use an IF block:

!{&if [[1d20]] > 1}token-mod --set ... {&end}

Remembering that the activation/targeting roll is in the IF block, so you'd have to refer to it by re-using rolls notation (rollmarker)... ie, $[[0]], $[[1]], etc., depending on its position.

If it's a few commands that have to be managed, you can use ZeroFrame batching (also from the Toolbox):

!{{
  {&if [[1d20]] > 1}
    !token-mod --set ...
    !otherthings ...
  {&end}
}}

I can give more specific help if you share your current commands. For instance, if you already use the double-braces trick for your TokenMod command:

!token-mod {{
  --set
    ...
}}

...then there are some other substitutions that would be necessary. Again, easier to diagnose if I can see the original commands.

January 24 (2 weeks ago)

Forgot to mention, I downloaded the Metascript toolbox and played with it, very powerful stuff. I got it to work exactly the way I wanted, thanks for the help.