My one rhetorical question is why are you making it harder than it should be. Use macros and use a lib token. If your goal is to have a complex set of abilities that can be dropped in to any campaign without GM intervention, then good luck to you. But I think we've answered the original question "Retrieving individual variables from a list of nested arrays". Perhaps the lingo is a barrier to us where a word you're saying isn't what we're interpreting. Variable, a property that stores a value. Array, a list of values. Nested arrays, arrays whose values are arrays. So, if I want to retrieve a value from a nested array, I need its location in the nested structure. Doing everything with in the token type properties.
number one, to retrieve variables in a format clear of any mathematical notation
There many methods of retrieving a variable.
Wiki: getProperty() is the most common method. I'm not sure what you mean by "clear of any mathematical notation. That's just a value. Even a string that looks like a formula is just a string until you do something with it.
, so that they can be used in mathematical formulae in a different property field, which will govern the variables and how they react in macros.
This is really not clear to me. But you have a formula in a property that references the other property above. This is very common, for example:
Token Properties:
Code: Select all
*Strength (STR): 15
StrB:[R: floor((Strength-10)/2)]
But what I'm getting from your previous posts is that you have a lot of variables to define and don't want to create a property for each, but still need to access the values. Access where, in other properties? Here's a stab in the dark at what I think you're talking about.
Token Properties:
Code: Select all
stats:Strength=10;Dexterity=10;Constitution=10;Intelligence=12;Wisdom=10;Charisma=10;
*bonuses:[H: varsFromStrProp(stats)][R: "StrB "+floor((Strength-10)/2)+", DexB "+floor((Dexterity-10)/2)+", ConB "+floor((Constitution-10)/2)+", IntB "+floor((Intelligence-10)/2)+", WisB "+floor((Wisdom-10)/2)+", ChaB "+floor((Charisma-10)/2)]
This just uses the data in stats, defines them in bonuses for use in setting the value of that property. bonuses is just text that lists what the bonuses are, but if I wanted to set those values in an array, then I would do this:
Code: Select all
stats:Strength=10;Dexterity=10;Constitution=10;Intelligence=12;Wisdom=10;Charisma=10;
bonuses:[H: varsFromStrProp(stats)][R: json.toStrProp(json.set("{}","StrB",floor((Strength-10)/2),"DexB",floor((Dexterity-10)/2),"ConB",floor((Constitution-10)/2)"IntB",floor((Intelligence-10)/2)"WisB",floor((Wisdom-10)/2)"ChaB",floor((Charisma-10)/2)))]
This creates a whole new set of variables based on the property above. But, there is one major problem. It doesn't calculate the variables unless you put * in front and then mouse over token. Then with more complicated formulas, you'll have to have varsFromStrProp all the data sets on that one line and it's really REALLY easy to cause some error popups that seems to be infinite. Putting all this junk on a token instead of in the properties is the way to go.