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

[Script] ChatSetAttr - set character attributes via chat messages

1506968171
Jakob
Sheet Author
API Scripter
Kyle said: Jakob said: !setattr --name Name --lvl1_slots_expended|[[[[{@(lvl1_slots_expended}+1,@(lvl1_slots_total}}]]kl1]] For reference this only worked if I set the attributes to reference the character sheet individually, i.e. by replacing @(lvl1_slots_expended} with @(Name|lvl1_slots_expended} and the same with slots total. I don't understand why it would be needed but maybe someone more clever than me can use this info. Ah yes, the version I gave would only work in an ability, not in a global macro, otherwise Roll20 doesn't know where to pull the values from :).
Thanks for the fix, this is such a useful piece of kit I had to ask for a fix. If by ability you mean a %{} and global macro a #__ then it's a global macro. &{template:dmg} {{rname=Flexible Casting}} {{range=Creating Spell Slots}} {{damage=1}} {{dmg1flag=1}} {{dmg2=?{Level of Spell Slot Gained|1st for 2 points, 1st|2nd for 3 points, 2nd|3rd for 5 points, 3rd|4th for 6 points, 4th|5th for 7 points, 5th} Level}} {{dmg2type=Spell Slot Gained}} {{dmg2flag=1}} {{dmg1=[[?{Sorcery Points Spent|2 for 1st Level, 2 |3 points for 2nd Level, 3| 5 points for 3rd Level, 5| 6 points for 4th Level, 6| 7 points for 5th Level, 7}]]}} {{dmg1type=Sorcery Points Spent}} {{spelllevel=}} ammo=Sorcery Points,?{Sorcery Points Spent|2 for 1st Level, 2 |3 points for 2nd Level, 3| 5 points for 3rd Level, 5| 6 points for 4th Level, 6| 7 points for 5th Level, 7}|-Ku5WOQOGPgA-hcPOLWG @{True River Freeflow|charname_output}
1506968563
Jakob
Sheet Author
API Scripter
That doesn't seem to contain any ChatSetAttr call? It ought to be fine once you put the ChatSetAttr stuff on the second line...
I didn't add it to what I copy pasted sorry, I'm just using the call you provided before. It doesn't work if i put the CSA on the second line, the original macro is posted as normal but the CSA call is never made. However, if I do CSA first line roll template second both are outputted, but the CSA whisper is outputted between the roll template and the ammo amount output, which looks a little ugly. I may just add the --silent option and leave it at that as it seems to be working like this. Thanks for the quick reply and help and thanks for making such a useful script. :)
Sorry to bother this post again but I had a couple of questions about the script again. Firstly I saw on an earlier post a way to make a 'toggle' macro toggling between 0 and 1, but is there anyway to make a toggle between text values, i.e not maths. The closest I could get i setting 2 attributes equal to each other like so !setattr --name Name --attr1|@{attr2} --attr2|@{attr1} after setting attr1 to on and attr2 to off. But this seems quite dodgy and can be a little temperamental. Secondly is there any way to complete turn off from where the message is being whispered from. Leaving --fb-from blank still leaves the message being whispered like (From ):  . Is this a limitation due to roll20 or does anyone know a way around?
1507014634
Jakob
Sheet Author
API Scripter
Kyle said: I didn't add it to what I copy pasted sorry, I'm just using the call you provided before. It doesn't work if i put the CSA on the second line, the original macro is posted as normal but the CSA call is never made. However, if I do CSA first line roll template second both are outputted, but the CSA whisper is outputted between the roll template and the ammo amount output, which looks a little ugly. I may just add the --silent option and leave it at that as it seems to be working like this. That's odd, I thought that every line was sent as a separate chat message... but who knows what's going wrong there. With regard to the order, that's unavoidable sadly, chat messages are asynchronous, there's no good way to ensure which one comes first. Secondly is there any way to complete turn off from where the message is being whispered from. Leaving --fb-from blank still leaves the message being whispered like (From ):  . Is this a limitation due to roll20 or does anyone know a way around? I don't think there is. Maybe via "/direct", but I've never used that one, and anyway it does not support whispering. Sorry to bother this post again but I had a couple of questions about the script again. Firstly I saw on an earlier post a way to make a 'toggle' macro toggling between 0 and 1, but is there anyway to make a toggle between text values, i.e not maths. The closest I could get i setting 2 attributes equal to each other like so !setattr --name Name --attr1|@{attr2} --attr2|@{attr1} after setting attr1 to on and attr2 to off. But this seems quite dodgy and can be a little temperamental. You can do it, but only with --evaluate: !setattr {{ --name Name --evaluate --attr1|("%attr1%" === "banana") ? "apple" : "banana" }} This (modulo typos) will set attr1 to apple if it's equal to banana, and to banana otherwise... Kyle said: Thanks for the quick reply and help and thanks for making such a useful script. :) Thank you!
1507020499
Jakob
Sheet Author
API Scripter
This episode has also helped me track down a misplaced bracket in the code for !modbattr. I added a small fix making sure it should no longer be possible to get NaN even if the maximum is not a number (a non-number maximum like @{spell_slots_total} will simply be ignored).
Sorry to bother this post again but I had a couple of questions about the script again. Firstly I saw on an earlier post a way to make a 'toggle' macro toggling between 0 and 1, but is there anyway to make a toggle between text values, i.e not maths. The closest I could get i setting 2 attributes equal to each other like so !setattr --name Name --attr1|@{attr2} --attr2|@{attr1} after setting attr1 to on and attr2 to off. But this seems quite dodgy and can be a little temperamental. You can do it, but only with --evaluate: !setattr {{ --name Name --evaluate --attr1|("%attr1%" === "banana") ? "apple" : "banana" }} This (modulo typos) will set attr1 to apple if it's equal to banana, and to banana otherwise... I know --evaluate is default set to only be used by GMs and I remember there was a reason for this but I can't remember what it was. Is it worth asking the GM to give me permission to use, I don't want to screw with the whole API just for my sake? Jakob said: This episode has also helped me track down a misplaced bracket in the code for !modbattr. I added a small fix making sure it should no longer be possible to get NaN even if the maximum is not a number (a non-number maximum like @{spell_slots_total} will simply be ignored). Does this mean you can now use !modbattr on attributes that have another attribute as a maximum or does it mean that !modbattr will just act like !modattr in that case?
1507052810
Jakob
Sheet Author
API Scripter
It requires permission because you can execute arbitrary code in the API with it. You won't do it by accident, so it comes down to your GM trusting you not to intentionally delete all objects in the campaign.  As to the second question, it functions as if the max value was empty, i.e. it only bounds the value from below by zero with no upper bound. Sorry.
I'll ask him next game then, thanks again for the help with this. And don't be sorry haha, I was just wondering, the work-around you gave before still works perfectly.
1510900145
vÍnce
Pro
Sheet Author
For some reason I cannot get buffs to toggle on the PF sheet. The chatsetattr script posts that the attribute change was successful, yet the sheet doesn't show any change. ;-(  I'm fairly certain that this used to work for me. !setattr --sel --repeating_buff2_$0_buff-enable_toggle|[[1-@{selected|repeating_buff2_$0_buff-enable_toggle}]] Suggestions?  TIA
1510904396
Jakob
Sheet Author
API Scripter
Are you sure that buff-enable_toggle is the correct attribute name and repeating_buff2 is the correct section name?
1510931852

