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

Kids on Brooms Take Half Mechanic Macro

January 11 (1 month ago)

Edited January 11 (1 month ago)

Hi all,

I'm making a custom character sheet template for my Kids on Brooms game. There's a mechanic called Take Half in the game where you can choose to take half the value of your die in that stat instead of rolling so I'd like to make a button for this but I'm having trouble with the macro. I can get the button to roll the die but getting the maximum value and dividing by two doesn't seem to be something roll20 macros can do? Or did I miss something in the wiki?


 <button class="kob-stat__button_takeHalf" name="roll_takeHalf_fight" type="roll" value="&amp;{template:kobrooms} {{name=Take Half of Fight}} {{character_name=@{character_name}}} {{roll=[[1@{fight}]]}}"><span data-i18n="Take Half of Fight">Take Half of Fight Fight</span></button>


is there a way to get the max value of 1@{fight} ?

January 11 (1 month ago)
Gauss
Forum Champion

I don't know about the character sheet coding side, but you can just use Roll20's dice roller stuff for this. 

I am assuming your @{fight} is "d#"
If you pull the "d" out and have @{fight} just # then you can do this:

[[1d@{fight}]] where @{fight} = # rather than d#. 

What that allows you to do is since the maximum value is just a number, you can cut that number in half easily. 
[[@{fight}/2]]


January 12 (1 month ago)

unfortunately [[@{fight}/2]] does not work.

I'm picking apart the Kids on Brooms template to make my own and stats such as {fight} are set by selecting a die type from a dropdown. What is returned is a d4, d6, d8, d10, d12, d20 type value. so [[@{fight}/2]] throws up an error.

I would like to keep the dropdown selection option so that players don't type in 50 or whatever but I don't know how to separate the number from the d in front of it. or if theres a way to access the number of sides on a dice variable. is there a way to get the max value of a dice roll? I feel like I'm missing something super basic  :(


 <div class="kob-stat">
          <button class="kob-stat__button" name="roll_fight" type="roll" value="&amp;{template:kobrooms} {{name=Fight}} {{character_name=@{character_name}}} {{roll=[[1@{fight}!+?{Bonus|Stat,@{fight_stat}|Magic,@{fight_magic}+1@{MagicDie}|None,0}+?{Bonuses / Penalties|0}]]}}"><span data-i18n="Fight">Fight</span></button>
        
          <button class="kob-stat__button" name="roll_takeHalf_fight" type="roll" value="&amp;{template:kobrooms} {{name=Take Half of Fight}} {{character_name=@{character_name}}} {{[[1d@{fight}]]}}"><span data-i18n="Take Half of Fight">Take Half of Fight Fight</span></button>
                
          <div class="kob-stat__wrapper">
            <select class="kob-stat__select" name="attr_fight">
              <option data-i18n="d4" value="d4">d4</option>
              <option data-i18n="d6" value="d6">d6</option>
              <option data-i18n="d8" value="d8">d8</option>
              <option data-i18n="d10" value="d10">d10</option>
              <option data-i18n="d12" value="d12">d12</option>
              <option data-i18n="d20" value="d20">d20</option>
            </select>
            <label class="kob-stat__label">
              <input class="kob-stat__input" name="attr_fight_stat" type="text" value="0"/><span class="kob-stat__tag" data-i18n="Stat">Stat</span>
            </label>
            <label class="kob-stat__label">
              <input class="kob-stat__input" name="attr_fight_magic" type="text" value="0"/><span class="kob-stat__tag" data-i18n="Magic">Magic</span>
            </label>
          </div>
        </div>

January 12 (1 month ago)
Gauss
Forum Champion


cystemic said:

unfortunately [[@{fight}/2]] does not work.

I'm picking apart the Kids on Brooms template to make my own and stats such as {fight} are set by selecting a die type from a dropdown. What is returned is a d4, d6, d8, d10, d12, d20 type value. so [[@{fight}/2]] throws up an error.

I would like to keep the dropdown selection option so that players don't type in 50 or whatever but I don't know how to separate the number from the d in front of it. or if theres a way to access the number of sides on a dice variable. is there a way to get the max value of a dice roll? I feel like I'm missing something super basic  :(

To confirm, are you rebuilding this character sheet? If so I'd take this to the Character Sheet forum. 

With that said, one way you could do it is to use the dropdown to trigger a Rollable Table. 

1t[@{fight}table]
This goes to Rollable Tables named: d4table, d6table, d8table, d10table, d12table, and d20table. 
Each one has a single output. 
Each output is named 2, 3, 4, 5, 6, and 10 respectively. The names become the outputs. 

Note: again, I don't know much of anything about character sheet coding. My skillset is with how to use the Roll20 tools to do things. 
Perhaps you could embed a table lookup in the character sheet for this purpose to mimic the Rollable Table method above. 
But, the best folks to answer this question hang out in the Character Sheet forum. 

January 12 (1 month ago)

I echo what Gauss says about reaching the Character Sheets subforum, however, there is a jank way to do this in-roll:

[[({-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}@{fight}+20)/2]]

Using the dX as drop argument instead of die size, we can construct the die size as a number we can divide.

January 12 (1 month ago)
oops. I didn't realise there was a dedicated character sheet subforum. (this is my first time really using this side of roll20) but Tuo's jank solution worked! I will look up tables and post in the character sheet forums if I have any more questions. thanks all!