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

Smart AOE API how to use an repeating resources?

Hey, im trying to use the repeating resource attribute as a resources for the --resource| flag in a smart aoe and it throws the following message: Any ideas on what the correct syntax would be, here is the code im working with rn !smartaoe {{   --title|Gem 1   --titlecardbackground|linear-gradient(green, yellow)   --leftsub|dc 16 dex save vs   --rightsub|3d12 acid damage     --dc|[[16]]   --saveFormula|5eDEX   --damageformula1|[[3d12]]   --damageType1|Acid   --bar|3   --zerohpmarker|dead   --resistAttr|npc_resistances   --vulnerableAttr|npc_vulnerabilities   --immunityAttr|npc_immunities   --resource|repeating_resource_$0_resource_left,1   --aoeType|line   --radius|60ft }}
1705792905
David M.
Pro
API Scripter
I can confirm that this won't work with the current code, even though that resource name is properly constructed. I'm looking into seeing if I can modify the script to handle repeating resources, but I'm currently having trouble deciphering how they are structured in relation to standard attributes from the api side.
1706620610
timmaugh
Pro
API Scripter
If it works with attribute names, you can use the direct attribute name of the repeating attribute... and you can get it with Fetch. What I mean is that every attribute, even repeating attributes, has a simple handle of @{character|attribute_name}. The name just gets more complicated with repeating attributes because you have a rowID in there: @{character|repeating_list_-M1234567890abcdef_attributeName} Then that gets more complicated by the fact that the chat input lets you use $0 shortcuts to reference the order on the sheet: @{character|repeating_list_$0_attributeName} But Fetch can do a lot of lifting for you right in line with your AoE command line. As a metascript, Fetch can go gather information and update the message before AoE takes ownership. So if AoE *will* work with: --resource|repeating_resource_-M1234567890abcdef_resource_left,1 ...but it won't work with: --resource|repeating_resource_$0_resource_left,1 ..., but you really want/need to use the $0 form because it agnosticizes the code... or it's just easier... or your repeating list might change order and you don't want to hard code to the one single attribute name... Fetch can bridge that gap. With Fetch, you can return the id, the name, the rowid, the row$, or the name$ of any attribute by appending that to the Fetch construction within the parentheses. As an example, for an entry on a list called "spell-1", the "spell_ability" sub-attributre has a value of "spell". I can return all of the following information about that entry: !&{template:default}{{name=Fetch Repeating Returns}}{{ Base/Current=*(selected.spell-1.$0.spell_ability)}}{{ id=*(selected.spell-1.$0.spell_ability.id)}}{{ name=*(selected.spell-1.$0.spell_ability.name)}}{{ rowid=*(selected.spell-1.$0.spell_ability.rowid)}}{{ row$=*(selected.spell-1.$0.spell_ability.row$)}}{{ name$=*(selected.spell-1.$0.spell_ability.name$)}}{&simple} (Note the above example uses Fetch and ZeroFrame.) So, again, if AoE will work with: --resource|repeating_resource_-M1234567890abcdef_resource_left,1 ...but you want to use $0 notation, substitute in the Fetch construction, instead, and have it return that information: --resource|*(Character Name.resource.$0.resource_left.name),1
1706628540
timmaugh
Pro
API Scripter
Should have pointed out: both Fetch and ZeroFrame are part of the MetaScriptToolbox (available in the one-click).