Edited 1510931979
vÍnce
Pro
Sheet Author
Jakob said: Are you sure that buff-enable_toggle is the correct attribute name and repeating_buff2 is the correct section name? Yes.  I had to update my macro when Chris updated buffs to handle stacking rules.  Hmmm.  I haven't tried  substituting rowid instead of using $X.  I'll have to try that when I get home...
1510933691
Jakob
Sheet Author
API Scripter
Vince said: Jakob said: Are you sure that buff-enable_toggle is the correct attribute name and repeating_buff2 is the correct section name? Yes.  I had to update my macro when Chris updated buffs to handle stacking rules.  Hmmm.  I haven't tried  substituting rowid instead of using $X.  I'll have to try that when I get home... I don't want to tell you about your sheet, but I just checked it and the attribute name is enable_toggle, not buff-enable_toggle... :).
1510961874
vÍnce
Pro
Sheet Author
Lol, and it's right there in my screen shot.  That actually makes me happy.  Thanks Jakob.
1511071177
vÍnce
Pro
Sheet Author
Update: yep, as Jakob pointed out, I had my attributes misnamed... here's a working macro to toggle the first buff (row 0) on the PF sheet; !setattr --sel --repeating_buff2_$0_enable_toggle|[[1-@{selected|repeating_buff2_$0_enable_toggle}]]
Is it possible to cancel all feedback in order to minimize chat clutter? 
1513454143
Jakob
Sheet Author
API Scripter
Ravenknight said: Is it possible to cancel all feedback in order to minimize chat clutter?  Yup, --silent, or --mute if you also want to suppress error messages.
1513454609

