tl;dr at end
Here Is my complete code that I've written.
Code: Select all
<!-- Request preliminary Info-->
[h: Save_Type = input(
"saveType|Strength, Dexterity, Constitution, Intelligence, Wisdom, Charisma,|Save Type|LIST|VALUE=STRING",
"saveDC|0|Spell DC",
"advantage||Advantage?|CHECK",
"damage||Will it Damage?|CHECK",
"effects||Are there Aditional Effects?|CHECK"
)]
[h:abort(Save_Type)]
<!-- Begin displaying info given (only some parts)-->
DC [r:saveDC] [r:saveType] |
<!-- Damage inputs -->
[h:Damage_Input = 0]
[if(damage==1),CODE:{
[h:Damage_Input = input(
"dmg|0|Input Rolled Damage",
"vunerable||Vulnerable to Damage Type?|CHECK",
"half||Half on Fail?|CHECK"
)]
[h:abort(Damage_Input)]
}]
<!--Damage Calculation per selected -->
[h:Damage = 0]
[h: ids = getSelected()]
[save = saveType + "ST"]
[FOREACH(id,ids), CODE:{
[saveroll=d20+getProperty(save,id)]
[if(saveroll>=saveDC),CODE:
{
<!--Passes-->
[if(half==1),CODE:
{
[h:Damage = floor(dmg/2)]
};
{
[h:Damage = 0]
}
]
[if(vunerable==1),CODE:
{
[h:Damage = Damage*2]
};
{
}
]
};
{
<!-- Fails-->
[h:Damage = dmg]
[if(vunerable==1),CODE:
{
[h:Damage = Damage*2]
};
{
}
]
}
]
}]
<!--DEBUG: Display damage -->
[Damage]
For the most part it all works, in-fact the Damage Calculation per selected works perfectly, without the addition of the foreach (and of course modifying it slightly to work without it).
However once I add the foreach it suddenly stops working. Can someone please help?
As a side note it shouldn't be any ] or } that are missing, since I've counted, multiple... multiple.... times.
TL;DR
Code no work when I add FOREACH function. Help please.