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

ChatSetAttr & Creating New Spells

1681142006
Nick O.
Forum Champion
Hi All I'm trying to add a new spell via ChatSetAttr to the D&D 5e character sheet by Roll20. The below code mostly works, but it's not checking the V and S boxes in the spell component section, it's not checking the concentration box, and it's not setting the spell ability to Intelligence. If anyone could point me at where I'm going wrong, that'd be much appreciated :) !setattr {{ --sel --replace --repeating_spell-3_-CREATE_spellname|My Spell --repeating_spell-3_-CREATE_spellschool|conjuration --repeating_spell-3_-CREATE_spellcastingtime|1 action --repeating_spell-3_-CREATE_spellrange|Self --repeating_spell-3_-CREATE_spellability|INTELLIGENCE --repeating_spell-3_-CREATE_spellcomp_v|1 --repeating_spell-3_-CREATE_spellcomp_s|1 --repeating_spell-3_-CREATE_spellcomp_m|0 --repeating_spell-3_-CREATE_spellconcentration|1 --repeating_spell-3_-CREATE_spellduration|1 minute --repeating_spell-3_-CREATE_spelloutput|ATTACK --repeating_spell-3_-CREATE_spellattack|Melee --repeating_spell-3_-CREATE_spelldamage|1d6 --repeating_spell-3_-CREATE_spelldamagetype|cold --repeating_spell-3_-CREATE_spelldamage2|1d6 --repeating_spell-3_-CREATE_spelldamagetype2|necrotic --repeating_spell-3_-CREATE_spelldescription|My Cool Spell Description }}
1681148340

Edited 1681148698
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It's odd. I ran that, and although the checkbox is not set, the value is "1" in the inspector, and it flags the "c" icon in the collapsed spell name. Same with components.
1681148768

