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

BECMI Character sheet macro question.

I am trying to learn to set up macros.&nbsp; &nbsp;How would I set up a character sheet macro to press the highlighted button? It is on the combat tab of the sheet which is the 4th tab over if that matters.&nbsp; This is also a repeating line that could have multiple entries.&nbsp; I've seen some tutorials for 5th edition sheets but I can't figure out how to do it on this one.&nbsp; Thank you.&nbsp; Link to source code. <a href="https://github.com/allenmaher/roll20-character-sheets/tree/master/D%26D_BECM" rel="nofollow">https://github.com/allenmaher/roll20-character-sheets/tree/master/D%26D_BECM</a> &lt;/ div &gt; &lt; span class = " sheet-spacer " &gt;&lt;/ span &gt; &lt; h4 class = " sheet-center " &gt;Melee Weapons / Unarmed Attacks &lt; span class = " sheet-pictos " &gt;D&lt;/ span &gt;&lt;/ h4 &gt; &lt; div class = " sheet-row sheet-sub-header " &gt; &lt; div class = " sheet-col-1-16 sheet-center sheet-small-label sheet-vert-bottom " &gt;Vs&lt;/ div &gt; &lt; div class = " sheet-col-1-6 sheet-center sheet-small-label sheet-vert-bottom " &gt;Weapon&lt;/ div &gt; &lt; div class = " sheet-col-1-12 sheet-center sheet-small-label sheet-vert-bottom sheet-padr " &gt;Mastery Bonus&lt;/ div &gt; &lt; div class = " sheet-col-1-12 sheet-center sheet-small-label sheet-vert-bottom sheet-padr " &gt;Magic Bonus&lt;/ div &gt; &lt; div class = " sheet-col-1-12 sheet-center sheet-small-label sheet-vert-bottom " &gt;Damage Dice&lt;/ div &gt; &lt; div class = " sheet-col-1-12 sheet-center sheet-small-label sheet-vert-bottom " &gt;AC Bonus&lt;/ div &gt; &lt; div class = " sheet-col-1-6 sheet-center sheet-small-label sheet-vert-bottom sheet-padr " &gt;Effects&lt;/ div &gt; &lt; div class = " sheet-col-1-6 sheet-center sheet-small-label sheet-vert-bottom sheet-padr " &gt;Save vs&lt;/ div &gt; &lt; div class = " sheet-col-1-24 sheet-center sheet-small-label sheet-vert-bottom sheet-padr " &gt;Attack&lt;/ div &gt; &lt;/ div &gt; &lt; fieldset class = " repeating_meleeattacks " &gt; &lt; div class = " sheet-row " &gt; &lt; div class = " sheet-col-1-16 sheet-padr " &gt; &lt; select name = " attr_meleetarget " &gt; &lt; option value = " A " selected = " selected " &gt;A&lt;/ option &gt; &lt; option value = " H " &gt;H&lt;/ option &gt; &lt; option value = " M " &gt;M&lt;/ option &gt; &lt;/ select &gt; &lt;/ div &gt; &lt; div class = " sheet-col-1-6 sheet-padr " &gt;&lt; input type = " text " name = " attr_meleeweaponname " &gt;&lt;/ div &gt; &lt; div class = " sheet-col-1-12 sheet-padr " &gt;&lt; input type = " number " name = " attr_meleemastery " value = " 0 " step = " 1 " &gt;&lt;/ div &gt; &lt; div class = " sheet-col-1-12 sheet-padr " title = " The magic bonus will be added as a bonus to BOTH the attack and damage rolls " &gt;&lt; input type = " number " name = " attr_meleemagic " value = " 0 " step = " 1 " &gt;&lt;/ div &gt; &lt; div class = " sheet-col-1-12 sheet-padr " title = " Only enter the base damage roll here without any bonuses from stats or magic " &gt;&lt; input class = " sheet-center " type = " text " name = " attr_meleedmg " value = " 0 " &gt;&lt;/ div &gt; &lt; div class = " sheet-col-1-12 sheet-padr " &gt;&lt; input type = " text " name = " attr_meleeacbonus " &gt;&lt;/ div &gt; &lt; div class = " sheet-col-1-6 sheet-padr " &gt;&lt; input type = " text " name = " attr_meleeeffects " &gt;&lt;/ div &gt; &lt; div class = " sheet-col-1-6 " &gt;&lt; input class = " sheet-center " type = " text " name = " attr_meleesaves " &gt;&lt;/ div &gt; &lt; div class = " sheet-col-1-24 sheet-center " &gt; --------------------&gt; &lt; button type = " roll " class = " sheet-roll " name = " roll_MeleeAttack " value = " &amp;{template:5eDefault} {{weapon=1}} {{title=@{meleeweaponname}}} {{subheader=@{character_name}}} {{subheaderright=vs @{meleetarget}}} {{attack=[[@{thac0}-@{meleemagic}-@{meleemastery}-[[@{strength_mod}]]-{1d20}]]}} {{damage=[[@{meleedmg}+@{meleemagic}+[[@{strength_mod}]]]]}} {{attackshowinfoblock=1}} {{attackrange=Melee}} {{attackacmod=@{meleeacbonus}}} {{attackeffects=@{meleeeffects}}} {{attacksave=@{meleesaves}}} " &gt;&lt;/ button &gt; &lt;/ div &gt; &lt;/ div &gt;
1536462685
GiGs
Pro
Sheet Author
API Scripter
What do you mean by a macro to roll the button? Macros can't affect the character sheet in any way.
1536463457
The Aaron
Pro
API Scripter
Assuming this is the first entry in the repeating group and depending on what you mean... You could call it from a Macro or chat with a token selected using: %{selected|repeating_meleeattacks_$0_MeleeAttack} You could call it from an Ability using: %{repeating_meleeattacks_$0_MeleeAttack} You could call it from about anywhere on a specific Character using it's character_id: %{-LLr2OSYVH8TFWdDPreD|repeating_meleeattacks_$0_MeleeAttack} Or the character name, if it's unique: %{Bob the Slayer|repeating_meleeattacks_$0_MeleeAttack}
Wow.&nbsp; &nbsp;Thanks for the fast reply.&nbsp; Two questions What if it were the second or third on the list. What if it were a button on another tab on the character sheet say spells or saves? Is it always %?
1536464532

