Sorry, it took me a while to get back to you - here's what I have on my sheet, this is for the description field of the attack:
}} {{r1=[[@{d20}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} @{rtype}cs>20 + @{strength_mod}[STR] + @{pb}[PROF] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER] ]]}} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{mod=[[@{pb} + @{strength_mod} + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]] ]]}} {{rname=[@{repeating_attack_$0_atkname}](` %{@{character_name}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} "style=" display:inline-block; background-color:#e8e8e8; border: 1px solid black; border-radius: 5px; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)}} {{rnamec=[@{repeating_attack_$0_atkname}](` %{@{character_name}|defender-damage} {{dmg1=[[@{repeating_attack_$0_dmgbase} + @{strength_mod}[STR] + [[3-?{Defender setting?|3,0|2,1|1,2|0,3}]][DEFENDER]]]}} {{crit=1}} {{globaldamagecrit=[[@{global_damage_mod_crit}]]}} "style=" display:inline-block; background-color:#e8e8e8; border: 1px solid black; border-radius: 5px; background-color:#e8e8e8; color: black; text-align: center; font-weight: bold; padding: 2px; margin-bottom: 3px)}} {{globalattack=@{global_attack_mod}}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagecrit=[[@{global_damage_mod_crit}]]}} {{charname=@{character_name}}}
!setattr {{
--name charactername
--nocreate
--silent
--repeating_acmod_$0_global_ac_val|?{Defender setting?|3,0|2,1|1,2|0,3}
This is assuming the Defender is in the first place in the attack list.
You also need to have a global ac modifier active, with the first AC modifier being the one changed by the script.
Then, this saved as an ability on the same sheet, on the attributes & abilities tab, under the name
defender-damage
&{template:dmg} {{damage=1}} {{dmg1flag=1}} {{dmg1type=@{repeating_attack_$0_dmgtype}}} {{crit1=[[@{repeating_attack_$0_dmgbase}]]}} {{desc=}} {{globaldamage=[[@{global_damage_mod_roll}]]}} {{globaldamagetype=@{global_damage_mod_type}}}
That should be all that's needed - but if the script part of it doesn't work, I can't help you there, you'll have to ask someone else, as I have no way of testing that myself without a pro subscription.