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

Can you reference a repeating item by number using a drop down query?

1528294292
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
For example, I can reference an item's name in a list by using: @{selected|repeating_items_$1_itembonus} Every attempt I have made to replace the "$1" using a drop down query has failed however. I have tried numerous variaitons of html entity replacements, brackets, etc., but seem unable to make this work. Anyone have a clue?
1528295266
The Aaron
Pro
API Scripter
Probably won't work because of the Order of Operations:&nbsp; <a href="https://wiki.roll20.net/Dice_Reference#Order_of_Op" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Order_of_Op</a>... Attributes are expanded first, Roll Queries don't get expanded until step 4.&nbsp; You could try putting the roll query in an inline roll and see if that lets it work, but I doubt it will.
1528295824
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah, that was one of the iterations I tried (unsuccessfully.) My idea was to develop a macro that would let you select a token, and write a piece of equipment to a target token using ChatSetAttr. ("Here's your ring back, Mister Frodo").
1528296316

Edited 1528296351
Ziechael
Forum Champion
Sheet Author
API Scripter
I've tried a number of ideas, including inline, prefix/suffix attributes and other such witch-craft to no success... your best bet would be to nest the whole row attribute in the query like I do for ammo selection in my powercard for use in my custom 3.5e sheet (you'd just replace the output with the desired field): ?{Ammo Type?|@{selected|repeating_ammunition_$0_ammoname},0|@{selected|repeating_ammunition_$1_ammoname},1|@{selected|repeating_ammunition_$2_ammoname},2|@{selected|repeating_ammunition_$3_ammoname},3|@{selected|repeating_ammunition_$4_ammoname},4|@{selected|repeating_ammunition_$5_ammoname},5|@{selected|repeating_ammunition_$6_ammoname},6}
1528298809
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hm, probably not a workable solution. The repeating field has five attributes, and so does the target field (of course). It's probably just easier to do it the old fashioned way.
1528298924
The Aaron
Pro
API Scripter
Would it be easy as a Custom API script?
1528301927
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
For some to whom custom API scripts are easy, maybe. :) Ultimately, such a script would have amazing utility, especially if it were able to capture and transfer all attributes from a repeating field, regardless of sheet. PMing you.
1528336374
vÍnce
Pro
Sheet Author
keithcurtis said: Yeah, that was one of the iterations I tried (unsuccessfully.) My idea was to develop a macro that would let you select a token, and write a piece of equipment to a target token using ChatSetAttr. ("Here's your ring back, Mister Frodo"). If I understand what you are trying to do, I think I've done this using ChatSetAttr before;&nbsp;&nbsp; <a href="https://app.roll20.net/forum/permalink/4261359/" rel="nofollow">https://app.roll20.net/forum/permalink/4261359/</a>
1528378902
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If I read your code correctly, that allows you to create a repeating item? I've done that for several macros. I was looking for a way to reference an existing item on the fly by list position and using that referenced data to write the new item to a different character. Apparently this is not possible. However, I am liking the method that The Aaron suggested&nbsp; here . It's probably a better method anyway, since it keeps non-essential data off the sheet and can't be accidentally claimed by more than one party member.