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 .
×

Pathfinder by roll20 Character sheet

I'm trying to get the ammo tracker to work with Pathfinder by roll20 character sheet but I can't figure out the coding set up for the ammo slot on the character sheet.  What code do I need to insert into the ammo tracker api macro to get it to track ammo and hopefully other items like food?
1635985154
Kraynic
Pro
Sheet Author
If you mean the ammo script, I set it up as a button included in the description of attacks or abilities, and people click on that when they are using them. One character (Sanos) in my pathfinder game has a shortbow.  The command that I have saved as an ability macro (Attributes & Abilities tab) is simply named arrows and looks like this: !ammo @{selected|token_id} repeating_attacks_$0_atkammo -1 arrow The button in the description section of the shortbow attack looks like this: [Arrow Usage](~Sanos|Arrows) When the attack is made, "Arrow Usage" is in bold letters in the description, and each click of it removes an arrow.  I am just using the row index ($0) instead of the unique row ID, so setting things up that way will fail if the player changes the order of things in that section. To find out things like that, the best way to do so is to use your browser inspect the input you want to target.  Just right click and select "inspect" from the menu.  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.  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. I clicked on the quantity input on the first item in Sanos' inventory.  The code shown in the inspect window looked like this: You see the part that is highlighted includes name="attr_quantity".  The attr_ part is just telling Roll20 that this is an attribute, so you drop that when you use it in a macro.  Part 3 of the attribute here is "quantity. If you look a little ways up, there is a line that has name="repeating_gear".  So the first part of the full attribute will be "repeating_gear". Since this was the first item, I should be able to tell which row of repeating gear should be used to pull the quantity.  But I could also use the exact row ID.  You can see a data-reproid="-LxDUds84EK7BThOe8E0".  That is the middle part if I want this to work if that row gets moved to somewhere else in the inventory list.  That gives us a final attribute to point ammo to that would be written one of these 2 ways: repeating_gear_$0_quantity or repeating_gear_-LxDUds84EK7BThOe8E0_quantity You can do this with any section and input anywhere on the sheet.
Thanks.  That helped alot.  Now I need to figure out how to modify this code to implant the ammo tracker string into this.  Right now I just dropped it at the bottom but it doesn't place it into the attack output template. @{Barry|whispertype} &{template:pc} {{name=Short Bow}} {{type=attackdamage}} {{showchar=@{Barry|rollshowchar}}} {{charname=@{Barry|character_name}}} {{nonlethal=[[1[Nonlethal]]]}} {{attack=1}}{{range=60}}{{roll=[[1d20cs>20 + 2[Ranged] + 0[Ability] + 0[MOD] + 0[TEMP] + (@{Barry|attack_condition})[CONDITION] + @{Barry|rollmod_attack}[QUERY] ]]}} {{critconfirm=[[1d20cs20 + 2[Ranged] + 0[Ability] + 0[MOD] + 0[TEMP] + (@{Barry|attack_condition})[CONDITION] + @{Barry|rollmod_attack}[QUERY] + @{Barry|critconfirm_bonus}[CRIT CONFIRM BONUS] ]]}}{{atkvs=(Ranged vs AC)}}{{shownotes=[[1]]}}{{notes=}}{{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d6+0[Ability] + 0[MOD] + 0[TEMP] + @{Barry|rollmod_damage}[QUERY]]]}}{{dmg1type=Piercing}}{{dmg1crit=[[((1d6+1d6+1d6) + (0[Ability] + 0[MOD] + 0[TEMP] + @{Barry|rollmod_damage}[QUERY]) * 3)]]}} {{conditionsflag=[[@{Barry|attack_condition}]]}} {{conditions=@{Barry|conditions_display}}} {{conditionsnote= @{Barry|attack_condition_note}@{Barry|damage_condition_note}}} !ammo @{selected|token_id} repeating_attacks_$0_atkammo -1 arrow
1636052914
Kraynic
Pro
Sheet Author
I don't know.  I never use ammo that way. If players are testing something or rolling before the game to test (or exhaust?) their luck, then it is still reducing their ammo.  Personally, I don't like things messing with the sheet without direct input from the player, because they may not remember to reset the number if they didn't specifically trigger the reduction themselves. I'm assuming it will trigger just fine as a separate line as you have it if you want it to just go off without using a button, though you will need to set the exact number of arrows used in the macro, or make the quantity used a query.