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

Setting the Checkbox for a Skill on the OGL 5.0 Sheet with an Ability

I've been trying to use an ability (macro) to set skill proficiency for a character.  I'm using Chatsetattr, and I've been able to modify the skill so it functions correctly.  But I cannot for the life of me get the checkbox to show that the character is proficient with the skill.  The field seems to be skill_prof, but it wont set the checkbox.  I tried attr_skill_prof and skill_type, which I got from inspecting those sheets, but those just create new attributes that do nothing. Thanks for any help!
Assuming you mean the 'D&D 5E by Roll20' sheet, then you need to get the value of the proficiency attribute, and use the --replace functionality. For example, to toggle Arcana proficiency on, you would use: !setattr --sel --replace --arcana_prof|(\at{pb}*\at{arcana_type}) And to turn it off you would use (--replace is optional here):  !setattr --sel --replace --arcana_prof|0 So you could create a query for this to toggle a selection on or off (with html replacements to use the result of the ?{Which Ability?} query again inside the ?{On or off?} query): ! ?{Which Ability?|Acrobatics,acrobatics|Animal Handling,animal_handling|Arcana,arcana|Athletics,athletics|Deception,deception|History,history|Insight,insight|Intimidation,intimidation|Investigation,investigation|Medicine,medicine|Nature,nature|Perception,perception|Performance,performance|Persuasion,persuasion|Religion,religion|Sleight of Hand,sleight_of_hand|Stealth,stealth|Survival,survival} ?{On or off?|On,(\at{pb\rbrace*\at{?{Which Ability?}_type\rbrace)|Off,0} !setattr --sel --replace --?{Which Ability?}_prof|?{On or off?}
1717296924

Edited 1717297092
I could make your suggestion work, but what I needed was to copy the status from another sheet, such as !setattr --silent --charid @{character_name|character_id}  --arcana_bonus|@{target|Wielder?|arcana_bonus}  --arcana_type| @{target|Wielder?|arcana_type}   --arcana_prof|@{target|Wielder?|arcana_prof}  This sets up the stats properly with the proper bonus, but the check box isn't checked.  I couldn't target another sheet using your syntax.
Andrew K. said: I could make your suggestion work, but what I needed was to copy the status from another sheet, such as Another sheet? Which character sheet are you using? If you're not sure then please provide a screenshot. Or do you mean you want to copy the proficiency from one character to another character? If you could explain what you're trying to do, without using any Roll20 commands, that might be helpful. (E.g., CharacterA has an ability to borrow the proficiency from another character temporarily, so I want to mark Character A's sheet with the same bonus as Character B.) I'm not understanding what you're trying to do.
Sorry, I'm copying the status of proficiencies from one  D&D 5E by Roll20 to another  D&D 5E by Roll20 character sheet.  I have a complicated magical item that, in order to avoid cluttering up the main character's sheet, got its own character sheet (item has a player character sheet).  The player uses the item's sheet when using an item ability, but the rolls are all tied to the attuned character.  I have an attunement button that copies the relevant information to the item's sheet.  This all works except for the proficiency check box. Thanks for the help!
1717353986

Edited 1717451346
This may be a silly question, but why are you copying anything from the character to the magic item? Why not just fill out the magic item's sheet with the character's information to begin with?  Or if the item is used by different characters, then you could have a separate item for each character with their individual stats. I'm guessing I don't have the full story, or there's some other mechanism that needs to be addressed.   Or the item is intended to have its own stats that don't change, but to be able to simply roll using the character's stats, then that's going to require a different solution. The sheetworkers know to set the checkbox to 'checked' when the value of ' arcana_prof' is ' @{pb}*@{arcana_type}'.  To set the checkbox for Arcana, the 'arcana_prof' attribute has to be exactly : "@{pb}*@{arcana_type}". Not the values that result from calling 'pb' and 'arcana_type', but the words that will call those attributes . That's why I had the --replace function with the \at replacements in the command.  Setting the checkbox has to be exactly "--arcana_prof|(\at{pb}*\at{arcana_type})". This is what the attribute looks like on the Attributes & Abilities tab: You were setting it using this command:  --arcana_prof|@{target|Wielder?|arcana_prof} which is going to resolve as the values of the target's arcana_prof, and not the formula . If the target's 'arcana_prof' is (3*1), then the resulting ChatSetAttr command becomes  --arcana_prof| (3*1) and not  --arcana_prof| @{pb}*@{arcana_type} .  You can test this by simply running the call without the ChatSetAttr portion:  @{target|Wielder?|arcana_prof} will result in the chat as (3*1), not  @{pb}*@{arcana_type}. If you use this, then the magic item's Arcana will be checked, but it will not use the wielder's stats: !setattr --charid @{MagicItem|character_id} --replace --arcana_prof|(\at{pb}*\at{arcana_type}) In order for the magic item to have the wielder's proficiency in arcana, as well as using the wielder's stats, then you have to adjust the magic item's intelligence and proficiency bonus to match the wielder.  When an Arcana check is made, the sheetworkers don't use a static value - they pull the intelligence and proficiency bonus values from the sheet to create the roll dynamically.  So if you use this command for the magic item (replace 'MagicItem' for the name of the magic item) the it will substitute the wielder's intelligence and proficiency bonus score to the magic item, and check the checkbox for Arcana: !setattr --charid @{MagicItem|character_id}  --replace --arcana_prof|(\at{pb}*\at{arcana_type}) --intelligence_base|@{target|Wielder|intelligence_base} --pb|@{target|Wielder|pb} Does that make sense? 
1717359546

Edited 1717451419
If you're not able to simply fill out the MagicItem stats to be the same as the wielder's stats, then you're going to need a conditional way of determining which skills to add proficiency or not from the character.  It may not be possible with only ChatSetAttr, and you might need to add APILogic scripting as well. Edit: Solved below in next comment. This is almost there, but the \ symbol is getting parsed out by APILogic: !setattr --charid @{MagicItem|character_id}  --replace {& if @{target|Wielder|pb} = 0} --arcana_prof|0 {& else} --arcana_prof|(\at{pb}*\at{arcana_type}) --intelligence_base|@{target|Wielder|intelligence_base} --pb|@{target|Wielder|pb} {& end} I'll take another look when I'm back home, or maybe Timmaugh will jump in with a quick solution to keep that from happening.
It looks like simply adding a second deferral character ' \ ' will make it work: !setattr --charid @{MagicItem|character_id} --replace {& if "@{target|Wielder|arcana_prof}" = "0"} --arcana_prof|0 --intelligence_base|10 --pb|2 {& else} --arcana_prof|(\\at{pb}*\\at{arcana_type}) --intelligence_base|@{target|Wielder|intelligence_base} --pb|@{target|Wielder|pb} {& end} This will correctly change the intelligence score, proficiency bonus, and arcana proficiency checkbox for a character named 'MagicItem' if the targeted character has proficiency in Arcana.  It will reset the intelligence score to 10, PB to 2, and uncheck the Arcana checkbox if the targeted character does not have proficiency in Arcana. If you want to run this for all abilities, then you'd just need to copy/paste the example section starting and ending with {& if ... } to {& end} with the names for each ability and related ability score type. I'm not sure what you want to do with the MagicItem's 'natural' ability scores - again, in this case I had intelligence reset to '10'. Or if the MagicItem should always keep its own stats (intelligence, strength, etc. as well as proficiency bonus) then it's a slightly simpler logic to just flip the checkboxes on/off to match the targeted character. !setattr --charid @{MagicItem|character_id} --replace {& if "@{target|Wielder|arcana_prof}" = "0"} --arcana_prof|0 {& else} --arcana_prof|(\\at{pb}*\\at{arcana_type}) {& end} There's probably a way to use Fetch or Plugger to write a single line that would evaluate each ability _prof in that way to toggle them all at the same time to match the targeted character, but that would definitely need Timmaugh to help explain.
1717445351
timmaugh
Pro
API Scripter
Nice work with APILogic, Jarren! And, yeah, once we add a metascript construction into the command line, ZeroFrame will "un-defer" the line as it sends the message for another loop. The un-deferral removes one level of backslashes, so that's why you need that extra one. You could do this with *just* APILogic and not need the extra backslash... but since we're looking to expand this with other metascripts, let's just assume that we start with the full Metascript Toolbox installed. As for expanding this to all abilities, that's very doable, but as I'm not a 5E player you'll have to fill in some information (or correct me as I lay out different approaches for different circumstances). Let's say all of the abilities that you want to do this for have a similar naming convention for the attributes: ability_prof ability_type ...where we replace "ability" with something like "arcana", but they all follow this pattern. In that case, we can use a Fetch construction where we have a query for the "seed" portion of the name. We'd also change our targeting statement to return the ID of the token. That way, the targeting handles our token identification, but the query provides the name of the ability. This works in Fetch because it doesn't mind nesting, and because it runs after both the queries and targeting statements resolve. Our query would look something like this (with real abilities, of course): ?{Ability name|Arcana,arcana|Lamp Husbandry,lamphusbandry|Omphaloskepsis,omphaloskepsis} Then, we replace the targeting statement returning the prof bonus with a Fetch construction. That would look like: @(@{target|Wielder|token_id}.?{Ability name |Arcana,arcana|Lamp Husbandry,lamphusbandry|Omphaloskepsis,omphaloskepsis }_prof) The targeting statement returns the token id, which lets Fetch identify the associated character, and we return the prof bonus you select. Later in the command line, we can replace any reference to "arcana" with "?{Ability name}", so that the returned ability name is used -- even for where we refer to the "type". Again, this is for where the naming of the properties follows the same pattern for both _prof and _type. If they don't follow that same pattern for all abilities, then we'll need to use another trick to make them work. In fact, I'm thinking that the reference to the "pb" attribute might change for different abillities (to refer to a different attribute for each...?). If so, that's another place where we'd need to use that same extra trick to get the right information. I'll leave it off this message just so as to not confuse everything, but if either of those cases are true (either the attributes follow different naming patterns or there is a different associated attribute for each ability), post back and I'll show the other piece you'd need.
1717451140

Edited 1717452166
I'll need Andrew K. to clarify if he only needs the MagicItem Skill checkboxes to be checked to match the target character, or if the MagicItem needs its Ability scores to be adjusted to match the target character as well. In D&D 5th Edition there are 6 Ability Scores, and 18 Skill Checks, and each Skill Check has a default Ability Score that it is tied to. (You can use alternate Ability Scores for Skill Checks, but that isn't relevant for what is being done here.) Ability Scores : Strength, Dexterity, Constitution, Intelligence, Wisdom, Charisma Skill Checks : Acrobatics, Animal Handling, Arcana, Athletics, Deception, History, Insight, Intimidation, Investigation, Medicine, Nature, Perception, Performance, Persuasion, Religion, Sleight of Hand, Stealth, Survival Skill Checks by default Ability Scores :     Strength: Athletics     Dexterity: Acrobatics, Sleight of Hand, Stealth     Constitution: (none)       Intelligence: Arcana, History, Investigation, Nature, Religion      Wisdom: Animal Handling, Insight, Medicine, Perception, Survival      Charisma: Deception, Intimidation, Performance, Persuasion Proficiency Bonus is level based, and the attribute is always simply named 'pb'. On the 'D&D 5E by Roll20' sheet, each Skill Check has a checkbox for whether the character is proficient in that skill or not, with a related attribute that is named 'SKILL_prof', such as 'athletics_prof', 'acrobatics_prof', 'sleight_of_hand_prof', etc. (Sleight of Hand and Animal Handling have spaces in the name, which are replaced with underscore characters in the attributes names.) A value of '0' is not proficient, and the checkbox shows as unchecked.  A value of ' (@{pb}*@{SKILL_type})' is proficient, and the checkbox shows as checked. The naming convention is maintained throughout for each of the 18 Skills. Instead of using a query, I'm pretty sure the goal is to have a single Mod command that will replace all of the MagicItem's Skill Check proficiencies with the target character's Skill Check proficiencies. I wasn't sure if there was way to write a command that would check each Skill Check proficiency on TargetCharacter, and toggle the corresponding Skill Checks on MagicItem to match.  I'm not sure if MetaScripts would be able to search through all of the TargetCharacter's attributes and find all of them that end in '_prof' and then copy the value of those onto MagicItem.  I'm guessing it is possible, but since the attributes don't change, then Andrew K. can use this command: But it could be done with a single static command like this, where each Skill is listed inside it's own {& if} ... {& else} {& end} construction: !setattr --silent --charid @{MagicItem|character_id} --replace {& if "@{target|Wielder|acrobatics_prof}" = "0"} --acrobatics_prof|0 {& else} --acrobatics_prof|(\\at{pb}*\\at{acrobatics_type}) {& end}{& if "@{target|Wielder|animal_handling_prof}" = "0"} --animal_handling_prof|0 {& else} --animal_handling_prof|(\\at{pb}*\\at{animal_handling_type}) {& end}{& if "@{target|Wielder|arcana_prof}" = "0"} --arcana_prof|0 {& else} --arcana_prof|(\\at{pb}*\\at{arcana_type}) {& end}{& if "@{target|Wielder|athletics_prof}" = "0"} --athletics_prof|0 {& else} --athletics_prof|(\\at{pb}*\\at{athletics_type}) {& end}{& if "@{target|Wielder|deception_prof}" = "0"} --deception_prof|0 {& else} --deception_prof|(\\at{pb}*\\at{deception_type}) {& end}{& if "@{target|Wielder|history_prof}" = "0"} --history_prof|0 {& else} --history_prof|(\\at{pb}*\\at{history_type}) {& end}{& if "@{target|Wielder|insight_prof}" = "0"} --insight_prof|0 {& else} --insight_prof|(\\at{pb}*\\at{insight_type}) {& end}{& if "@{target|Wielder|intimidation_prof}" = "0"} --intimidation_prof|0 {& else} --intimidation_prof|(\\at{pb}*\\at{intimidation_type}) {& end}{& if "@{target|Wielder|investigation_prof}" = "0"} --investigation_prof|0 {& else} --investigation_prof|(\\at{pb}*\\at{investigation_type}) {& end}{& if "@{target|Wielder|medicine_prof}" = "0"} --medicine_prof|0 {& else} --medicine_prof|(\\at{pb}*\\at{medicine_type}) {& end}{& if "@{target|Wielder|nature_prof}" = "0"} --nature_prof|0 {& else} --nature_prof|(\\at{pb}*\\at{nature_type}) {& end}{& if "@{target|Wielder|perception_prof}" = "0"} --perception_prof|0 {& else} --perception_prof|(\\at{pb}*\\at{perception_type}) {& end}{& if "@{target|Wielder|performance_prof}" = "0"} --performance_prof|0 {& else} --performance_prof|(\\at{pb}*\\at{performance_type}) {& end}{& if "@{target|Wielder|persuasion_prof}" = "0"} --persuasion_prof|0 {& else} --persuasion_prof|(\\at{pb}*\\at{persuasion_type}) {& end}{& if "@{target|Wielder|religion_prof}" = "0"} --religion_prof|0 {& else} --religion_prof|(\\at{pb}*\\at{religion_type}) {& end}{& if "@{target|Wielder|sleight_of_hand_prof}" = "0"} --sleight_of_hand_prof|0 {& else} --sleight_of_hand_prof|(\\at{pb}*\\at{sleight_of_hand_type}) {& end}{& if "@{target|Wielder|stealth_prof}" = "0"} --stealth_prof|0 {& else} --stealth_prof|(\\at{pb}*\\at{stealth_type}) {& end}{& if "@{target|Wielder|survival_prof}" = "0"} --survival_prof|0 {& else} --survival_prof|(\\at{pb}*\\at{survival_type}) {& end} This command only  makes the MagicItem Skill Check checkboxes match the TargetCharacter's Skill Check checkboxes, but doesn't adjust the related Ability Score or Proficiency Bonus values, which can fairly easily be added as well. Adding Ability Scores and Proficiency Bonus to have MagicItem match the TargetCharacter is much simpler and would just require adding this at the end: --strength_base|@{target|Wielder|strength_base} --dexterity_base|@{target|Wielder|dexterity_base} --constitution_base|@{target|Wielder|constitution_base} --intelligence_base|@{target|Wielder|intelligence_base} --wisdom_base|@{target|Wielder|wisdom_base} --charisma_base|@{target|Wielder|charisma_base} --pb|@{target|Wielder|pb} Then if the MagicItem needs to have a 'reset' set of values, that could be done with a fairly simple ChatSetAttr command as well (setting everything to '0'): !setattr --silent --charid @{MagicItem|character_id} --replace --acrobatics_prof|0 --animal_handling_prof|0 --arcana_prof|0 --athletics_prof|0 --deception_prof|0 --history_prof|0 --insight_prof|0 --intimidation_prof|0 --investigation_prof|0 --medicine_prof|0 --nature_prof|0 --perception_prof|0 --performance_prof|0 --persuasion_prof|0 --religion_prof|0 --sleight_of_hand_prof|0 --stealth_prof|0 --survival_prof|0 --strength_base|0 --dexterity_base|0 --constitution_base|0 --intelligence_base|0 --wisdom_base|0 --charisma_base|0 --pb|0 With all that said, it was a fun exercise to figure out how to use some MetaScripts a bit more.  But in the end, it might be easiest to simply create seperate MagicItem character sheets for each TargetCharacter and not have to worry about swapping anything between sheets! ;D 
I already had copied over the stats and the proficiency bonus, as well as the skill bonuses and type.  I used the following script command to test the skill proficiency !setattr --charid @{Ring of the Artificer|character_id} --replace {& if "@{target|Wielder?|arcana_prof}" = "0"} --arcana_prof|0 {& else} --arcana_prof|(\\at{pb}*\\at{arcana_type}) {& end} what arcana_prof got set to was (\\at{pb}*\\at{arcana_type}) {& end} I'm assuming I don't have the mod installed for the conditionals.  What mod is that? Thanks for all the work you've put into this.
1717516017

Edited 1717534916
The scripts are called 'APILogic' and 'ZeroFrame' and they are in the one-click repository.  Or you can simply install the 'Metascript Toolbox' and it will install all of Timmaugh's scripts (including APILogic, Plugger, Muler, Fetch, etc.). (Edit: thanks for clarifying the specific Metascripts being used, Timmaugh! I thought APILogic was handling everything.)
1717528312
timmaugh
Pro
API Scripter
Just to be clear, again... the way Jarren has this code written is for a situation where you DO have the full Metascript Toolbox installed. In that situation, when some metascript does work (like APILogic detecting the conditional tags in the command line and evaluating them), another metascript (ZeroFrame) removes one backslash from anywhere in the line that it detects a series of backslashes... so 4 backslashes become 3, 5 backslashes become 4, or 2 backslashes become 1, etc. After that, the metascripts get another chance to do more work in the command line (maybe removing a backslash has now exposed a metascript tag). That cycle continues until there is no more work that needs doing in the line, then the message is released to standard scripts (like ChatSetAttr). So if you have ZeroFrame installed (as a part of the Metascript Toolbox), you need to anticipate that backslashes will be removed, and "pad" those places in your command line with backslashes equal to the number of metascript cycles you'll trigger. In the command line Jarren gave you, there is only one cycle required: once APILogic evaluates and removes the IF tags, there is no other tag left to trigger a metascript. So, one cycle = +1 backslash... so: \at ...becomes... \\at If you DON'T install the full Toolbox (and only go with APILogic), then you won't run into this situation. In that case you'd need to change Jarren's command line to have 1-fewer backslash everywhere you see one in the command line. But, really... why would you do that? The metascripts expand the functionality of other scripts (like here, where we've added conditional evaluation to a script that otherwise doesn't have it). Once you start to use the metascripts, you see how helpful they can be.