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

Specifying repeating_equipment_(id)_equipment_type = "weapon"

1779076240

Edited 1779095733
So sorry, never mind. I've found something else (again via AI) that looks like it will help. I was just using attr before. I've been trying to figure out how to list items in the equipment section. Specifically, missiles, so that I can go in and set up buttons to use charSetAttr to change ammo. There is no obvious help I could find anywhere in roll20 documentation or in the forums on how to list repeating items - at least that I could understand. From Googling and the AI (sorry, I hate AI, but it's been useful here) I've managed to figure something out that lists items that contain key words like arrow, bolt, javelin, etc but I've realized that this could generate false listings so I need to make sure anything that gets picked up by my script is listed as a weapon in the dropbox _equipment_type (gear, weapon, armor, magic, other). 
why not change the location to "ammo"? for most of these things, location is superfluous
DaemonSlye said: why not change the location to "ammo"? for most of these things, location is superfluous Hi DS, I deleted most of my original post, thinking I had found my El Dorado, but of course, I'm arsing that up beyond all recognition, too. :-( I had originally used attr.get which "getted" me no where, except blinking name and current the latter which gave me names of items but SFA else. Now, I'm trying to find the getAttrByName but I'm frigging that up too. There's nothing anywhere in roll20 forums or elsewhere that I can find that tells me definitively how to cycle through repeating rolls. I'm relying on AI results which are making mess up all kinds of things. You and ROTTO have been extraordinarily helpful as has Vince and folks like Keith Curtis, but I'm still haven't been able to scale this wall. I will continue.
1779166504

Edited 1779166546
vÍnce
Pro
Sheet Author
I could tell you how to do it with JS within a sheetwoker, but&nbsp;the API is out of my wheelhouse. Perhaps these posts might help? <a href="https://app.roll20.net/forum/post/8180689/how-to-find-values-for-repeating-section-attributes" rel="nofollow">https://app.roll20.net/forum/post/8180689/how-to-find-values-for-repeating-section-attributes</a> <a href="https://app.roll20.net/forum/post/11676230/help-required-with-repeating-sections-and-api" rel="nofollow">https://app.roll20.net/forum/post/11676230/help-required-with-repeating-sections-and-api</a> FYI: I'm experimenting with working ammo/resource tracking into the sheet.&nbsp; e.g. Bow attack automatically deducts 1 from ammo on the attack.&nbsp; Rolling from an equipment item would deduct 1 from the uses.&nbsp; Cast a spell and it deducts from daily.&nbsp; etc.&nbsp; Opt-in feature with perhaps a little checkbox(lock/unlock) next to the "local" resource to enable auto-deduction.&nbsp; Just kicking it around at the moment...
1779218877

Edited 1779219116
vÍnce said: I could tell you how to do it with JS within a sheetwoker, but&nbsp;the API is out of my wheelhouse. Perhaps these posts might help? <a href="https://app.roll20.net/forum/post/8180689/how-to-find-values-for-repeating-section-attributes" rel="nofollow">https://app.roll20.net/forum/post/8180689/how-to-find-values-for-repeating-section-attributes</a> <a href="https://app.roll20.net/forum/post/11676230/help-required-with-repeating-sections-and-api" rel="nofollow">https://app.roll20.net/forum/post/11676230/help-required-with-repeating-sections-and-api</a> FYI: I'm experimenting with working ammo/resource tracking into the sheet.&nbsp; e.g. Bow attack automatically deducts 1 from ammo on the attack.&nbsp; Rolling from an equipment item would deduct 1 from the uses.&nbsp; Cast a spell and it deducts from daily.&nbsp; etc.&nbsp; Opt-in feature with perhaps a little checkbox(lock/unlock) next to the "local" resource to enable auto-deduction.&nbsp; Just kicking it around at the moment... Thanks Vince, I'd found the second link which I couldn't understand. Aaron's solution on the first is different from I've discovered. Interesting. I actually had FINALLY it figured out a moment ago, but did one too many crtl-Zs and am trying to find my way back. What an idiot&nbsp; LOL. &nbsp; One of the difficulties with tracking ammo is which type of ammo/arrow is it? The qty in the repeating_weapon_$X_weapon_ammo does not, I don't think, cover situations like "Arrows" was what was entered initially. "Arrow, normal, single" was purchased using ROTTO's purchasing script which I have adapted. And what about the magic arrows or silver? :-) I asked on Reddit across several of the forums (I am Tim_Soft there) about what DMs do about recovering arrows and got back a lot of varied answers from roll to recover to simply not tracking at all (which your option to track would certainly cover). What I am close to finishing is meant for me - probably far too sloppy looking for most folks. It is a chat window the DM brings up after a battle or a lull and displays the missiles like the four highlighted in the above screenshot - plus the dagger I'd add and any other spears, javelins, throwing/hand axes (but not normally a battle axe), etc as buttons which the player or DM can click to modify quantities after they've searched for unbroken arrows (if they've had time),
Here's the macro I use:&nbsp;&nbsp; &amp;{template:general}{{name=@{selected|token_name} ATTEMPTS TO RECOVER AMMUNITION}}{{OF THE [[?{HOW MUCH AMMUNITION?|1}]] SHOT(S) FIRED, @{selected|token_name} RECOVERS [[[[[[[[?{HOW MANY SHOTS SUCCESSFULLY HIT? IF YOU ARE NOT IN WIDE OPEN SPACES, COUNT THEM ALL AS HITS.|1}]]D20&gt;[[?{WHAT KIND OF AMMO ARE YOU RECOVERING?|ARROWS AND CROSSBOW BOLTS, 13|BULLETS, 7}-6]]]]]]+[[[[[[?{HOW MUCH AMMUNITION?|1}-?{HOW MANY SHOTS SUCCESSFULLY HIT? IF YOU ARE NOT IN WIDE OPEN SPACES, COUNT THEM ALL AS HITS.|1}]]D100&lt;10]]D20&gt;[[?{WHAT KIND OF AMMO ARE YOU RECOVERING?|ARROWS AND CROSSBOW BOLTS, 13|BULLETS, 7}-4]]]]]] UNIT(S) OF AMMUNITION.}}
1779228501

Edited 1779228589
ROTTO said: Here's the macro I use:&nbsp;&nbsp; &amp;{template:general}{{name=@{selected|token_name} ATTEMPTS TO RECOVER AMMUNITION}}{{OF THE [[?{HOW MUCH AMMUNITION?|1}]] SHOT(S) FIRED, @{selected|token_name} RECOVERS [[[[[[[[?{HOW MANY SHOTS SUCCESSFULLY HIT? IF YOU ARE NOT IN WIDE OPEN SPACES, COUNT THEM ALL AS HITS.|1}]]D20&gt;[[?{WHAT KIND OF AMMO ARE YOU RECOVERING?|ARROWS AND CROSSBOW BOLTS, 13|BULLETS, 7}-6]]]]]]+[[[[[[?{HOW MUCH AMMUNITION?|1}-?{HOW MANY SHOTS SUCCESSFULLY HIT? IF YOU ARE NOT IN WIDE OPEN SPACES, COUNT THEM ALL AS HITS.|1}]]D100&lt;10]]D20&gt;[[?{WHAT KIND OF AMMO ARE YOU RECOVERING?|ARROWS AND CROSSBOW BOLTS, 13|BULLETS, 7}-4]]]]]] UNIT(S) OF AMMUNITION.}} Pretty cool, it works well. :-) I will be doing something similar except corresponding to ammo in the equipment section.&nbsp; My algorithm is fairly primitive though it worked in an earlier attempt. I need to add checking to see if the item selected is chosen as repeating_equipment_${id}_equipment_type = 1 for weapon. I'm not sure if this approach is faster or a whole bunch of || separating the options instead of an else if for each one. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (eqName.includes("arrow")) { isMissile = "y"; } else if (eqName.includes("bolt")) { isMissile = "y"; } else if (eqName.includes("quarrel")) { isMissile = "y"; } else if (eqName.includes("rock")) { isMissile = "y"; } else if (eqName.includes("bullet")) { isMissile = "y"; } else if (eqName.includes("stone")) { isMissile = "y"; } else if (eqName.includes("javelin")) { isMissile = "y"; } else if (eqName.includes("spear")) { isMissile = "y"; } else if (eqName.includes("dart")) { isMissile = "y"; } else if (eqName.includes("dagger")) { isMissile = "y"; } else if (eqName.includes("club")) { isMissile = "y"; } else if (eqName.includes("axe") &amp;&amp; eqName.includes("hand")) { isMissile = "y"; } else if (eqName.includes("axe") &amp;&amp; eqName.includes("throw")) { isMissile = "y"; } else if (eqName.includes("hammer")) { isMissile = "y"; } else if (eqName.includes("club")) { isMissile = "y"; } else { isMissile = "n"; }
I track ammo in the ammo field in the weapons section - I'm not too worried about tracking ammo encumbrance/cost but players can keep it in sync if they wish. We do keep arrow types separate in the weapons - ie. longbow is one entry for normal arrows and +2 arrows is a longbow entry for shooting +2 arrows - the ammo field is separate for both. So when you shoot two arrows from your bow, the arrows get deducted from the ammo field - easy peasy. (For weird stuff like "I have 2 silver arrows" or one "black arrow", I'm fine with them just tracking usage through the equipment section (in my scripts, you just click it to use it and they keep the number of uses in the current uses field). Cheers
DaemonSlye said: I track ammo in the ammo field in the weapons section - I'm not too worried about tracking ammo encumbrance/cost but players can keep it in sync if they wish. We do keep arrow types separate in the weapons - ie. longbow is one entry for normal arrows and +2 arrows is a longbow entry for shooting +2 arrows - the ammo field is separate for both. So when you shoot two arrows from your bow, the arrows get deducted from the ammo field - easy peasy. (For weird stuff like "I have 2 silver arrows" or one "black arrow", I'm fine with them just tracking usage through the equipment section (in my scripts, you just click it to use it and they keep the number of uses in the current uses field). Cheers Interesting approach. I dunno how the sheets work, but being a database guy, I'd have a separate weapons and ammo table with a look-up table pulling PKs from both tables. The latter would be in the instance where one might have ammo that is available for two or more weapons. In modern terms I had a 9mm pistol and an 9mm SMG as personal weapons in tanks with the 9mm ammo available for both weapons. I don't think the character sheets in roll20 support any kind of relational database engine though. I could easily write something in MS Access's JET native engine (retired no longer have access to an Oracle server), but of course, there'd be no connection between that and the Roll20 icons. :-) Though maybe alt-tabbing back and forth...