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

Global AC Modifier Field button REQUEST

Would someone help with a chat window button that activates/deactivates a Global AC Modifier Field? Thank you!
1722632949

Edited 1722633064
Gauss
Forum Champion
Hi Barry S.,  I see you have a Pro account, are you the game owner? If so you will need the Mod (API Script) ChatSetAttr to do this.  Assuming you are using D&D (2014) (formerly known as D&D 5e by Roll20) then I would also recommend Inspector in order to find the name of various elements on the sheet.  With Inspector installed in your API Sandbox:  step 1: select token step 2: enter into chat box: !inspect --selected step 3: click the cog on the "_id" line step 4: click the cog on the "represents" line (about halfway down) step 5: click on the 3 lines icon (at the bottom) step 6: click "view" on desired repeating list step 7: click "view" on desired repeating item. step 8: hover over the id codes, find the one that has the section I want, hit view on that. Copy the code. Note: step 7 may take a bit of looking around, playing with values etc.  So, in this particular case I got: "repeating_acmod_-O3JoNC3Ykc0Jv61WnU4_global_ac_active_flag" I turn that into an attribute: "@{charactername|repeating_acmod_-O3JoNC3Ykc0Jv61WnU4_global_ac_active_flag}" (where charactername is the name of the character) Then I test it in chat. If checked I should get a value of 1, if unchecked I get a value of 0.  Then I flip the checkmark and test again. Now I should get the other result.  Next, I can replace the unique identifier with the generic identifier if I want.  Example: " @{charactername|repeating_acmod_$0_global_ac_active_flag}" Where $0 is the first Global AC modifier in the list.  Now I am ready to use ChatSetAttr:  For on:  !setattr --sel --nocreate --repeating_acmod_$0_global_ac_active_flag|1 For off:  !setattr --sel --nocreate --repeating_acmod_$0_global_ac_active_flag|0 Notes: You can replace --sel with --name charactername, or leave it as is.  I recommend leaving --nocreate there, just as a safety measure.  There is a way to use the existing state to make it so it is a single command to toggle, but I am forgetting what it is right now. If I remember I will update. 
Thank you Gauss!!!  This is EXACTLY what I was looking to do. :)
Gauss said: Now I am ready to use ChatSetAttr:  For on:  !setattr --sel --nocreate --repeating_acmod_$0_global_ac_active_flag|1 For off:  !setattr --sel --nocreate --repeating_acmod_$0_global_ac_active_flag|0 Notes: There is a way to use the existing state to make it so it is a single command to toggle, but I am forgetting what it is right now. If I remember I will update.  [[1-@{selected|repeating_acmod_$0_global_ac_active_flag}]] should work as a toggle.  If the current value is 1, then you get 1-1=0. If the current value is 0, then you get 1-0=1.  !setattr --sel --nocreate --repeating_acmod_$0_global_ac_active_flag|[[1-@{selected|repeating_acmod_$0_global_ac_active_flag}]]
1722714231
Gauss
Forum Champion
Thanks Jarren, my brain was mush and I couldn't remember it. :)