Code: Select all
[h: featNameList = "Anatomist, ArcaneStrike"]
[h: anatomistFeat = 1]
[h: arcaneStrikeFeat = 0]
[FOREACH (featName, featNameList), CODE:
{
[featName+"Selection" = if (eval(featName+"Feat") > 0, 1, 0)]
}
]
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Code: Select all
[h: featNameList = "Anatomist, ArcaneStrike"]
[h: anatomistFeat = 1]
[h: arcaneStrikeFeat = 0]
[FOREACH (featName, featNameList), CODE:
{
[featName+"Selection" = if (eval(featName+"Feat") > 0, 1, 0)]
}
]
Code: Select all
[set(featName+"Selection", if (eval(featName+"Feat") > 0, 1, 0))]
Code: Select all
[h: AnatomistFeat = 3]
[h: ArcaneStrikeFeat = 0]
[h: featNameList = "Anatomist, ArcaneStrike"]
[h: anatomistFeat = 1]
[h: arcaneStrikeFeat = 0]
[h,FOREACH (featName, featNameList), CODE:
{
[val = if (eval(featName+"Feat") > 0, 1, 0)]
[var = featName+"Selection"]
[assignment = var + "=" + val]
[eval(assignment)]
}
]
[AnatomistSelection]
[ArcaneStrikeSelection]
Fortunately, that isn't the problem.wolph42 wrote:Capital letters vs non capital, might be an issue
I was able to get it working with set though.you need to use Wiki: set()
That's good information to know... Getting it to work is one thing... knowing why it didn't work the way I was trying is another.Craig wrote:What ever appears to the left of the equals sign can't be an expression, it has to be a variable/property name.
And this looks better than the way I got it working!As Wolph mentioned you can use set to get around thisCode: Select all
[set(featName+"Selection", if (eval(featName+"Feat") > 0, 1, 0))]
Code: Select all
[h: feats = json.set("", "Anatomist", 1, "ArcaneStrike", 0)]
[h: fields = json.fields(feats)]
[h, FOREACH (field, fields), CODE:
{
[set(field+"Selection", json.get(feats, field))]
}
]
[r: AnatomistSelection], [r: ArcaneStrikeSelection]