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

Ammo (the ammunition Application Programming Interface) with Harnmaster 3

1638648346

Edited 1638648443
Jens
Pro
The ammo API is working great, but how should I find out the proper parameter for arrows in the Harnmaster 3 character sheet, where the parameter name is not shown under the Attributes tab? Obviously I could add a new arrow parameter on my own, but it wouldn't the parameter that is shown on the character sheet. Let's assume that editing my own copy of the character sheet is forever beyond my capability. What parameter name should I use for the first missile weapon, the second etc., as input to the Ammo API for the current Harnmaster 3 character sheet?
1638651885
Kraynic
Pro
Sheet Author
You right click on the input and select inspect element from the right click menu.&nbsp; That will show you the html for that part of the sheet. From there, you can put together the 3 part attribute needed for any input that is inside a repeating section.&nbsp; This is a place in the wiki that mentions the structure for repeating section attributes:&nbsp; <a href="https://wiki.roll20.net/Macros#Referencing_Repeating_Attributes" rel="nofollow">https://wiki.roll20.net/Macros#Referencing_Repeating_Attributes</a> A post I made with some explanation on how to get the parts of a repeating section attribute:&nbsp; <a href="https://app.roll20.net/forum/permalink/9975173/" rel="nofollow">https://app.roll20.net/forum/permalink/9975173/</a> I thought I had made a post at some point with screenshots of the console and everything, but can't seem to find it now.
1638653184
Kraynic
Pro
Sheet Author
Ok, I found my post with a little more in depth description.&nbsp; It can be found here:&nbsp; <a href="https://app.roll20.net/forum/permalink/10478744/" rel="nofollow">https://app.roll20.net/forum/permalink/10478744/</a> While that example is using the Pathfinder by Roll20 sheet, that process will work with any sheet.
Sir, thank You for Your quick response. Alas, the Harnmaster 3 does not seem to be generic enough.
1638655532
Kraynic
Pro
Sheet Author
You need to go through the steps I did to get the right attribute for Harnmaster.&nbsp; What is in my post is the Pathfinder by Roll20 sheet, so I didn't expect you to be able to take the attribute name I came up with.&nbsp; You need to follow the instructions/steps I went through on the Pathfinder sheet so that you can construct the attribute in whatever sheet you are using.
1638656162
Kraynic
Pro
Sheet Author
I don't play that game system and am not familiar with the sheet, so it took me a while to figure out how to add a missile weapon.&nbsp; Assuming I am looking at the right sheet, I right clicked on the ammunition box, selected inspect element, and this is what came up: Post back if you can't follow my steps from the other post.
1638656738

Edited 1638657930
Jens
Pro
Sir, I am very grateful for Your efforts and by right clicking the ammo field on the actual character sheet, I manage to find, inspect and copy the element,&nbsp; &lt;input type="number" name="attr_missileweapon_ammo" class="skill-value"&gt;. Yours seem more to the point. This is very advanced to me, how exactly should I put together a phrase for the correct input for the Ammo API in this case, from the element above?
1638657537

Edited 1638657870
Jens
Pro
Here is where I right-click:
1638659002

Edited 1638659034
Jens
Pro
This, alas, does not work: @{selected|whispertype} &amp;{template:pc} {{name=Short Bow}} {{type=attackdamage}} {{showchar=@{selected|rollshowchar}}} {{charname=@{selected|character_name}}} {{nonlethal=[[1[Nonlethal]]]}} {{attack=1}}{{range=60}}{{roll=[[1d20cs&gt;20 + 2[Ranged] + 0[Ability] + 0[MOD] + 0[TEMP] + (@{selected|attack_condition})[CONDITION] + @{selected|rollmod_attack}[QUERY] ]]}} {{critconfirm=[[1d20cs20 + 2[Ranged] + 0[Ability] + 0[MOD] + 0[TEMP] + (@{selected|attack_condition})[CONDITION] + @{selected|rollmod_attack}[QUERY] + @{selected|critconfirm_bonus}[CRIT CONFIRM BONUS] ]]}}{{atkvs=(Ranged vs AC)}}{{shownotes=[[1]]}}{{notes=}}{{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d6+0[Ability] + 0[MOD] + 0[TEMP] + @{selected|rollmod_damage}[QUERY]]]}}{{dmg1type=Piercing}}{{dmg1crit=[[((1d6+1d6+1d6) + (0[Ability] + 0[MOD] + 0[TEMP] + @{selected|rollmod_damage}[QUERY]) * 3)]]}} {{conditionsflag=[[@{selected|attack_condition}]]}} {{conditions=@{selected|conditions_display}}} {{conditionsnote= @{selected|attack_condition_note}@{selected|damage_condition_note}}} !ammo @{selected|token_id} @{selected|attr_missileweapon_ammo} -1 arrow
1638660088

Edited 1638660112
Jens
Pro
1638664934

