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

Simple chatsetattr question.

Is there a way to have chatsetattr set the value based on a die roll? For example, I want a variable passive perception roll to be made every time a character rolls initiative that resets their passive peception which is hidden on a tab players don't have access to. This way their passive perception isn't a fixed number (lets face it, with passive perception as a fixed number I pretty much get free will to decide if they can percieve something or not and I want it to be a little bit more random). Something like !setattr --sel --passiveperception|[[1d20 +@{selected|WisdomMod} ]]
1619320878
timmaugh
Pro
API Scripter
Does ChatSetAttr not unpack the rolls automatically? If not, you can use ZeroFrame and tack on .value to the inline roll: !setattr --sel --passiveperception|[[1d20+@{selected|WisdomMod}]].value
As someone who has done something similar, you will find that you also need to set the max field for the passive_wisdom attribute so you can effectively use the chatsetattr reset option.  
ZeroFrame worked great. However it seemed to cause issues with my other API and Macros. Maybe I used an older code? Can you provide a link to the most recent version? timmaugh said: Does ChatSetAttr not unpack the rolls automatically? If not, you can use ZeroFrame and tack on .value to the inline roll: !setattr --sel --passiveperception|[[1d20+@{selected|WisdomMod}]].value
1619407101
timmaugh
Pro
API Scripter
The most recent version (as of this post) of ZeroFrame is v1.0.1. All versions can be found at this link . What other issues did it cause?
It was preventing powercards from calling up macros. Once I disabled Zeroframe everything started working again.
These are the two errors I recieved when trying ot use my powercards while ZeroFrame was enabled. Once it was disabled everythign worked as normal. SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "$" found. undefined SyntaxError: Expected "[" but "X" found. undefined
1619408937
timmaugh
Pro
API Scripter
OK, I just tried PowerCards and ZeroFrame together, and had no issue. I'm using the latest version of ZF and PowerCards from the one-click. The first error you note (above) is usually triggered when an inline roll is formatted in a way that would work from the chat, but won't from the API. And ZeroFrame is definitely sending messages. Can you share the PowerCard macro you're using so I can see what might be causing the problem?
This is the main one that won't work. But I am not worried about it. If the only think I am using ZeroFrame for is to get a die roll to work in chatsetattr it doesn't seem worthwhile to debug and rewrite all my other macros to accomodate one thing. !power {{ --name|@{selected|token_name} Combat Options --tokenid|@{selected|token_id} --whisper|@{selected|token_name} --leftsub|Attack Bonus: @{selected|bth} --rightsub|Armor Class: [[ [TXT] 1d0+@{selected|ac} ]] --!tag0a|~C [**Combat Options**](!
#Combat-Options) ~C --!tag0b|~C**Basic Attacks**~C --?? @{selected|WeaponName_1} <> Disarmed AND @{selected|WeaponName_1} <> Empty AND @{selected|WeaponRange_1} == 0 ?? !tag1a|~C [**@{selected|WeaponName_1}**](!
#Weapon-1) ~C --?? @{selected|WeaponName_1} <> Disarmed AND @{selected|WeaponName_1} <> Empty AND @{selected|WeaponRange_1} <> 0 ?? !tag1b|~C [**@{selected|WeaponName_1}**](!
#Weapon-1b) ~C --?? @{selected|WeaponName_1} == Disarmed ?? !tag1c|~C [**Recover-Weapon**](!
#Recover_Weapon) ~C --?? @{selected|WeaponName_2} <> Disarmed AND @{selected|WeaponName_2} <> Empty AND @{selected|WeaponRange_2} == 0 ?? !tag2a|~C [**@{selected|WeaponName_2}**](!
#Weapon-2) ~C  --?? @{selected|WeaponName_2} <> Disarmed AND @{selected|WeaponName_2} <> Empty AND @{selected|WeaponRange_2} <> 0 ?? !tag2b|~C [**@{selected|WeaponName_2}**](!
#Weapon-2b) ~C  --?? @{selected|WeaponName_2} == Disarmed ?? !tag2c|~C [**Recover-Weapon**](!
#Recover_Weapon) ~C --?? @{selected|WeaponName_3} <> Disarmed AND @{selected|WeaponName_3} <> Empty AND @{selected|WeaponRange_3} == 0 ?? !tag3a|~C [**@{selected|WeaponName_3}**](!
#Weapon-3) ~C --?? @{selected|WeaponName_3} <> Disarmed AND @{selected|WeaponName_3} <> Empty AND @{selected|WeaponRange_3} <> 0 ?? !tag3b|~C [**@{selected|WeaponName_3}**](!
#Weapon-3b) ~C --?? @{selected|WeaponName_3} == Disarmed ?? !tag3c|~C [**Recover-Weapon**](!
#Recover_Weapon) ~C --?? @{selected|WeaponName_4} <> Disarmed AND @{selected|WeaponName_4} <> Empty AND @{selected|WeaponRange_4} == 0 ?? !tag4a|~C [**@{selected|WeaponName_4}**](!
#Weapon-4) ~C --?? @{selected|WeaponName_4} <> Disarmed AND @{selected|WeaponName_4} <> Empty AND @{selected|WeaponRange_4} <> 0 ?? !tag4b|~C [**@{selected|WeaponName_4}**](!
#Weapon-4b) ~C --?? @{selected|WeaponName_4} == Disarmed ?? !tag4c|~C [**Recover-Weapon**](!
#Recover_Weapon) ~C --?? @{selected|WeaponName_5} <> Disarmed AND @{selected|WeaponName_5} <> Empty AND @{selected|WeaponRange_5} == 0 ?? !tag5a|~C [**@{selected|WeaponName_5}**](!
#Weapon-5) ~C --?? @{selected|WeaponName_5} <> Disarmed AND @{selected|WeaponName_5} <> Empty AND @{selected|WeaponRange_5} <> 0 ?? !tag5b|~C [**@{selected|WeaponName_5}**](!
#Weapon-5b) ~C --?? @{selected|WeaponName_5} == Disarmed ?? !tag5c|~C [**Recover-Weapon**](! #Recover_Weapon) ~C --?? @{selected|WeaponName_6} <> Disarmed AND @{selected|WeaponName_6} <> Empty AND @{selected|WeaponRange_6} == 0 ?? !tag6a|~C [**@{selected|WeaponName_6}**](!
#Weapon-6) ~C --?? @{selected|WeaponName_6} <> Disarmed AND @{selected|WeaponName_6} <> Empty AND @{selected|WeaponRange_6} <> 0 ?? !tag6b|~C [**@{selected|WeaponName_6}**](!
#Weapon-6b) ~C --?? @{selected|WeaponName_6} == Disarmed ?? !tag6c|~C [**Recover-Weapon**](!
#Recover_Weapon) ~C --!tag7|~C [**Pummelling**](!
#Unarmed-Pummeling) ~C --!tag8|~C [**Grappling**](!
#Unarmed-Grappling) ~C  --!tag9|~C [**Overbearing**](!
#Unarmed-Overbearing) ~C  }}
1619446073

Edited 1619446106
timmaugh
Pro
API Scripter
No, no, just the opposite. I was hoping to see what you had so I could better train ZeroFrame to be more polite, then all of your macros would work straight away, without change. =D I'll let you know what I find. Thanks...
Cool. In the mean time, this does work. !modattr --sel --passiveperception|[[1d20+@{selected|WisdomMod} +@{selected|Level} +@{selected|ElfRace} +@{selected|ElfRace} +@{selected|HalfElfRace} +@{selected|DwarfRace} -@{selected|passiveperception}]] 
1619447904

Edited 1619447999
I use Group check to roll all my players(and their minions) perception and investigation rolls to myself whenever I want to not use the passives.  Which is virtually all the time since its so easy to do it with groupcheck api.  The key is to set the characters tokens up on a hidden page or your storage page and never delete or change them, they keep their same token ID's and your macro never breaks.  Then set the macro to roll those specific token id's sheets.  
1619470034
timmaugh
Pro
API Scripter
What game system are you running, Peacekeeper? I ask because I can make your PowerCard run in a test game with ZeroFrame, but I had to add the specified attributes to a character sheet of some other system... so I'm sure I'm either not leveraging them the way you are (including rolls or roll templates in the right locations), or the sheet itself isn't populating them correctly. But the menu itself will come up. Was this the macro that would fail, or the created buttons on the card that threw the error? Or, if you want to throw me an invite/promote me, I can jump in and see what you have going and see if I can catch what is going sideways.
I run Castles and Crusades with a custom sheet. I just disabled zeroframe and found a way to use modserattr so the issue on my end is resolved unless I find another user for ZeroFrame. Honestly my sheet is a mess because o really have no idea what I'm doing lol