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

Help with a macro using an Input Box

January 04 (8 years ago)
I am trying to make a macro that heals a target token and outputs the amount healed into the chat log.
I'm using TokenMod to handle modifying the HP of the token but can't figure out how to add the amount healed to the chat log.

 !token-mod --set bar3_value|?{Total amount healed}
&{template:default} name={{@{selected|character_name}}} {{________}}}

Any help would be greatly appreciated. 
January 04 (8 years ago)

Edited January 04 (8 years ago)
Try:
!token-mod --set bar3_value|+?{Total amount healed|1}
&{template:default} {{name=@{selected|token_name}}} {{Amount healed=?{Total amount healed} HP}}
January 04 (8 years ago)
Thank you, worked perficly 
January 04 (8 years ago)
Is there a way to extend that to work with a nested query? I've been struggling for a couple of weeks (ever since deciding to upgrade to Pro) to come up with a macro for potions of healing (using the 5eOGL template). I'd like to give my players the option to select which type of potion they're drinking and use the same dice result for both !token-mod (or !setattr - whatever it takes to actually update the character's hit points) and the chat log.

I've tried everything I can think of as well as numerous permutations of everything I've found online but I think I'm missing something about how inline rolls work... This is how I tried to modify Silvyre's code:
!token-mod --set bar3_value|+?{Potion type|healing,[[2d4+2]]|greater healing,[[4d4+4]]|superior healing,[[8d4+8]]|supreme healing,[[10d4+20]]}
&{template:default} {{name=@{selected|token_name}}} {{Amount healed=?{Potion type} HP}}

I'm pretty sure that what I'm seeing is the second "?{Potion type}" is being re-rolled rather than using the value from the original roll. I think that because I've encapsulated the value in [[ ]], it's rolling it again for the chat log. Is that the expected behavior when using [[ ]] in that manner?

So then I tried this but it doesn't update bar3.
!token-mod --set bar3_value|+[[?{Potion type|healing,2d4+2 |greater healing,4d4+4 |superior healing,8d4+8 |supreme healing,10d4+20 }]]

Can an inline roll be "re-used"? Am I going about this all wrong?

/first post!
January 04 (8 years ago)

Eric M. said:

Can an inline roll be "re-used"?

Unfortunately not like this; you'll have to settle for two macros if you want to use TokenMod:
/em drinks a health potion: ?{Potion type|healing,[[2d4+2]]|greater healing,[[4d4+4]]|superior healing,[[8d4+8]]|supreme healing,[[10d4+20]]}
!token-mod --set bar3_value|+?{Total amount healed|7}
&{template:default} {{name=@{selected|token_name}}} {{Amount healed=?{Total amount healed} HP}}
January 04 (8 years ago)
Would this be easier using !setattr API or would it be the exact same is !token-mod?
January 04 (8 years ago)
The Aaron
Pro
API Scripter
Would be the same issue.  The problem is that the inline roll is resolved in the API and isn't available for use in other messages, or it must be resolved in the chat but can't be referenced again for the API chat command directly (hence the roll query to type it in).

This problem is in fact the exact reason that CharMod isn't out yet, despite being functionally complete.  I wanted to fix this problem first (which I've mostly done, just need to pick it up again).
January 04 (8 years ago)
Excellent, I've been tossing around my brain how to get healing to automatically update a Character and I couldn't think of anyway of doing it. It sure would be nice though.
January 06 (8 years ago)

Edited January 06 (8 years ago)

Jerry F. said:

Excellent, I've been tossing around my brain how to get healing to automatically update a Character and I couldn't think of anyway of doing it. It sure would be nice though.

I just built this for the cleric spell Aid. It allows the player to target 3 characters and it'll auto-update their HP by updating bar3_value (it doesn't touch their max HP - it should, by rule, but I don't want to get mixed up with having to reset the max when the spell wears off). bar_3 is tied to character HP through the token properties. The last 3 lines present buttons in the chat window that allow the player to auto-track the level of the spell slot used. Dynamically updating spell slot level based on a query value is something else I haven't figure out yet.

&{template:default} {{name=Aid}} {{desc=Kalfr calls upon the aid of Tempus to grant ?{Spell slot level|2,5|3,10|4,15} additional hit points to @{target|Target1|token_name}, @{target|Target2|token_name} and @{target|Target3|token_name}}}

!token-mod --ids @{target|Target1|token_id} @{target|Target2|token_id} @{target|Target3|token_id} --set bar3_value|+?{Spell slot level} --set statusmarkers|chained-heart

[Update 2nd level spell slot](! #Kalfr-Spell-Slot-2)
[Update 3rd level spell slot](! #Kalfr-Spell-Slot-3)
[Update 4th level spell slot](! #Kalfr-Spell-Slot-4)

January 06 (8 years ago)
Also, thanks to everyone for the responses. I think we'll just keep using the token to update HP from potions.