Edited 1638665079
Kraynic
Pro
Sheet Author
Ok, from the post I linked: To find out things like that, the best way to do so is to use your browser inspect the input you want to target.&nbsp; Just right click and select "inspect" from the menu.&nbsp; If you are inspecting something that isn't in a repeating section, then you only need to look at the attribute name that gets highlighted by inspect.&nbsp; If you are in a repeating section (like attacks, inventory, etc. on this sheet), then you also need the repeating section name because a repeating section attribute has 3 parts that are all separated by underscores. 1: repeating section name 2: row index or row ID 3: input attribute name. Any attribute in a repeating section has those 3 parts.&nbsp; They are always assembled in that order. You see the part that is highlighted includes name="attr_quantity".&nbsp; The attr_ part is just telling Roll20 that this is an attribute, so you drop that when you use it in a macro.&nbsp; Part 3 of the attribute here is "quantity. Part 3 is what is highlighted when you hit inspect.&nbsp; As I said in the other post, you never use "attr_" as part of an attribute call.&nbsp; Part 3 on your sheet is "missileweapon_ammo".&nbsp; You can't try using this on it's own, because this attribute is part of a repeating section, so the macro needs to know which repeating section (part 1) and which row (part 2) in which to find this particular "missileweapon_ammo". If you look a little ways up, there is a line that has name="repeating_gear".&nbsp; So the first part of the full attribute will be "repeating_gear". If you follow the code up, in the code you inspect (I made sure it was included in my screenshot), you will find name="repeating_missileweapon".&nbsp; That means that "repeating_missileweapon is the repeating section name, and is part 1 of your attribute call for your macro. Since this was the first item, I should be able to tell which row of repeating gear should be used to pull the quantity.&nbsp; But I could also use the exact row ID.&nbsp; You can see a data-reproid="-LxDUds84EK7BThOe8E0".&nbsp; That is the middle part if I want this to work if that row gets moved to somewhere else in the inventory list. In my screenshot, you can see the data-reproid.&nbsp; That can be used as the middle (part 2) part of the attribute call if there is a chance the player using this sheet will ever change the order of the weapons in this repeating section.&nbsp; This id number is generated when the row is created and will stay with it no matter where it is moved to.&nbsp; If they won't ever change the order, you can just use the row number instead.&nbsp; The rows start counting at 0, so the first row would be $0 if you are just using the row number.&nbsp; Row 3 would be $2, etc.&nbsp; So we have the following parts: 1. "repeating_missileweapon" 2. "-Mq6V2kEh7riAEL66zBu" (id) or $0 (row number) 3. "missileweapon_ammo" As stated above, all of these parts are put together separated by an underscore.&nbsp; Now, keep in mind that you can't blindly use what I have here.&nbsp; That id number is from the sheet I created, and will not work on yours, because you would need the unique ID you get from inspecting your sheet.&nbsp; If you use row number, then you need to use whatever corresponds to the row you are wanting to manipulate on your sheet.&nbsp; The row number I have there is for the first row. If I was to use this in ammo on the sheet I was inspecting, the attribute would be: repeating_missileweapon_-Mq6V2kEh7riAEL66zBu_missileweapon_ammo or repeating_missileweapon_$0_missileweapon_ammo That whole thing needs to replace where you are putting attr_missileweapon_ammo, after you have changed it to either use the correct row ID or row number that you need to manipulate on the sheet in your game. Edit: fixed a couple typos.
1638701935

Edited 1638701962
Jens
Pro
Sir, I have tried to follow your instructions to the letter and to put the correct parts together. The API call&nbsp; !ammo @{selected|character_name} @{selected|repeating_missileweapon_-Mq1HIeeZfxVlZj0iZAp_missileweapon_ammo} -1 arrow does not recognize the&nbsp; @{selected|character_name} phrase. However the API Call call&nbsp; !ammo @{ selected|character_id } @{selected|repeating_missileweapon_-Mq1HIeeZfxVlZj0iZAp_missileweapon_ammo} -1 arrow&nbsp; returns the correct parameter value 100 but is mistaking it for character ID. I feel that I am close, but there is no cigar. What am I missing?
1638716153
Kraynic
Pro
Sheet Author
If you go to the api settings page of your game and click on the Ammo tab, that has instructions and examples for using Ammo.&nbsp; Among the examples you will find this bit: Using a repeating group's field with rowid: !ammo @{character_id} repeating_weapons_-J1as31234_weapon_arrows -1 arrows Using a repeating group's field with index: !ammo @{character_id} repeating_weapons_$2_weapon_arrows -1 arrows The script doesn't want the full @{} syntax for the attribute it is manipulating like a normal macro.&nbsp; It just wants the plain attribute name.&nbsp; If you look back at the post I linked to previously, the command I was using for the Pathfinder sheet is set up this same way.
1638733932

Edited 1638734486
Jens
Pro
Yes! Thank You, the awesomeness is now complete. This works: !ammo @{selected|character_name} repeating_missileweapon_-Mq1HIeeZfxVlZj0iZAp_missileweapon_ammo -1 arrow Thank You for Your great help. I absolutely would never have figured this out otherwise.