Edited 1513456947
Ravenknight
KS Backer
Great! Thanks Jakob! Edit: Now when I read the Readme again I notice it high up on the list. :/ Sorry about that.
I am trying to get ChatSetAttr to work with variables. Here is the code used for setting the attribute: !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|[^Dmg] --Mana Pool Left:|[[ [$Dmg] {@{selected|repeating_resource_$0_resource_left} - ?{Mana Pool?|0}} ]] This does output [^Dmg] = resource left - Mana Pool Errors Attribute repeating_resource_$0_resource_left is not number-valued for character Kelowinn 'Kel' Shadestar. Attribute left unchanged.
Theodore S. said: I am trying to get ChatSetAttr to work with variables. Here is the code used for setting the attribute: !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|[^Dmg] --Mana Pool Left:|[[ [$Dmg] {@{selected|repeating_resource_$0_resource_left} - ?{Mana Pool?|0}} ]] This does output [^Dmg] = resource left - Mana Pool Errors Attribute repeating_resource_$0_resource_left is not number-valued for character Kelowinn 'Kel' Shadestar. Attribute left unchanged. !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|[[ @{selected|repeating_resource_$0_resource_left} - ?{Mana Pool?|0} ]]   ? !setattr is not power cards.
Craven said: Theodore S. said: I am trying to get ChatSetAttr to work with variables. Here is the code used for setting the attribute: !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|[^Dmg] --Mana Pool Left:|[[ [$Dmg] {@{selected|repeating_resource_$0_resource_left} - ?{Mana Pool?|0}} ]] This does output [^Dmg] = resource left - Mana Pool Errors Attribute repeating_resource_$0_resource_left is not number-valued for character Kelowinn 'Kel' Shadestar. Attribute left unchanged. !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|[[ @{selected|repeating_resource_$0_resource_left} - ?{Mana Pool?|0} ]]   ? !setattr is not power cards. So I take it there is no way to make Power Cards/ChatSetAttr to function together when it comes to variables?
Theodore S. said: Craven said: Theodore S. said: I am trying to get ChatSetAttr to work with variables. Here is the code used for setting the attribute: !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|[^Dmg] --Mana Pool Left:|[[ [$Dmg] {@{selected|repeating_resource_$0_resource_left} - ?{Mana Pool?|0}} ]] This does output [^Dmg] = resource left - Mana Pool Errors Attribute repeating_resource_$0_resource_left is not number-valued for character Kelowinn 'Kel' Shadestar. Attribute left unchanged. !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|[[ @{selected|repeating_resource_$0_resource_left} - ?{Mana Pool?|0} ]]   ? !setattr is not power cards. So I take it there is no way to make Power Cards/ChatSetAttr to function together when it comes to variables? No they don't pass info to each other and when i tried to get it to work inside power card it didn't work. you can use  stuff like !setattr --name @{selected|character_name} --modb --lvl?{Spell Slot|1|2|3|4|5|6|7|8|9}_slots_expended|?{Add or Subtract?|+|-}?{Number?|1|2|3|4} and can be used before or after power card like !setattr --name @{selected|character_name} --modb --lvl?{Spell Slot|2}_slots_expended|-1 !power {{ --emote|** @{selected|token_name} Unleashes a spell ** --tokenid|@{selected|token_id} --titlefontshadow|none --format|Conditions --corners|10 --name|Scorching Ray | 3 Targets --leftsub|Ranged Attack spell --rightsub| 120’ --Spell Level:| **Level 2** }}
1513507604

