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

[D&D5E] Need some help setting up value reading for an attribute

I'm making attributes that incorporate Warlocks Hex Curse (both the Hex Spell and the Hexblade Curse ), and have it working for the most part This is how I have that set up so far: Attribute    Value    |    Value_Max prefix       @{ Hex         1 HexD         @{prefix}@{character_name}|HexD@{Hex}}    |    @{prefix}@{character_name}|HexD@{Hex}|max} HexD0 HexD1        + [[1d6]]                                 |    + [[[[1d6]]*2]] HexT         @{prefix}@{character_name}|HexT@{Hex}} HexT0 HexT1        , Necrotic HexC         @{prefix}@{character_name}|HexC@{Hex}} HexC0        20 HexC1        19 (Similar Attributes for Hexblade Curse) Alongside these attributes, I have my weapons function via macros that incorporate this, ie "@{HexD}" in the Damage Field, "@{HexT}" in the dmgtype field, and "@{HexC}" in the hit roll itself to determine whether or not a crit is 19 or 20 (Meant for Hexblades Curse) How I have it set up is that each of them rely on the "@{Hex}" Attribute being 1 to work, and 0 if not active. The thing I want from this is, instead of "hex" being 1 or 0, I want it to read a value from my Cores resource tabs, ie "@{repeating_resource_$4_repeating_right}" instead, so that should said row index be changed, I only have to edit "@{Hex}" and not HexD-C. The issue with this is, it fails to work when I set it to that value, I assume because it doesn't expand before the whole thing is read. (I'm not sure). Is there a way around this at all that would allow me to put in the resource value in @{Hex} and have it function as I would like? Edit: Primary reason for having it read through a resource is so that I can toggle it on and off with ease if I'm battling multiple enemies that aren't cursed
To use an attribute inside of "Hex" you need to defer the resolution of the prefix trick until "Hex" has a chance to fully resolve. You can do this by using the prefix trick on the prefix attribute. So instead of @{prefix}@{character_name}| you can use @{prefix}@{character_name}|prefix}@{character_name}| Alternatively you can reference the resource directly but use it's ID instead of it's row index. It's ID doesn't change unlike it's row index. See Referencing Repeating Attributes for details.
RainbowEncoder said: To use an attribute inside of "Hex" you need to defer the resolution of the prefix trick until "Hex" has a chance to fully resolve. You can do this by using the prefix trick on the prefix attribute.  you can use @{prefix}@{character_name}|prefix}@{character_name}| Or I think a slightly cleaner version is just to defer the @{prefix} recursively: @{prefix}prefix}@{character_name}| If the final output of '@{JOHNDOE|HexD1}' is '+ [[1d6]]' then you can work backwards if 'Hex' is set as '@{repeating_resource_$4_repeating_right}': @{prefix}prefix}@{character_name}|HexD@{Hex}} Once you have your final construction you can test it by doing replacements of each attribute from left to right (valid attributes are bolded): @{prefix} prefix} @{character_name} |HexD @{Hex} }  @{prefix} CHARACTERNAME|HexD @{repeating_resource_$4_repeating_right} } @{CHARACTERNAME|HexD1}   + [[1d6]]  You can compare what happens if you don't add the extra recursive '@{prefix' to the front: @{prefix} @{character_name}|HexD @{Hex} }  @{CHARACTERNAME|HexD@{repeating_resource_$4_repeating_right}} There is no attribute named 'HexD@{repeating_resource_$4_repeating_right}' on the character, so it fails. FYI in my Macromule , I use both '@' and '%' prefixes, so I've found it's easier to read/parse using a single character '@' in an attribute named 'at'. Your block would now look like this: Attribute    Value     |    Value_Max at        @ Hex         @{repeating_resource_$4_repeating_right} HexD         @{at}{at}{@{character_name}|HexD@{Hex}}   |    @{at}{at}{@{character_name}|HexD@{Hex}|max} HexD0 HexD1        + [[1d6]]                                 |    + [[[[1d6]]*2]] HexT         @{at}{at}{@{character_name}|HexT@{Hex}} HexT0 HexT1        , Necrotic HexC         @{at}{at}{@{character_name}|HexC@{Hex}} HexC0        20 HexC1        19
Jarren said: RainbowEncoder said: To use an attribute inside of "Hex" you need to defer the resolution of the prefix trick until "Hex" has a chance to fully resolve. You can do this by using the prefix trick on the prefix attribute.  you can use @{prefix}@{character_name}|prefix}@{character_name}| Or I think a slightly cleaner version is just to defer the @{prefix} recursively: @{prefix}prefix}@{character_name}| That doesn't actually work; when you construct an attribute using the prefix trick it doesn't correctly link to the character sheet it's being called from. So the second prefix would error out since it's not linked to a character. This is why @{character_name} has to be specified in the first place. You are correct in that you can specify it recursively and is in fact my preferred method. What I do is have an attribute called "defer" with a value of @{THE_ACTUAL_CHARNAME|defer and a max value of @{THE_ACTUAL_CHARNAME| At which point I can use the following @{defer|max}           #Equivalent to @{prefix}@{character_name}| @{defer}|max}          #Note the } between defer and |max                        #Equivalent to @{prefix}@{character_name}|prefix}@{character_name}| With that I can add in extra } in the middle to defer even further as required. You do end up with a lot of unmatched braces though; but that cannot be avoided without also specifying the character name every time.
@{defer|max}           #Equivalent to @{prefix}@{character_name}| @{defer}|max}          #Note the } between defer and |max                        #Equivalent to @{prefix}@{character_name}|prefix}@{character_name}| This is impressive, but I am struggling to wrap my head around how it works So you have "defer" be "@{playername|defer" | "@{playername|", so then @{defer|max} = "@{playername|", and @{defer} = "@{playername|defer", therefore @{defer}|max} = "@{playername|defer|max}", but wouldn't that just return the same thing as "@{defer|max}", just written out with the players name at first? How does it work? I tested it, and it works, but how?
.█████╗ ██╔══██╗ said: So you have "defer" be "@{playername|defer" | "@{playername|", so then @{defer|max} = "@{playername|", and @{defer} = "@{playername|defer", therefore @{defer}|max} = "@{playername|defer|max}", but wouldn't that just return the same thing as "@{defer|max}", just written out with the players name at first? How does it work? I tested it, and it works, but how? It does return the same thing, but it returns it later. The purpose isn't to do something different but to do that same thing later. In this case after @{Hex} has had a chance to resolve the resource attribute it references.
I see. Why is it that one uses the actual character name and not just @{character_name}? Does it undo/ruin the timing differences?
If you tried to use "@{@{character_name}|" it would search for an attribute "@{character_name" which won't exist. It can work if you used "@{prefix}@{character_name}|" but that takes an additional resolution pass to function. That delay isn't really a problem per se but when you start going deep into prefix trick shenanigans having to factor in that it takes twice the number of passes is an unnecessary complication. Also there is a maximum of 100 resolution passes. While that is more than enough for typical usage losing half of those needlessly when you're doing more advanced techniques can be problematic.
Ah, I see. So it's moreso better to use the actual name instead. I would think about portability, but in fairness you can't really port attributes to other sheets automatically my knowledge, and even then it'd only be a single attribute that would need change per sheet I suppose. Also, will Defer sort of replace Prefix? Or is Prefix still a necessary attribute for doing tricks?
Prefix can still be used if you want to reference other characters but if you only reference your own character it would no longer be required. Strictly speaking Defer could be altered to be a full replacement for Prefix but it would be less convenient.
RainbowEncoder said: That doesn't actually work; when you construct an attribute using the prefix trick it doesn't correctly link to the character sheet it's being called from. So the second prefix would error out since it's not linked to a character. This is why @{character_name} has to be specified in the first place. You are correct in that you can specify it recursively and is in fact my preferred method. Ugh that's right.  I figured that out when I was creating my Macromule, but I think I forgot because I used 'MM' as the character name and after a while  because it was so short   I forgot that it was the name and not part of the reference!
Say, might a way exist to also delay certain outputs of attributes that make use of API Scripts? I'm asking since one I'm using does not do well being called more than twice at the same time, and will often void the remaining ones. An example being via the !ammo script, say I want to set multiple "ammos" to 0 and one to 1, it doesn't like doing all of them at once, so i have to separately change them instead. Asking a bit vaguely since Idk if it's good practice to ask a new question in here or if I should make a new post about it, or if I should do it in the Macro forum or the API one
1714759525
timmaugh
Pro
API Scripter
.█████╗ ██╔══██╗ said: Say, might a way exist to also delay certain outputs of attributes that make use of API Scripts? I'm asking since one I'm using does not do well being called more than twice at the same time, and will often void the remaining ones. An example being via the !ammo script, say I want to set multiple "ammos" to 0 and one to 1, it doesn't like doing all of them at once, so i have to separately change them instead. Asking a bit vaguely since Idk if it's good practice to ask a new question in here or if I should make a new post about it, or if I should do it in the Macro forum or the API one The Metascript Toolbox offers different tools to help accomplish this, as might other scripts. I think the best idea would be to start a new thread in the Mods forum, so that more users take note of the question and maybe offer solutions. I would add specific examples of what you're trying to do (the command lines), and how you go about running them, now.