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 I query within an Attribute name

I can't seem to get this to work. I'm trying to get, say the name of a repeating action, but I don't want a button for 1, 2, 3, 4, etc. so here, I put the query in a template, but neither of these methods seem to work correctly. ! ?{ActionNumber} /w gm &{template:npcaction} {{rname=@{target|target|repeating_npcaction_$ ?{ActionNumber} _name}}} {{name=@{target|character_name}}} {{description=**To Hit:** @{target|target|repeating_npcaction_$0_attack_tohitrange} **Damage:** @{target|target|repeating_npcaction_$ ?{ActionNumber} _attack_onhit} **Description:** @{target|target|repeating_npcaction_$ ?{ActionNumber} _description} }} Or here replacing the curly braces with html ! ?{ActionNumber} /w gm &{template:npcaction} {{rname=@{target|target|repeating_npcaction_$ ?{ActionNumber} _name } }} {{name=@{target|character_name}}} {{description=**To Hit:** @{target|target|repeating_npcaction_$0_attack_tohitrange} **Damage:** @{target|target|repeating_npcaction_$ ?{ActionNumber } _attack_onhit} **Description:** @{target|target|repeating_npcaction_$ ?{ActionNumber } _description} }}
I'm guessing not, as even this doesn't work /w gm @{target|target|repeating_npcaction_$?{ActionNumber}_name} or /w gm @{target|target|repeating_npcaction_$?{ActionNumber}_name}
1533837819
The Aaron
Pro
API Scripter
You're correct, this won't work.&nbsp; The reason is the Order of Operations: <a href="https://wiki.roll20.net/Dice_Reference#Order_of_Operations" rel="nofollow">https://wiki.roll20.net/Dice_Reference#Order_of_Operations</a> Variable substitution (Attributes) happens at step 3, Roll Queries are at step 4.&nbsp; That means it looks for an attribute named "repeating_npcaction_$?{ActionNumber}_name" and fails to find it, then does the query for an ActionNumber.
Alright, so how about, is there the ability to better gracefully handle missing attributes? I've tried using &amp;{noerror} in a Roll Template, but I'm still getting the error messages that at some level of repeating value that it doesn't exists. Like would there be a way to just output blank as opposed to the message that it doesn't exist?
1534175633
The Aaron
Pro
API Scripter
Not really.&nbsp; My views are probably skewed but this seems like it would be easier to handle with an API script.