Edited 1681149160
One way to check what a repeating attribute is supposed to be is to reference a 'good' value from another spell. If you type @{selected|repeating_spell-cantrip_$0_spellcomp_v} into chat on a character with a cantrip, then you get '{{v=1}}' as the output, so that's what you'll need to put for the ChatSetAttr value. The issue is the double right braces end the multi-line command for ChatSetAttr, and there's no replace option for those like there is for brackets, question marks, or 'at' symbols.  So you've got two options: you can delete ChatSetAttr and then manually re-import it, adding a replace function for braces (shown in bold here - about line 20 of the code): replacers = [ [/</g, "["], [/\\lbrak/g, "["], [/>/g, "]"], [/\\rbrak/g, "]"], [/\\lbrace/g, "{"], [/\\rbrace/g, "}"], [/;/g, "?"], [/\\ques/g, "?"], [/`/g, "@"], [/\\at/g, "@"], [/~/g, "-"], [/\\n/g, "\n"], ], Or you can simply make the command a single-line command.  (Unless someone else knows a way to incorporate double right braces in a ChatSetAttr multi-line command!) For setting the Spell Ability to 'Intelligence', you are missing an underscore: ' spell_ability'. Also, the sheetworkers automatically convert the selection to a different attribute reference such as ' @{intelligence_mod}+', so you need to use ' \at{intelligence_mod}+' and not 'INTELLIGENCE'. The value for the Concentration box is '{{concentration=1}}' Here's the final code on a single line (updated with the Concentration Box checked): !setattr --sel  --replace  --repeating_spell-3_-CREATE_spellname|My Spell  --repeating_spell-3_-CREATE_spellschool|conjuration  --repeating_spell-3_-CREATE_spellcastingtime|1 action  --repeating_spell-3_-CREATE_spellrange|Self  --repeating_spell-3_-CREATE_spell_ability|\at{intelligence_mod}+  --repeating_spell-3_-CREATE_spellcomp_v|{{v=1}}  --repeating_spell-3_-CREATE_spellcomp_s|{{s=1}}  --repeating_spell-3_-CREATE_spellcomp_m|{{m=1}}  --repeating_spell-3_-CREATE_spellconcentration|{{concentration=1}}  --repeating_spell-3_-CREATE_spellduration|1 minute  --repeating_spell-3_-CREATE_spelloutput|ATTACK  --repeating_spell-3_-CREATE_spellattack|Melee  --repeating_spell-3_-CREATE_spelldamage|1d6  --repeating_spell-3_-CREATE_spelldamagetype|cold  --repeating_spell-3_-CREATE_spelldamage2|1d6  --repeating_spell-3_-CREATE_spelldamagetype2|necrotic  --repeating_spell-3_-CREATE_spelldescription|My Cool Spell Description
1681148920

Edited 1681148988
I missed the Concentration part. The value for the Concentration box is '{{concentration=1}}' !setattr --sel  --replace  --repeating_spell-3_-CREATE_spellname|My Spell  --repeating_spell-3_-CREATE_spellschool|conjuration  --repeating_spell-3_-CREATE_spellcastingtime|1 action  --repeating_spell-3_-CREATE_spellrange|Self  --repeating_spell-3_-CREATE_spell_ability|\at{intelligence_mod}+  --repeating_spell-3_-CREATE_spellcomp_v|{{v=1}}  --repeating_spell-3_-CREATE_spellcomp_s|{{s=1}}  --repeating_spell-3_-CREATE_spellcomp_m|{{m=1}}  --repeating_spell-3_-CREATE_spellconcentration|{{concentration=1}}  --repeating_spell-3_-CREATE_spellduration|1 minute  --repeating_spell-3_-CREATE_spelloutput|ATTACK  --repeating_spell-3_-CREATE_spellattack|Melee  --repeating_spell-3_-CREATE_spelldamage|1d6  --repeating_spell-3_-CREATE_spelldamagetype|cold  --repeating_spell-3_-CREATE_spelldamage2|1d6  --repeating_spell-3_-CREATE_spelldamagetype2|necrotic  --repeating_spell-3_-CREATE_spelldescription|My Cool Spell Description
1681150405
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Jarren, Good catch! I wasn't reading closely enough, just seeing " concentration=1 " and ignoring the text around.  That works. Nick, are you making a parsing spreadsheet?
1681150756
Nick O.
Forum Champion
Thanks, Jarren and Keith! Keith, no, I'm not making anything like that right now, though I can definitely see a use for it. Why do you ask?
1681152011

Edited 1681152049
timmaugh
Pro
API Scripter
To Jarren's point, the double brackets will preemptively terminate the message before you're ready. That's a Roll20 quirk, so it's not easy to get around. However, if you don't want to alter the code for ChatSetAttr to create your own replacement and you still want to use the multi-line layout for your ChatSetAttr command, you can use a ZeroFrame GLOBAL tag right in your command line and declare an ad hoc replacement. For example, to establish replacements of: ({)  ...becoming... {{ (})  ...becoming... }} You'd just include this tag somewhere in your command line: {&global ([({)] {{) ([(})] }}) } That can get your eyes squinting with so many symbols in close proximity, but it basically follows this pattern: {&global ([term1] definition1) ([term2] definition2) } ...and it's discussed in more depth here . In any case, here is your original command line with Jarren's fixes... but using the above global terms: !setattr {{   --sel   --replace   --repeating_spell-3_-CREATE_spellname|My Spell   --repeating_spell-3_-CREATE_spellschool|conjuration   --repeating_spell-3_-CREATE_spellcastingtime|1 action   --repeating_spell-3_-CREATE_spellrange|Self   --repeating_spell-3_-CREATE_spell_ability|\at{intelligence_mod}+   --repeating_spell-3_-CREATE_spellcomp_v|({)v=1(})   --repeating_spell-3_-CREATE_spellcomp_s|({)s=1(})   --repeating_spell-3_-CREATE_spellcomp_m|({)m=1(})   --repeating_spell-3_-CREATE_spellconcentration|({)concentration=1(})   --repeating_spell-3_-CREATE_spellduration|1 minute   --repeating_spell-3_-CREATE_spelloutput|ATTACK   --repeating_spell-3_-CREATE_spellattack|Melee   --repeating_spell-3_-CREATE_spelldamage|1d6   --repeating_spell-3_-CREATE_spelldamagetype|cold   --repeating_spell-3_-CREATE_spelldamage2|1d6   --repeating_spell-3_-CREATE_spelldamagetype2|necrotic   --repeating_spell-3_-CREATE_spelldescription|My Cool Spell Description }} {&global ([({)] {{) ([(})] }}) } REQUIRED SCRIPTS: ChatSetAttr, ZeroFrame
1681154256
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Nick O. said: Keith, no, I'm not making anything like that right now, though I can definitely see a use for it. Why do you ask? Mostly curiosity. But there are some similar spreadsheets linked in the top post of the Tips and Tricks thread. I'd include it there if you posted such a thing.
1681158709
Nick O.
Forum Champion
Mostly curiosity. But there are some similar spreadsheets linked in the top post of the Tips and Tricks thread. I'd include it there if you posted such a thing. I'm definitely considering it right now :) I'll keep you posted if I create one.