
I'm trying to make a macro script using ScriptCards to automatically reduce durability for each item with a 10% chance when activated. The attributes are: attr_ChestDurability attr_BeltDurability attr_LegsDurability attr_BootsDurability attr_Add1Durability attr_Add2Durability attr_Trinq1Durability attr_Trinq2Durability attr_Trinq3Durability attr_Trinq4Durability attr_ShieldDurability attr_weaponDurability2 attr_weaponDurability The goal seems simple: check if the durability is greater than 0, and if so, apply a 10% chance (1d100 > 90) to reduce it by 1d10. I'm trying to use !ammo , but nothing seems to work properly. Here's an example of my code: !script {{ --#title|Durability Damage --#titleCardBackground|#8a00c2 --#evenRowBackground|#e8bcf0 --#oddRowBackground|#000000 --&token_id|@{selected|token_id} --&character|@{selected|character_id} --/ List of durability attributes --&durabilityAttrs|attr_ChestDurability,attr_BeltDurability,attr_LegsDurability,attr_BootsDurability,attr_Add1Durability,attr_Add2Durability,attr_Trinq1Durability,attr_Trinq2Durability,attr_Trinq3Durability,attr_Trinq4Durability,attr_ShieldDurability,attr_weaponDurability2,attr_weaponDurability --~|split;[&durabilityAttrs];, --~attrs|array;get;split --FOR|attr|attrs|BEGIN --=current|[*[&character]:[&attr]] --?[$current.Total] -gt 0|[ --=roll|1d100 --+Checking|[b][&attr][/b]: Current = [$current.Total] | Roll = [$roll.Total] --?[$roll.Total] -gt 90|[ --=damage|1d10 --=newVal|[$current.Total] - [$damage.Total] --?[$newVal.Total] -lt 0|[ --!a:[&character]|[&attr]:0 --+Result|[c]#ff0000]DESTROYED![/c] (Lost: [$damage.Total]) --@alter|_target|[&token_id] _bar|2 _amount|-10 ]|[ --!a:[&character]|[&attr]:[$newVal.Total] --+Result|Damage: -[$damage.Total] | Remaining: [$newVal.Total] ] ]|[ --+Result|✅ No damage (Roll <= 90) ] ]|[ --+Result|☠️ [c]#ff0000][&attr] is already broken![/c] ] --FOR|END }} Can someone help? I'm going crazy here... I’ve never studied Java and I’m just trying to figure this out intuitively.