Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

API/Script/Macro to add an ability on a player's D&D sheet as a GM

1707555035

Edited 1707555086
Hello, It's pretty much in the title. I'm looking for an API/Script/Macro that would allow the GM (me) to add an ability to a player's character sheet (or to several of them) in the midst of a game, ideally with the simple push of a button. It's for the Roll20 basic D&D sheet, if it matters, and so it would go in the column called "Features and traits". Is there such a thing ? I've been searching, but I didn't find it. I'm no programmer of any kind, so I apologize for the " API/Script/Macro", I have trouble distinguishing one from the other. Best regards,  Montecristo
1707565215
Andrew R.
Pro
Sheet Author
I think ScriptCards can add to repeating sections these days, so have a look at it. 
ScriptCards  can create new repeating attributes on character sheets. This is a quick example that will prompt for a trait name and trait description and create the trait on the PC version of the D&D 5e by Roll20 sheet. !scriptcard {{ --/|ScriptCard to prompt the GM for a new custom trait on the D&D 5e by Roll20 Sheet --/|Must have a token selected --/|VARIABLES TO SET --&source|Other --&sourceType|GM Script --#whisper|gm --#title|Custom Trait Creator --#sourceToken|@{selected|token_id} --&traitName|?{Trait Name} --&traitDescription|?{Trait Text} --!or:[*S:character_id]:traits|name:[&traitName]|description:[&traitDescription]|source:[&source]|source_type:[&sourceType]|options-flag:0 --+New PC Trait|Added new custom trait to PC [*S:character_name] with the name of [&traitName] }} It will then whisper to the GM: and on the sheet it will end up looking something like this: Feel free to use that as a starter for what you need and let me know if you have any questions about it.
1707584603
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The ChatSetAttr script can also do this, but I am constantly impressed by the continually evolving powers of ScriptCards.
Ok. Thanks all for your help. i'll look that up. :)
Well, I just tried, and I'm probably doing something wrong because I don't know anything about coding.  I tried copy/pasting your code, Josua, in the Macro section. It created a button, which I clicked on while selecting a token tied to a dummy character. It prompted a box asking me to name the trait, which I did, then came a prompt asking for the text of the trait, which I filled. But when I press enter afterwards, nothing happens. There is no trait added to the character sheet and there isn't even an error message in the chat window. Just nothing.  I'm probably doing something wrong, but I'm unsure about what.  I also tried to add this text as a script, but it doesn't seem to work at all some I guess that it wasn't ment to go there.
1707644043

Edited 1707644435
Hmmm.... I added what I believe to be Scriptcard's script to the game (the 2.6.2 version). I just copied the text and pasted it in the script section of the game as a new script.  Now, when I click on the macro version of the text you've given, I get the GM whisper that you've shown, but still nothing appearing on the character sheet and no error message  in the chat window.
Update (sorry for the triple posting) : I disabled my copied/pasted Scriptcard script and went to get the script from the mod library. It's probably the proper way that I should have went to begin with.  Still the problem stays, I get the prompts, the GM whisper, but no trait is added to the character sheet and no error message appearing.
Yay, it works !!! Alright, My token wasn't configurated properly. That's why it didn't work. Now everything works as it should. Thanks again for your help. :)
You're welcome. I'm glad you got it working.
Well, now I need the same thing but to add a spell instead of a trait. If I just switch every mention of the word "trait" in the macro for the word "spell" will that work somehow ? lol, sorry, it's really scripting for dummies at this point. XD
Well traits are one of the easier repeating sections on the D&D 5e sheet. They have a much smaller number of attributes to set. So looking at this line which actually creates the trait: --!or:[*S:character_id]:traits|name:[&traitName]|description:[&traitDescription]|source:[&source]|source_type:[&sourceType]|options-flag:0 You will see the following: name description source source_type options-flag The only other property for traits is display_flag Meanwhile spells have a very large list of properties. Here is an example of Hypnotic Pattern: "details-flag|0" "details-flag_max|" "options-flag|0" "options-flag_max|" "rollcontent|" "rollcontent_max|" "spell_ability|spell" "spell_ability_max|" "innate|" "innate_max|" "spell_damage_progression|" "spell_damage_progression_max|" "spellathigherlevels|" "spellathigherlevels_max|" "spellattack|" "spellattack_max|" "spellcastingtime|1 action" "spellcastingtime_max|" "spellclass|" "spellclass_max|" "spellcomp_m|{{m=1}" "spellcomp_m_max|" "spellcomp_materials|A glowing stick of incense or a crystal vial filled with phosphorescent material" "spellcomp_materials_max|" "spellcomp_s|{{s=1}" "spellcomp_s_max|" "spellcomp_v|0" "spellcomp_v_max|" "spellconcentration|{{concentration=1}" "spellconcentration_max|" "spelldamage2|" "spelldamage2_max|" "spelldamage|" "spelldamage_max|" "spelldamagetype2|" "spelldamagetype2_max|" "spelldamagetype|" "spelldamagetype_max|" "spelldescription|You create a twisting pattern of colors that weaves through the air inside a 30-foot cube within range. The pattern appears for a moment and vanishes. Each creature in the area who sees the pattern must make a Wisdom saving throw. On a failed save, the creature becomes charmed for the duration. While charmed by this spell, the creature is incapacitated and has a speed of 0. The spell ends for an affected creature if it takes any damage or if someone else uses an action to shake the creature out of its stupor." "spelldescription_max|" "spelldmgmod|" "spelldmgmod_max|" "spellduration|Up to 1 minute" "spellduration_max|" "spellhealing|" "spellhealing_max|" "spellhlbonus|" "spellhlbonus_max|" "spellhldie|" "spellhldie_max|" "spellhldietype|" "spellhldietype_max|" "spelllevel|3" "spelllevel_max|" "spellname|Hypnotic Pattern" "spellname_max|" "spelloutput|SPELLCARD" "spelloutput_max|" "spellrange|120 feet" "spellrange_max|" "spellritual|" "spellritual_max|" "spellsave|" "spellsave_max|" "spellsavesuccess|" "spellsavesuccess_max|" "spellschool|illusion" "spellschool_max|" "spellsource|" "spellsource_max|" "spelltarget|A 30-foot cube within range" "spelltarget_max|" "roll_output_dc|13" "roll_output_dc_max|" "spellprepared|1" "spellprepared_max|" So even if you discount all the _max properties that's 38 properties that can be set. So it's not going to as straightforward as the traits. The section is repeating_spell-<SPELLLEVEL> so like repeating_spell-cantrip and repeating_spell-1.  And you can create them but for some spells like say Fireball they also get a repeating_attack created, I assume by a sheet worker. Even if you only want SPELLCARD spelloutput, which don't have repeating_attacks with them, there are still a lot of properties to set. It's certainly not impossible to do but you probably need to decide how you want to input all of that data. Comma-separated strings? 30 something prompts? 
You have a point. It would probably be easier to prepare macroes that are specific to a certain spell or to a certain ability before the game starts ,and then activate them at the right moment during the game to give the predetermined spell or the predetermined ability by a simple click on the macro once the token has been selected (like, having a macro to give the spell Magic Missile to the owner of the selected token). The sample of code that you shared is inspiring. I would see a dummy macro shaped like that, with every possible properties presented and available to be filled to make the proper macro for each desired spell by filling properties according to the chosen spell. But to be honest, I'm not certain that I understand how this code works enough to write the thing properly and I don't want to take anymore of your time. I'll see if I can figure this out at some point. Thanks for your help. :)
You're welcome. For getting started with ScriptCards,  the ScriptCards wiki  is a good place to start. Nick Olivo has a number of recent Youtube videos on automating with ScriptCards now. The wiki has a link to Kurt J's, the ScriptCards author, Discord which can be a helpful resource as well.  Kurt J's Github repo  has examples of ScriptCards written. The wiki also has links to a  thread  with working examples. Also part of automating what you want isn't really about ScriptCards as much as learning about Roll20 and the API Roll20 provides. Things like knowing that @{} references, roll query ?{}, and ability calls %{} are all processed before ScriptCards runs. --#sourceToken|@{selected|token_id} --&traitName|?{Trait Name} --&traitDescription|?{Trait Text} So the above sets the ScriptCards setting to the selected token_id and ScriptCards doesn't process the @{}, Roll20 does that before ScriptCards takes over. Same for the roll query prompts ?{Trait Name} and ?{Trait Text}. Those get processed immediately as well, which is why you can't have a conditional roll query. --?"true" -eq "false"|[ --&traitName|?{TraitName} --]| That will always run ?{TraitName} first. The conditional isn't processed until after the prompt has been made. The Roll20 Objects  documentation is also handy to know what properties are available for tokens, characters, and attributes and such. And for the Character Sheet specifics, like knowing the repeating sections, you can find some documentation and info on the roll20 wiki but you can also use your browser's Inspect feature to see what sections are named and what the property names are as well. I also use ScriptCards to dump property names for the repeating sections so something like: !script {{ --#sourceToken|@{selected|token_id} --Rfirst|[*S:character_id];repeating_attack --Rdump| }} Will send all the properties for the first Attack of that PC to the API Sandbox. Replace repeating_attack with any of the other repeating section names you want.  The 5e sheet wiki  has a list near the bottom of the various repeating section names for PC sheets and NPC sheets and you can use that little ScriptCard to get a dump of the properties. ScriptCards can seem daunting to folks starting out but you can do cool things with a few simple ones at first and then build and build as you go on.
Well, so far, I could get something working for Traits. It goes like this :   !scriptcard {{ --/|ScriptCard to prompt the GM for a new custom trait on the D&D 5e by Roll20 Sheet --/|Must have a token selected --/|VARIABLES TO SET --&source|Other --&sourceType|GM Script --#whisper|gm --#title|Custom Trait Creator --#sourceToken|@{selected|token_id} --!or:[*S:character_id]:traits| name: Trait X | description: Description of trait X | source:[&source]| source_type:[&sourceType]| options-flag:0 --+New PC Trait|Added new custom trait to PC [*S:character_name] with the name of Trait X }} It's probably not the most elegant coding ever, there might be some lines that are useless, but I just have to replace the bold mentions and it'll let me add whatever trait I wish with the push of a button, it seems. 
1707817001

Edited 1707825472
I'm having much more trouble with the spell part. At first, I tried to adapt the macro that I just presented for spells. It gave something like this :   !scriptcard {{ --/|ScriptCard to prompt the GM for a new custom trait on the D&D 5e by Roll20 Sheet --/|Must have a token selected --/|VARIABLES TO SET --&source|Other --&sourceType|GM Script --#whisper|gm --#title|Custom Spell Creator --#sourceToken|@{selected|token_id} --!or:[*S:character_id]:spells| name: Spell X | description: Description of spell X | spelllevel:1| spellschool:Illusion| options-flag :0| source:[&source]| source_type:[&sourceType]| --+New PC Spell|Added new custom spell to PC [*S:character_name] with the name of Spell X }} But it didn't work. I felt like it was maybe because it was missing some property, so I tried to add every single one that you mentionned. It looks like this :  !scriptcard {{ --/|ScriptCard to prompt the GM for a new custom trait on the D&D 5e by Roll20 Sheet --/|Must have a token selected --/|VARIABLES TO SET --&source|Other --&sourceType|GM Script --#whisper|gm --#title|Custom Spell Creator --#sourceToken|@{selected|token_id} --!or:[*S:character_id]:spells| details-flag|0 details-flag_max| options-flag|0 options-flag_max| rollcontent| rollcontent_max| spell_ability|spell spell_ability_max| innate| innate_max| spell_damage_progression| spell_damage_progression_max| spellathigherlevels| spellathigherlevels_max| spellattack| spellattack_max| spellcastingtime|1 action spellcastingtime_max| spellclass| spellclass_max| spellcomp_m|{{m=1} spellcomp_m_max| spellcomp_materials|A glowing stick of incense or a crystal vial filled with phosphorescent material spellcomp_materials_max| spellcomp_s|{{s=1} spellcomp_s_max| spellcomp_v|0 spellcomp_v_max| spellconcentration|{{concentration=1} spellconcentration_max| spelldamage2| spelldamage2_max| spelldamage| spelldamage_max| spelldamagetype2| spelldamagetype2_max| spelldamagetype| spelldamagetype_max| spelldescription|You create a twisting pattern of colors that weaves through the air inside a 30-foot cube within range. The pattern appears for a moment and vanishes. Each creature in the area who sees the pattern must make a Wisdom saving throw. On a failed save, the creature becomes charmed for the duration. While charmed by this spell, the creature is incapacitated and has a speed of 0. The spell ends for an affected creature if it takes any damage or if someone else uses an action to shake the creature out of its stupor. spelldescription_max| spelldmgmod| spelldmgmod_max| spellduration|Up to 1 minute spellduration_max| spellhealing| spellhealing_max| spellhlbonus| spellhlbonus_max| spellhldie| spellhldie_max| spellhldietype| spellhldietype_max| spelllevel|3 spelllevel_max| spellname|Hypnotic Pattern spellname_max| spelloutput|SPELLCARD spelloutput_max| spellrange|120 feet spellrange_max| spellritual| spellritual_max| spellsave| spellsave_max| spellsavesuccess| spellsavesuccess_max| spellschool|illusion spellschool_max| spellsource| spellsource_max| spelltarget|A 30-foot cube within range spelltarget_max| roll_output_dc|13 roll_output_dc_max| spellprepared|1 spellprepared_max| --+New PC Spell|Added new custom spell to PC [*S:character_name] with the name of H ypnotic Pattern }} But it doesn't work either. I tried to respect the syntax that the previous macro used, but... To be honest, I'm not certain of what it is that doesn't work exactly. Is it some minor detail ? Is it the whole thing ? I really don't know. I wish there was some error message to tell me what is wrong. (Note : I'm getting the GM confirmation whisper as expected, but nothing appears in the spell book of the selected player.) 
So you can get rid of all the _max properties in your ScriptCard. Max properties are set in the same call that sets an attribute so like `--!a:[*S:character_id]|new_attribute:1:5` would set the attribute value to 1 and the max to 5. Next you have syntax error in your statements.  Per the wiki  there needs to be a colon : between the attribute name and the value. You have that in your traits script but in your spell script you have a pipe character |. so for example you'd need to have: spelloutput:SPELLCARD|spellname:Hypnotic Pattern The Pipe character separates the attributes and the colon separates the attribute from the value and the max. Next the D&D 5e character sheet does not have a section repeating_spells. As I mentioned in my earlier post: The section is repeating_spell-<SPELLLEVEL> so like repeating_spell-cantrip and repeating_spell-1. So you would probably want to set a single string variable at the start of your script for the level. and then it could be used in your script. For example: --&spelllvl|1 --!or:[*S:character_id]:spell-[&spelllvl]|spelllevel:[&spelllvl] That way it would only need to be changed once at the top and then used in the section name and for the attribute's value. It often helps to avoid bugs to reuse values like that and not have to hunt all the places you need to change them. The  D&D 5e by Roll20 wiki  will also have more examples of the names of repeating sections on the sheet. The PC and NPC sheets have different repeating sections so be aware of that.
Joshua N. said: So you can get rid of all the _max properties in your ScriptCard. Max properties are set in the same call that sets an attribute so like `--!a:[*S:character_id]|new_attribute:1:5` would set the attribute value to 1 and the max to 5. Next you have syntax error in your statements.  Per the wiki  there needs to be a colon : between the attribute name and the value. You have that in your traits script but in your spell script you have a pipe character |. so for example you'd need to have: spelloutput:SPELLCARD|spellname:Hypnotic Pattern The Pipe character separates the attributes and the colon separates the attribute from the value and the max. Next the D&D 5e character sheet does not have a section repeating_spells. As I mentioned in my earlier post: The section is repeating_spell-<SPELLLEVEL> so like repeating_spell-cantrip and repeating_spell-1. So you would probably want to set a single string variable at the start of your script for the level. and then it could be used in your script. For example: --&spelllvl|1 --!or:[*S:character_id]:spell-[&spelllvl]|spelllevel:[&spelllvl] That way it would only need to be changed once at the top and then used in the section name and for the attribute's value. It often helps to avoid bugs to reuse values like that and not have to hunt all the places you need to change them. The  D&D 5e by Roll20 wiki  will also have more examples of the names of repeating sections on the sheet. The PC and NPC sheets have different repeating sections so be aware of that. So, I tried to apply all of what you said. I believe I did everything that I just crossed. I don't understand the part about the repeating thing (the one that I didn't cross).  It's still not working. It looks like this now. I might not have applied what you said properly. I would be lying if I was saying that I know what I'm doing. XD It looks like this now :   !scriptcard {{ --/|ScriptCard to prompt the GM for a new custom trait on the D&D 5e by Roll20 Sheet --/|Must have a token selected --/|VARIABLES TO SET --&source|Other --&sourceType|GM Script --#whisper|gm --#title|Custom Spell Creator --#sourceToken|@{selected|token_id} --&spelllvl|1 --!or:[*S:character_id]:spell-[&spelllvl]|spelllevel:[&spelllvl] details-flag:0| options-flag:0| rollcontent| spell_ability:spell| innate| spell_damage_progression| spellathigherlevels| spellattack| spellcastingtime:1 action| spellclass| spellcomp_m:{{m=1}| spellcomp_materials:A glowing stick of incense or a crystal vial filled with phosphorescent material| spellcomp_s:{{s=1}| spellcomp_v:0| spellconcentration:{{concentration=1}| spelldamage2| spelldamage| spelldamagetype2| spelldamagetype| spelldescription:You create a twisting pattern of colors that weaves through the air inside a 30-foot cube within range. The pattern appears for a moment and vanishes. Each creature in the area who sees the pattern must make a Wisdom saving throw. On a failed save, the creature becomes charmed for the duration. While charmed by this spell, the creature is incapacitated and has a speed of 0. The spell ends for an affected creature if it takes any damage or if someone else uses an action to shake the creature out of its stupor.| spelldmgmod| spellduration:Up to 1 minute| spellhealing| spellhlbonus| spellhldie| spellhldietype| spelllevel:3| spellname:Hypnotic Pattern| spelloutput:SPELLCARD| spellrange:120 feet| spellritual| spellsave| spellsavesuccess| spellschool:illusion| spellsource| spelltarget:A 30-foot cube within range| roll_output_dc:13| spellprepared:1| --+New PC Spell|Added new custom spell to PC [*S:character_name] with the name of H ypnotic Pattern }} Don't feel obliged to reply, Josua. Like I said, I already abused way too much of your time. I'm just droping this here in case somebody has an idea. Because I tried to go to every link that you provided, but, honestly, there is a lot that I did not understand, and there is so much informations that I'm getting drown in it. Anyway, i'm thankful for all the help I received. :)
So you were close. Just needed a couple tweaks, might have just been copypasta issues. Here's an update: !scriptcard {{ --/|ScriptCard to prompt the GM for a new custom trait on the D&D 5e by Roll20 Sheet --/|Must have a token selected --/|VARIABLES TO SET --&spelllvl|1 --#whisper|gm --#title|Custom Spell Creator --#sourceToken|@{selected|token_id} --!or:[*S:character_id]:spell-[&spelllvl]| details-flag:0| options-flag:0| rollcontent| spell_ability:spell| innate| spell_damage_progression| spellathigherlevels| spellattack| spellcastingtime:1 action| spellclass| spellcomp_m:0| spellcomp_materials:A glowing stick of incense or a crystal vial filled with phosphorescent material| spellcomp_s:0| spellcomp_v:0| spellconcentration:{{concentration=1}| spelldamage2| spelldamage| spelldamagetype2| spelldamagetype| spelldescription:You create a twisting pattern of colors that weaves through the air inside a 30-foot cube within range. The pattern appears for a moment and vanishes. Each creature in the area who sees the pattern must make a Wisdom saving throw. On a failed save, the creature becomes charmed for the duration. While charmed by this spell, the creature is incapacitated and has a speed of 0. The spell ends for an affected creature if it takes any damage or if someone else uses an action to shake the creature out of its stupor.| spelldmgmod| spellduration:Up to 1 minute| spellhealing| spellhlbonus| spellhldie| spellhldietype| spelllevel:[&spelllvl]| spellname:Hypnotic Pattern| spelloutput:SPELLCARD| spellrange:120 feet| spellritual| spellsave| spellsavesuccess| spellschool:illusion| spellsource| spelltarget:A 30-foot cube within range| spellprepared:1| --+New PC Spell|Added new custom spell to PC [*S:character_name] with the name of Hypnotic Pattern }} I got rid of the old trait variables at the top of the script that were left in but not used. You had 2 spelllevel attributes in your list, so I removed the one after the section call. The version you had would've missed a pipe character at the end so removing that one and changing the spelllevel attribute lower to use the [&spelllvl] String variable should work. I also set the verbal and somatic spell component attributes to 0 since the {{ } might be causing issues.
Actually I have added a few new variables to be able to set the checkboxes for the components and concentration. !scriptcard {{ --/|ScriptCard to prompt the GM for a new custom trait on the D&D 5e by Roll20 Sheet --/|Must have a token selected --/|VARIABLES TO SET --&spelllvl|1 --&concentrationRequired|false --&somaticComponent|false --&materialComponent|false --&verbalComponent|false --#whisper|gm --#title|Custom Spell Creator --#sourceToken|@{selected|token_id} --?"[&concentrationRequired]" -eq "true"|>SetConcentration;spellconvar|&spellconvar;0 --?"[&somaticComponent]" -eq "true"|>SetComponent;somatic;scomp|&scomp;0 --?"[&materialComponent]" -eq "true"|>SetComponent;material;mcomp|&mcomp;0 --?"[&verbalComponent]" -eq "true"|>SetComponent;verbal;vcomp|&vcomp;0 --!or:[*S:character_id]:spell-[&spelllvl]| details-flag:0| options-flag:0| rollcontent| spell_ability:spell| innate| spell_damage_progression| spellathigherlevels| spellattack| spellcastingtime:1 action| spellclass| spellcomp_m:[&mcomp]| spellcomp_materials:A glowing stick of incense or a crystal vial filled with phosphorescent material| spellcomp_s:[&scomp]| spellcomp_v:[&vcomp]| spellconcentration:[&spellconvar]| spelldamage2| spelldamage| spelldamagetype2| spelldamagetype| spelldescription:You create a twisting pattern of colors that weaves through the air inside a 30-foot cube within range. The pattern appears for a moment and vanishes. Each creature in the area who sees the pattern must make a Wisdom saving throw. On a failed save, the creature becomes charmed for the duration. While charmed by this spell, the creature is incapacitated and has a speed of 0. The spell ends for an affected creature if it takes any damage or if someone else uses an action to shake the creature out of its stupor.| spelldmgmod| spellduration:Up to 1 minute| spellhealing| spellhlbonus| spellhldie| spellhldietype| spelllevel:[&spelllvl]| spellname:Hypnotic Pattern| spelloutput:SPELLCARD| spellrange:120 feet| spellritual| spellsave| spellsavesuccess| spellschool:illusion| spellsource| spelltarget:A 30-foot cube within range| spellprepared:1| --+New PC Spell|Added new custom spell to PC [*S:character_name] with the name of Hypnotic Pattern --X| --:SetComponent|ComponentType;ReturnVariable --&tmpcompvar|[%1%] --C[&tmpcompvar(tolowercase)]|verbal:&scVar;v|somatic:&scVar;s|material:&scVar;m --~[%2%]|string;replaceencoding;%7B%7B[&scVar]%3D1%7D%7D --<| --:SetConcentration|ReturnVariable --~[%1%]|string;replaceencoding;%7B%7Bconcentration%3D1%7D%7D --<| }} So you can set any or all of the following to true to set them. --&concentrationRequired|false --&somaticComponent|false --&materialComponent|false --&verbalComponent|false
Hmmm... as far as I can tell, it doesn't work. It copies the macro in the chat window, but there is no spell added to the player's sheet.  I tried to restart the API Sandbox, in case case that was the problem. But it didn't change anything.
Okay, wait, My message was for the first macro, hehe. Trying to process the one that you've just sent. :D
Same result for the second one.  Maybe I'm missing some component ? The only script I installed is Scriptcard 2.6.2c.
1707867544

Edited 1707867584
That's all you should need. I tested it and it worked fine. Added a first level spell just fine. I ran it a number of times and with all set to true and all set to false. Each time it created a 1st level spell named Hypnotic Pattern on a sorcerer PC sheet. No other scripts/mods are needed. This is all just ScriptCards. There aren't any calls to other mods in there, you can tell that cause the ScriptCard call to other mods is --@ and there isn't that in there. Can you send a screenshot of your character sheet? Maybe one with the Spell tab selected. Do you use the charactermancer to make characters or no? EDIT: Also is the selected token linked to a character?
1707871443

Edited 1707871501
I use VTTES, maybe that's why...  The token was selected and it is linked to the character sheet, I checked multiple time, also erased and re-copied the macro to make sure that it wasn't a problem of bad copy, but always the same result.
Wait...
It works !!!! There was a space before the initial " !scriptcard {{". I erased it and now it works !!!! Woohoooooo !!!!!! Finaly !  Thanks a lot, man. In the end, you did most of my work for me lol. I'm really grateful. :D I'll be able to generate nightmares in the minds of so many more players now, mwahahhahaha !!! :D
Oh that's great. Good catch. Glad it's working for you.