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

SetChatAttr in Powercards

Writing a conditional to toggle off a checkbox. Basically the effect is that ifthe weapon is identified as being 2 handed then the macro/powerward will automatically deactivate the character's shield. This is how it looks --?? @{selected|WeaponTrait_1} == * ?? api_setattr|_sel _ShieldReady|0 _mute I also tried --?? @{selected|WeaponTrait_1} == * ?? api_setattr|_name @{selected|token_name} _ShieldReady|0 _mute As a checkbox option on the character sheet the sheildready has only two options, 0 and 1. But shoud I be using on or off code or is something else wrong? I know alterbars requires each alterbar to be labelled differently (alterbars1, alterbars2 etc) is that the same for setchatattr?
1617897580

Edited 1617898489
Andreas J.
Forum Champion
Sheet Author
Translator
I think this could have something to do with how the token "selection" doesn't properly carry over from one API the other. Try use the tokenid or something if it might work. This might help for that: Character and Token ID Lookup Macro IIRC the SelectManager API is made to fix issues when it comes to token selection, so installing and configuring it might solve the actual issue, rather than doing the workaround with TokenID. Edit: SelectManager is the fix you're looking for: SelectManager: EXAMPLE: You have a PowerCards macro that you build to launch a ChatSetAttr call. Because this is one script calling another, the ChatSetAttr message is generated by the API and the array of selected tokens is lost. Since ChatSetAttr works on the token currently selected, the call won’t work properly. Installing SelectManager, however, will make this situation work, even without a single change to your macro . I updated the PowerCards wiki page to mention this issue. When you figure it out, please share how the macro ended up so we can add the example there for others to learn from: <a href="https://wiki.roll20.net/Script:PowerCards#Advanced_API_Usage" rel="nofollow">https://wiki.roll20.net/Script:PowerCards#Advanced_API_Usage</a>
Changed it to @{selected|character_name} and seems to work now.