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

Macro Assistance : Rolling against a token variable with different outcomes

February 15 (1 month ago)
Cat
Pro

Hi,

I've been researching what I thought should be an easy macro - but either it’s really complicated or I’m just not ‘getting it’.

Sheet : D&&D 5E 2014 by Roll20

Pro subscription on Jumpgate


I have a one shot silly idea to include a mechanic similar to “lasers and feelings” that I’m calling Havoc or Harmony. I’m using the hero points sections of their character sheets to contain a variable for my players who will have to roll above or below it to show their outcome.

I’m after a macro that will, when a token is selected

  1. offer a drop-down to choose Havoc or Harmony
  2. roll a d6 and compare the roll against their variable (let’s call it their H value)
  3. If Havoc, they need to roll under their H to succeed
  4. If Harmony, they needs to roll over their H to succeed
  5. ‘True Balance’ happens when the rolled value equals the H 

I would like be able have the players press a macro button which displays the rolled value vs their H value and what the result is based upon points 3, 4, 5 above.

I gather that I can’t do this via a straight macro and need to use a sheet template, but that’s where I got very confused. I would welcome any advise

February 15 (1 month ago)

Edited February 15 (1 month ago)

Well, a simple way to do this would be

$[[1.computed]] vs. [[@{selected|H}]] = [[{[[1d6]],@{selected|H}}?{Havoc or Harmony|Havoc,<@{selected|H}f>@{selected|H}]] (Havoc)|Harmony,>@{selected|H}f<@{selected|H}]] (Harmony)}

which will return 1 on success, -1 on fail, and 0 on true balance (assuming the variable is attribute H). If you want something more elaborate, I sure could write something with template trickery tomorrow.

February 16 (1 month ago)

Alright, update, here's a more elaborate implementation, you can edit the success/fail/true balance text more or less however you like:

&{template:default} {{[[[-1]]]=[ ](#" hidden null=)
}} {{[[[0]]]=[Fail](#" style="color:inherit)[ ](#" hidden null=)
}} {{[[[1]]]=[True Balance](#" style="color:inherit)[ ](#" hidden null=)
}} {{[[[2]]]=[Success](#" style="color:inherit)[ ](#" hidden null=)
}} {{[[[?{Havoc or Harmony|Havoc,{[[1d6cs<@{selected|H}cf>@{selected|H}]]&comma;@{selected|H}&rbrace;<@{selected|H}f>@{selected|H}]]]=[ ](#)&rbrace;&rbrace; &lbrace;&lbrace;name=@{selected|character_name}: Havoc [ ](#" hidden null=)|Harmony,{[[1d6cs>@{selected|H}cf<@{selected|H}]]&comma;@{selected|H}&rbrace;>@{selected|H}f<@{selected|H}]]]=[ ](#)&rbrace;&rbrace; &lbrace;&lbrace;name=@{selected|character_name}: Harmony [ ](#" hidden null=)}
}} {{=[ ](#) ($[[4.computed]] against [[@{selected|H}]])}}

(The bracketed number at the left can't be helped, due to how this macro is built on a  particular quirk of passing CSS between elements)

February 16 (1 month ago)
Cat
Pro

I am speechless… thank you.

i was starting to try and research something, but your answer is not only elegant but way beyond where I would have got.

thank you again