Edited 1513507654
Craven said: Theodore S. said: Craven said: Theodore S. said: I am trying to get ChatSetAttr to work with variables. Here is the code used for setting the attribute: !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|[^Dmg] --Mana Pool Left:|[[ [$Dmg] {@{selected|repeating_resource_$0_resource_left} - ?{Mana Pool?|0}} ]] This does output [^Dmg] = resource left - Mana Pool Errors Attribute repeating_resource_$0_resource_left is not number-valued for character Kelowinn 'Kel' Shadestar. Attribute left unchanged. !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|[[ @{selected|repeating_resource_$0_resource_left} - ?{Mana Pool?|0} ]]   ? !setattr is not power cards. So I take it there is no way to make Power Cards/ChatSetAttr to function together when it comes to variables? No they don't pass info to each other and when i tried to get it to work inside power card it didn't work. you can use  stuff like !setattr --name @{selected|character_name} --modb --lvl?{Spell Slot|1|2|3|4|5|6|7|8|9}_slots_expended|?{Add or Subtract?|+|-}?{Number?|1|2|3|4} and can be used before or after power card like !setattr --name @{selected|character_name} --modb --lvl?{Spell Slot|2}_slots_expended|-1 !power {{ --emote|** @{selected|token_name} Unleashes a spell ** --tokenid|@{selected|token_id} --titlefontshadow|none --format|Conditions --corners|10 --name|Scorching Ray | 3 Targets --leftsub|Ranged Attack spell --rightsub| 120’ --Spell Level:| **Level 2** }} You inadvertently solved my problem Craven. Here is the finished Power Card using ChatSetAttr for Lay on Hands: !setattr --name @{selected|character_name} --modb --repeating_resource_$0_resource_left|-?{Mana Pool Used?|0} !power {{ --tokenid|@{selected|token_id} --titlebackground|none --titlefontshadow|none --corners|10 --format|atwill --name|Lay On Hands --leftsub|@{selected|character_name} --rightsub|Level @{selected|level} @{selected|class} --Action:|Your blessed touch can heal wounds. You have a pool of healing power that replenishes when you take a long rest. With that pool, you can restore a total number of hit points equal to your paladin level x 5.^^ ^^ As an action, you can touch a creature and draw power from the pool to restore a number of hit points to that creature, up to the maximum amount remaining in your pool.^^ ^^ Alternatively, you can expend 5 hit points from your pool of healing to cure the target of one disease or neutralize one poison affecting it. You can cure multiple diseases and neutralize multiple poisons with a single use of Lay on Hands, expending hit points separately for each one.^^ ^^ This feature has no effect on undead and constructs.^^ ^^ --!Action|@{selected|character_name} uses [[?{Mana Pool Used?|0}]] of his mana pool. --Mana Pool Left:|[[ {@{selected|repeating_resource_$0_resource_left} - ?{Mana Pool Used?|0}} ]] }}
This may have been answered but, with seven pages it's a bit hard to tell.  But I have inline rolls I want evaluated and passed to text fields, not calculated as a roll. !setattr --sel {{ --repeating_ability_$0_rule_category|special-abilities --repeating_ability_$0_CL-basis|@\{level\} --repeating_ability_$0_name|Horn Blast / Beam --repeating_ability_$0_ability_type|Sp --repeating_ability_$0_short-description|**Note:** Atk roll only for beam. --repeating_ability_$0_frequency|everyrounds --repeating_ability_$0_rounds_between|[[1d4]] --repeating_ability_$0_ability-basis|@\{INT-mod\} --repeating_ability_$0_spell_level-basis|@\{casterlevel\} --repeating_ability_$0_abil-sr|No --repeating_ability_$0_abil-attack-type|attk-ranged --repeating_ability_$0_targets|30 ft (blast); 60 ft. line (beam) --repeating_ability_$0_damage-macro-text|[[ceil(@\{level\}/2)d6]] --repeating_ability_$0_description|A horn blast is a special attack that horned creatures of Equestria may use once they gain their cutie mark.  Channeling the pure forces of the arcane through their horn they are able to deal 1d6 points of damage every 2 HD [up to a maximum of 10d6].  This damage is normally force; however, this is occasionally modified by the individual pony through specialized training or natural elemental alignment.  A normal pony may use this ability only once every 1d4 rounds or risk damage to their horn (see over-channeling rules). }} rounds_between|[[1d4]] and damage-macro-text|[[ceil(@\{level\}/2)d6]] I want the rolls to be added as text not evaluated as a roll.
1513932790
Jakob
Sheet Author
API Scripter
You can either use html entities to replace the brackets, or use --replace and then "<" or "\lbrak". !setattr --sel --replace --repeating_ability_$0_rounds_between|<<1d4>>
1513963495

