Hi, With Michael's help, I've been able to correct some mistakes I made. I actually corrected all the $ and & mistakes and it seems to work pretty well now. !script {{ --/|Demande quel JP, quel DD, quels degats, quel effet sauvegarde, quel type dégats --&saveType|?{Quel JP?|Dexterité,dex|Constitution,con|Sagesse,wis} --=DC|?{DD ?|15} --=Damage|?{Dégats} --&DCeffect|?{Effet Sauvegarde ?|Annule,annule|Demi dégats,demi} --&damageType|?{Quel type de Dégats ?|Acide,acid|Contondant,bludgeoning|Feu,fire|Force,force|Foudre,lightning|Froid,cold|Nécrotique,necrotic|Perforant,piercing|Poison,poison|Psychique,psychic|Radiant,radiant|Tonnerre,thunder|Tranchant,slashing} --/|Get all of the tokens on the page so we can cache their positions --~|array;pagetokens;alltokens;@{selected|token_id} --#leftsub|DD [$DC] --#rightsub|Dégats: [$Damage] --#title|JP de Groupe --#titleCardBackground|#03038a --#oddRowBackground|#d8d8e6 --#evenRowBackground|#FFFFFF --#whisper|gm --/|Calculate damage --=HalfDamage|[$Damage.Total] \ 2 --=DoubleDamage|[$Damage.Total] * 2 --=QuarterDamage|[$Damage.Total] \ 4 --/|Since we want to be able to hover over a roll and see the dice details, output the rolled damage at the --/|top of the card. If all critters make their save, the half damage roll won't contain the details. --+|[c][b]Damage Roll: [/b][$Damage][/c] --+| --/|Create an array with the selected token --~tokenid|array;selectedtokens;Selected --/|The first item in the array will be a blank dummy item, so remove it. --~|array;removeat;selected;0 --/|Loop through the tokensHit tokens and roll saves for each one and apply damage --~tokenid|array;getfirst;Selected --?[&tokenid] -eq ArrayError|endOutput --:loopDisplay| --=SaveRoll|1d20 + [*[&tokenid]:npc_[&saveType]_save] --/|Compare the save roll to the save DC and either apply full or half damage --?"[*[&tokenid]:npc_immunities]" -inc "[&damageType]"|Immune --?"[*[&tokenid]:npc_resistances]" -inc "[&damageType]"|Resistant --?"[*[&tokenid]:npc_vulnerabilities]" -inc "[&damageType]"|Vulnerable --?[$SaveRoll.Total] -lt [$DC]|>ApplyDamageTokenmod;[&tokenid];1;-[$Damage.Total]|>ApplyDamageTokenmod;[&tokenid];1;-[$HalfDamage.Total] --?[$SaveRoll.Total] -ge [$DC]|madeSave --/|Here are various damage applications if the creature is immune, resistant, or vulnerable. In some cases, we will reuse output lines, --/|for example, a resistant creature that fails its save will jump to "madeSave", since that is the correct damage amount. (half), while --/|a vulnerable creature that makes its save will jump to "FailedSave" since that will be normal damage. --/|Output a line for a failed saving throw (we will also jump here for a vulnerable creature that MAKES its save) --:FailedSave| --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$Damage] [&damageType][/r] --^afterSave| --:Immune| --+[*[&tokenid]:t-name]:|n'est pas affecté par le sort ! --^afterSave| --:Resistant| --?[$SaveRoll.Total] -lt [$DC]|>ApplyDamageTokenmod;[&tokenid];1;-[$HalfDamage.Total]|>ApplyDamageTokenmod;[&tokenid];1;-[$QuarterDamage.Total] --?[$SaveRoll.Total] -lt [$DC]|madeSave --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$QuarterDamage] [&damageType][/r] --^afterSave| --:Vulnerable| --?[$SaveRoll.Total] -lt [$DC]|>ApplyDamageTokenmod;[&tokenid];1;-[$DoubleDamage.Total]|>ApplyDamageTokenmod;[&tokenid];1;-[$Damage.Total] --?[$SaveRoll.Total] -ge [$DC]|FailedSave --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$DoubleDamage] [&damageType][/r] --^afterSave| --/|Output a line for a successful saving throw --:madeSave| --+[*[&tokenid]:t-name]:|Save [$SaveRoll] [r][$HalfDamage] [&damageType][/r] --:afterSave| --~tokenid|array;getnext;Selected --?[&tokenid] -ne ArrayError|loopDisplay --:endOutput| --X| --:ApplyDamageTokenmod|Parameters are tokenid;bar#;amount --@token-mod|_ignore-selected _ids [%1%] _set bar[%2%]_value|[%3%] --<| }} Now i have 2-3 last issues in what i try to achieve. First : For DCeffect, when i choose "annule" i'd like to have the script jump to the immune save test part. For example, some cantrips can affect several creatures, but there are no effect if they make the save. I should put a conditional : maybe something like --?"[*[&DCeffect]] -inc "annule" -and [$SaveRoll.Total] -ge [$DC]|Immune Would that be correct ? And should i put this in the list of rolls comparisons ? or somewhere else ? Second : I'd like to put a button so the damages are rolled only if i press this button, and not automatically as it is for the moment. How to write this button command ?and do i have to put it instead of every >applydamagetokenmod commands ? or only once just before the tokenmod command ? Third (but that's just a little cherry on the big cake) : I have a little tokenmod macro that puts the deadmarker and switch the token to the maplayer when one of my monsters dies (that is helpful when i have a lot of monsters, because it puts them "toback" and prevents me to select them by mistake. How easy would it be to say that : --?"[*[&tokenid]:bar1] -lt 1|>applytokenmarkerandmoveitonmaplayer Would that work ? There's no "or else" in that line...don't know if it needs one or not, and i think i should probably put some parameters in that subroutine call Where would that subroutine be placed in the script ? Would the script remember whose token we're talking about ? It seems pretty easy but maybe it's not that easy at all.... Thanks for your help.