Edited 1536464844
The Aaron
Pro
API Scripter
The rows are 0-biased, meaning they start counting at 0 and count up.&nbsp; You can think if the index as an offset from the beginning.&nbsp; The second row would be at offset 1, so $1 instead of $0, then $2, $3, etc.&nbsp; If the index doesn't exist, it will give a bunch of errors.&nbsp; If you reorder the repeating rows, the $0 will always be whatever is currently first.&nbsp; If you prefer, you can get the row id and use that instead of the $0 etc.&nbsp; The benefit of using the row id is it will refer to that specific row no matter the reordering.&nbsp; The row id is a bit annoying to get, but you can inspect the character sheet at runtime and pull it from the data-reprowid attribute of the class repitem element wrapping the contents of the row.&nbsp; You can probably find it by hitting the button and pushing up in the chat and looking at what was sent to the chat depending on how the author implemented it.&nbsp; That looks like one of: %{selected|repeating_meleeattacks_-LLwLSwNAuPZQiLEEPqj_MeleeAttack} %{repeating_meleeattacks_-LLwLSwNAuPZQiLEEPqj_MeleeAttack} %{-LLr2OSYVH8TFWdDPreD|repeating_meleeattacks_-LLwLSwNAuPZQiLEEPqj_MeleeAttack} %{Bob the Slayer|repeating_meleeattacks_-LLwLSwNAuPZQiLEEPqj_MeleeAttack} Tabs on a character sheet are just a visual presentation, they have no effect on what is available on the character.&nbsp; You'd just find the repeating group name and the button name and either use the $0 syntax of the row id syntax. If you are immediately invoking action, it is %{ STUFF }.&nbsp; There is an alternate syntax if you want to put a button in chat to invoke the action by clicking it.&nbsp; For that you'd do one of these: [Some Label Text](~selected|repeating_meleeattacks_$0_MeleeAttack) [Some Label Text](~-LLr2OSYVH8TFWdDPreD|repeating_meleeattacks_$0_MeleeAttack) [Some Label Text](~Bob the Slayer|repeating_meleeattacks_$0_MeleeAttack) That would give you a pink button that says Some Label Text.&nbsp; Clicking it would execute the action as if you'd clicked the button on the sheet.&nbsp; This is really handy for building menus of possible actions to whisper to yourself.
G G said: What do you mean by a macro to roll the button? Macros can't affect the character sheet in any way. The button is already a quick access to attacksin the character sheet.&nbsp; I was trying to figure out how to hit it from a token macro.&nbsp; The answers above helped a lot and if the other two questions are answered I think I might be able to reverse engineer any future macro questions.&nbsp; Thank you for taking interest in my question.&nbsp;
So much there that I have no idea what you are saying.&nbsp; I am brand new to roll20, although my account was opened 2 years ago.&nbsp; I have almost 0 scripting experience but I have enough common sense to use a template to work things out.&nbsp; &nbsp; Your replies have given me hours of less work and I appreciate it very much.&nbsp; &nbsp;Thank you. The Aaron said: The rows are 0-biased, meaning they start counting at 0 and count up.&nbsp; You can think if the index as an offset from the beginning.&nbsp; the second row would be at offset 1, so $1 instead of $0, then $2, $3, etc.&nbsp; If the index doesn't exist, it will give a bunch of errors.&nbsp; If you reorder the repeating rows, the $0 will always be whatever is currently first.&nbsp; If you prefer, you can get the row id and use that instead of the $0 etc.&nbsp; The benefit of using the row id is it will refer to that specific row no matter the reordering.&nbsp; The row id is a bit annoying to get, but you can inspect the character sheet at runtime and pull it from the data-reprowid attribute of the class repitem element wrapping the contents of the row.&nbsp; You can probably find it by hitting the button and pushing up in the chat and looking at what was sent to the chat. Tabs on a character sheet are just a visual presentation, they have no effect on what is available on the character.&nbsp; You'd just find the repeating group name and the button name and either use the $0 syntax of the row id syntax. If you are immediately invoking action, it is %{ STUFF }.&nbsp; There is an alternate syntax if you want to put a button in chat to invoke the action by clicking it.&nbsp; For that you'd do one of these: [Some Label Text](~selected|repeating_meleeattacks_$0_MeleeAttack) [Some Label Text](~-LLr2OSYVH8TFWdDPreD|repeating_meleeattacks_$0_MeleeAttack) [Some Label Text](~Bob the Slayer|repeating_meleeattacks_$0_MeleeAttack) That would give you a pink button that says Some Label Text.&nbsp; Clicking it would execute the action as if you'd clicked the button on the sheet.&nbsp; This is really handy for building menus of possible actions to whisper to yourself.
1536465031
The Aaron
Pro
API Scripter
No problem!&nbsp; I edited that message to add a few more examples.&nbsp; Whichever part is confusing, I can go into more detail about.&nbsp; I'm betting it's the rowid stuff (which is why I added some examples).&nbsp; Row ID is super annoying to get at.
The Aaron said: No problem!&nbsp; I edited that message to add a few more examples.&nbsp; Whichever part is confusing, I can go into more detail about.&nbsp; I'm betting it's the rowid stuff (which is why I added some examples).&nbsp; Row ID is super annoying to get at. Yes it was definately all of the row id stuff and how to get it.&nbsp; But BECMI is a really simple game and I am trying to put together a monster manual with character sheets.&nbsp; &nbsp;What you have given me is way more than enough to get the job done.&nbsp; &nbsp; Unfortunately now I am probably not going to get any sleep tonight.&nbsp; &nbsp;:-)
1536465750
The Aaron
Pro
API Scripter
Well, I can't help you there! =D If you can get by without the Row IDs, you're probably better off. If you do need them, you would: Load a character sheet in the game, Right click the repeating row with the button Choose inspect in the browser's popup menu Scroll up the HTML until you find the repitem element with the data-reprowid attribute and copy it's value. For the first row, it will be adjacent to the repeating group repcontainer element opening tag.