Edited 1513963625
Toby
Pro
I think I have found a bug, when I use --replace --repeating_ability_-CREATE_damage-macro-text|<<ceil(`{level}/2)d6>> the output is: [] When I use: --replace --repeating_ability_-CREATE_damage-macro-text|\lbrak\lbrakceil(~{level}/2)d\rbrak\rbrak the output is [[ceil(@{level/2)d6]] From my understanding of the code they should be functionally identical, I'd prefer to use << >> because its easier to read.  As a note, when I tried to copy and paste the first one into the post area it cut out everything except " < > ", that seems like an unusual coincidence, considering that would produce the exact output that I was getting with that code. Anyways, thank you for the help, it seems to work well enough, this will help me significantly.
1513971013
Jakob
Sheet Author
API Scripter
I think that may be Roll20's chat parsing getting in the way - if it somehow reads the text containg < and > as an HTML expression, the security filtering will just take it out, similar to how it's happening here in the forum with copy & paste. That's why it only works with \lbrak (or HTML entities), but there's not much I can do about that since the text never arrives in the API in the first place.
Jakob said: I think that may be Roll20's chat parsing getting in the way - if it somehow reads the text containg < and > as an HTML expression, the security filtering will just take it out, similar to how it's happening here in the forum with copy & paste. That's why it only works with \lbrak (or HTML entities), but there's not much I can do about that since the text never arrives in the API in the first place. Ah, well at least now I understand whats going on. Thank you.
Um, another question, why does !setattr --sel --repeating_weapon_-CREATE_hp|5 --repeating_weapon_-CREATE_hp|max|5 I have checked and rechecked the attribute name and there is no error anywhere, at least not that I could find.
This is not working and I can't find out why. OGL 5e module ToA !setattr --name @{selected|character_name} --modb --repeating_resource_$0_left|-1 Show but the character sheet still at 1 Full Macro I am using just incase !setattr --name @{selected|character_name} --modb --repeating_resource_$0_left|-1 !power {{ --emote|** @{selected|token_name} Unleashes a Breath Weapon** --tokenid|@{selected|token_id} --titlefontshadow|none --format|Conditions --corners|10 --name|Breath Weapon --leftsub|Black Dragon Acid --rightsub| 5' by 30' stream --Damage Type:| Acid --Save:| Dex Save vs [[ 8 + +@{selected|constitution_save_bonus} + @{selected|pb} ]] --Damage:|[[ 2d6 ]] --!|You can use this again: @{repeating_resource_$0_left} --Desc:|^* When you use your breath weapon, each creature in the area of the exhalation must make a saving throw, the type of which is determined by your draconic ancestry. The DC for this saving throw equals 8 + your Constitution modifier + your proficiency bonus. A creature takes 2d6 damage on a failed save, and half as much damage on a successful one. The damage increases to 3d6 at 6th level, 4d6 at 11th level, and 5d6 at 16th level. }}
1516693171
Jakob
Sheet Author
API Scripter
Because you're using the wrong attribute name, it should be repeating_resource_$0_resource_left
Jakob said: Because you're using the wrong attribute name, it should be repeating_resource_$0_resource_left Doh, thanks
1516719876
vÍnce
Pro
Sheet Author
Craven said: Jakob said: Because you're using the wrong attribute name, it should be repeating_resource_$0_resource_left Doh, thanks Welcome to the club Craven.  ;-P
1516771613
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Is this possible, and if not, can it be added: --append This would not overwrite an attribute, but merely place the argument at the end of what already exists. I am attempting to put together a series of macros to write race features to Shaped Sheet characters. Currently, when I put in languages, I have to overwrite what is already there. I tried to use --languages|@{selected|languages} Auran For example, so as not to overwrite the "Common" already there and replace it with "Common Auran", and it works, but not inside of a complex roll template, no matter how I jigger the html entities. If this is already possible (--mod doesn't seem like it would do it, though it is close), then how? If not, would it be tough to add?
1516780208
Jakob
Sheet Author
API Scripter
It's already possible: --languages|%languages% Auran
1516804755

Edited 1516805756
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hooray! Thanks. Did I totally miss that in the documentation? Hmm. The links in the OP are coming up 404. EDIT: Never mind, found it in the one click. I had been using the Github version.
Hi, I am re-posting this from a thread I made in the Pro forums. OK, so I am looking to be able to toggle the global_save_mod and global_attack_mod attributes with a macro to mimic Bless. So far I have Token_mod adding the 'all-for-one' statusmarker to up to three selected targets and outputting an emote but I would like to add the 'overdrive' statusmarker to the caster and toggle the mod fields to on with the appropriate information inside of them . This seems simple enough until you realize that each field is made up of the attribute boxes: 1: the global_attack_mod_flag field to enable the option on the cog page of the 5e OGL sheet 2: the global_attack_mod , which is the checkbox toggle to manually enable the modifier box on the sheet and 3: global_attack_mod_field which is what's entered in the modifier box. '1d4[BLESS]'. Considering 'global_attack_mod_flag' and 'global_attack_mod' are toggles you would assume that these boxes would only need to pass a TRUE or FALSE value (or 1 or 0), when the 'global_attack_mod' check box is checked the attribute becomes {{globalattack=[[@{global_attack_mod_field}]]}} and that's the trouble I am having. I am unable to pass the above code through ChatSetAttr to the global_attack_mod attribute without generating an error. I am unsure if I would need to make a change at the sheet level or if there are settings or code I could use in the ChatSetAttr script to pass this string or if there is any other way I could make this work. i would appreciate any help that you can offer. Thank you, Adrian
1518320843
GiGs
Pro
Sheet Author
API Scripter
Adrian, can you post the token mod code you have tried? In the meantime, here are some questions to help us figure out exactly what you are trying to do. The end paragraph in particular confuses me. It sounds like you need to do the following: set  global_attack_mod_flag to 1 set global_attack_mod  to 1 set global_attack_mod_field  to '1d4[Bless]' Is that correct? What is the relevance of this bit at the end? {{globalattack=[[@{global_attack_mod_field}]]}} What do you mean by "I am unable to pass the above code through ChatSetAttr to the global_attack_mod" ? Which code are you referring to? Isn't the  global_attack_mod  a checkbox?
G G said: Adrian, can you post the token mod code you have tried? In the meantime, here are some questions to help us figure out exactly what you are trying to do. The end paragraph in particular confuses me. It sounds like you need to do the following: set  global_attack_mod_flag to 1 set global_attack_mod  to 1 set global_attack_mod_field  to '1d4[Bless]' Is that correct? What is the relevance of this bit at the end? {{globalattack=[[@{global_attack_mod_field}]]}} What do you mean by "I am unable to pass the above code through ChatSetAttr to the global_attack_mod" ? Which code are you referring to? Isn't the  global_attack_mod  a checkbox? Thank you for responding G G. When you toggle the global_attack_mod field to 1 or when you toggle the check box in the 'Global attack modifier' field it replaces the 1 that you would expect in a toggle attribute with: {{globalattack=[[@{global_attack_mod_field}]]}} I can only assume this takes place at the HTML sheet coding level. I have attempted using : !setattr --sel --silent --nocreate --global_attack_mod|1 //this doesn't effect the change, although it does swap global_attack_mod to 1 and !setattr --sel --silent --nocreate --global_attack_mod|'{{globalattack=[[@{global_attack_mod_field}]]}}' //This generates the error 'TypeError: c is undefined' *Have tried single and double quotations as well as including --noreplace in the code string.
1518334374

Edited 1518338279
GiGs
Pro
Sheet Author
API Scripter
Ah I see. A checkbox can have a value other than 1, so it's value is 0, or this other value. With this checkbox having a value of "{{globalattack=[[@{global_attack_mod_field}]]}}" I have no idea how you would set that in chatsetattr. Hopeful Jakob can solve that.
1518337527
Jakob
Sheet Author
API Scripter
On the phone, but this should work --global_attack_mod|{{globalattack=[\lbrak\at{global_attack_mod_field}]\rbrak}} --replace
Thank you Jakob! so the current macro is: !token-mod --set statusmarkers|+all-for-one !setattr --sel --silent --nocreate --global_save_mod_field|'1d4[BLESS]' !setattr --sel --silent --nocreate --global_save_mod|{{global=[\lbrak\at{global_save_mod_field}]\rbrak}} --replace !setattr --sel --silent --nocreate --global_attack_mod_field|'1d4[BLESS]' !setattr --sel --silent --nocreate --global_attack_mod|{{globalattack=[\lbrak\at{global_attack_mod_field}]\rbrak}} --replace and it works, however I need to click the macro twice to effect the change to the global_attack_mod field. The first time triggers a 0 state and the second time inserts '{{globalattack=[[@{global_attack_mod_field}]]}}'.  Is this a limitation within the macro? or sequencing? or something else?
1518452215
Jakob
Sheet Author
API Scripter
That's odd. What do you mean by "triggers a 0 state"? What's ChatSetAttr's output when you remove the --silent?