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

Attribute within attribute help?

 <select id="equipped" name="attr_equipped" width="30px">                         <option value="0" selected>Slot 1</option>                         <option value="1">Slot 2</span></option>                         <option value="2">Slot 3</span></option> </select> I know the equipped attribute definitely reflects whatever is selected since I have a span that displays it to test, but I can't seem to use it for: @{inv_@{equipped}} It displays the following error:  TypeError: Cannot read property 'substring' of undefined  and  No attribute was found
1591092763
Andreas J.
Forum Champion
Sheet Author
Translator
"Attributes within attributes" is not a thing. And you cannot use IDs in creating the character sheets either. You cleanly need to take a new look at the <a href="https://wiki.roll20.net/Building_Character_Sheets" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets</a> article to see how things are structured, and to avoid assuming features that doesn't exist. <a href="https://wiki.roll20.net/Building_Character_Sheets#Dropdown_menu" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets#Dropdown_menu</a> shows how selects work in Roll20.
Actually, I was able to get what I needed to be done. Followed this post:&nbsp; <a href="https://app.roll20.net/forum/post/4472760/attribute-within-attribute-for-macro-call/?pageforid=4472825" rel="nofollow">https://app.roll20.net/forum/post/4472760/attribute-within-attribute-for-macro-call/?pageforid=4472825</a> Created a 'prefix' and just used that instead of explicitly typing @{
1591101617
Andreas J.
Forum Champion
Sheet Author
Translator
Wow, I've never seen this before, nor heard any of the other experienced sheet author mention anything similar. Well, one more thing to document I guess.
1591106095

Edited 1591106122
GiGs
Pro
Sheet Author
API Scripter
Funnily enough i was planning to write up a tip on this today, I used it last night in another tip posted to the Stupid Tricks thread here . It's nice to see a link to a really old thread - maybe that explains it well. Its a very very old trick that generally isnt needed any more - there is usually an alternative. The fact you need to dedicate two attributes to it (for every usage of it) makes it very clunky, and its only really useful to sheet designers with specific needs. Its too clunky for non-Pro users to use generally, and Pro users have scripts that negate the need for it.
1591110531
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Without looking too deeply into this, are you talking about something similar to this trick? Prefix Trick to Variably Call Attributes &nbsp;- Kyle G.
1591111908
GiGs
Pro
Sheet Author
API Scripter
Ah so it does exist already. Yes, that's the trick. It was fairly well known back in the day before character sheets existed, but is largely obsolete now.&nbsp;
1591114506
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yeah, I've never found a use case for it in my workflow.
1591116333
Kraynic
Pro
Sheet Author
I will probably be using it in a sheet I am working on to toggle combat related roll button macros between 2 different combat skills on the sheet. Or at least that is my current plan.
1591126913
GiGs
Pro
Sheet Author
API Scripter
The reaosn i use it on the Torg Eternity sheet is because I am getting information from the turn tracker. But to do that, I need ti know the token name - the command is @{tracker|TOKEN_NAME} But you cant know what a token is named when the sheet is designed. Players and GMs might rename tokens. The prefix trick lets me have an attribute named trackerprefix: @{tracker| Then the attribute that uses that @{trackerprefix}@{selected|token_name}} Which creates the desired attribute, even if the token name changes. (Take note of the extra } at the end there - ending the attribute call started in trackerprefix. One of the original creators of the Torg Eternity sheet created this trick. Like the example in the stupid tricks thread, it's only useful for systems which arent using the turn tracker already. This only works in sheets because the joining of attributes is occurring early enough in roll20's order of operations. You cant use it in macros, because thats too late.