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 .
×

ChatSetAttr Using !delattr to Delete a Single Attribute in a Repeating Row

1789593889

Edited 1789593908
I have developed a transfer items script that has been working nicely. However, when I review the transferred equipment item on the character sheet (Advanced D&D 1e in this case), it has a red border. See the example screen shot: I've compared the list of attributes for equipment that have been entered on the character sheet versus an piece of equipment I have transferred. The latter has 4 extra attributes, one of which is:         repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_mod_error The suffix _error is not in any other attributes, so I'd like to try removing this attribute from a transferred item to see if that makes a difference in the red outline. I've never used !delattr before and am extremely unsure how to use it.  Using the character ID, -OcDaqKQXSH4zFPblN5i, I have gotten this far.         !delattr  --charid -OcDaqKQXSH4zFPblN5i But I have no idea what prefix (like --charid above) to put in front of the attribute I want to delete (repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_mod_error). Any ideas? FWIW, this is how I am getting lists of attributes: on("chat:message", function(msg) { if (msg.type !== "api") return; let args = msg.content.trim().split(/\s*--/); if (args[0].toLowerCase() !== "!testrepeatingrow") return; //Make sure user is DM let charID = args[1]; let section = args[2]; let eqID = args[3]; let charName = getAttrByName(charID, "character_name") if (!playerIsGM(msg.playerid)) { sendChat(charName + " DM Equipment Info", `/w "${charName}" ` + "<div style='color:red'> Sorry, Tim could not make this invisible to you, but this is " + "GM only and just writes a bunch tech stuff about this equipment in the 'Code Reader' part of Roll20 " + "which you can't see anyway.</div>") return; } //Two spaces frst: log(""); log(""); //Title log(section + " Attributes: " + getAttrByName(charID, "character_name") + " - " + getAttrByName(charID, `repeating_equipment_${eqID}_equipment_item`)); fListRepeatingRow(charID, section, eqID); }); //////////////////////////////////////////////////////////////////////////////// //Documenting attributes in a repeating value function fListRepeatingRow(charID, section, rowID) { const prefix = `repeating_${section}_${rowID}_`; const attrs = findObjs({ _type: "attribute", _characterid: charID }) .filter(attr => attr.get("name").startsWith(prefix)) .sort((a, b) => a.get("name").localeCompare(b.get("name")) ); log("----- " + prefix + " -----"); attrs.forEach(attr => { log( attr.get("name") + " | current: [" + attr.get("current") + "]" + " | max: [" + attr.get("max") + "]" ); }); log("----------------------------"); }
1789627054

Edited 1789627794
vÍnce
Pro
Sheet Author
Hi Tim, Can't you just include the attribute? !delattr  --charid -OcDaqKQXSH4zFPblN5i --repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_mod_error FYI: equipment_armor_mod_error (and equipment_armor_magic_error) are simply hidden attributes that are used in sheetworkers to validate the field (although it doesn't seem to be working for these 2 inputs at the moment. I'll fix that...)  I use this type of validation on numerous fields on the sheet. The hidden "..._error" attribute simply toggles CSS to add a red dashed border around the field to indicate the value is not valid.  I doubt these attributes have any relation to the repeating row errors you are seeing.  Those repeating rows are being flagged by roll20 for some reason.  IME it's often a rowID issue related to case.  I believe the HTML uses/requires the mixed case rowID.  Using inspect element on a 1e character's equipment for example is all mixed-case; Setting a new repeating row with a normalized rowID (not sure if that's happening in your mod...?) may be causing the red border from roll20.
1789656402

Edited 1789656515
vÍnce said: Hi Tim, Can't you just include the attribute? !delattr  --charid -OcDaqKQXSH4zFPblN5i --repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_mod_error FYI: equipment_armor_mod_error (and equipment_armor_magic_error) are simply hidden attributes that are used in sheetworkers to validate the field (although it doesn't seem to be working for these 2 inputs at the moment. I'll fix that...)  I use this type of validation on numerous fields on the sheet. The hidden "..._error" attribute simply toggles CSS to add a red dashed border around the field to indicate the value is not valid.  I doubt these attributes have any relation to the repeating row errors you are seeing.  Those repeating rows are being flagged by roll20 for some reason.  IME it's often a rowID issue related to case.  I believe the HTML uses/requires the mixed case rowID.  Using inspect element on a 1e character's equipment for example is all mixed-case; Setting a new repeating row with a normalized rowID (not sure if that's happening in your mod...?) may be causing the red border from roll20. Thanks Vince. Unfortunately, that does not do it. I get the "nothing to do" message, so I must be missing some kind of double dash flag in front of the attribute name: Thanks also for your other comments/suggestions. It appears I am only getting the equipment_armor_mod_error attribute and not the magic one at all. I can post my transfer code, but I'm not sure it would solve anything. I'd just love to be able to delete the equipment_armor_mod_error attribute and see if that solves the issue. :-) I get the list of attributes by clicking an "i" button that appears in the chat window's individual equipment details (where the buttons show my what changes I can make (descriptions longer than a word or two are recommended to be written on some word processor and pasted) that is only available to GM players (playerIsGM(msg.playerid)): Which results in the following in the Mod Script Output Console. I've added a bunch of *** after the equipment_armor_mod_error attribute: "" "equipment Attributes: Zeffiro Zirconyd - Chicken" "----- repeating_equipment_-mu0pmbl4hdxnmuiveb_ -----" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_ac | current: [10] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_base | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_bulk | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_magic | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_mod | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_mod_error | current: [1] | max: []" ******************** "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_type | current: [99] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_armor_worn | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_carried | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_carried_select | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_cost | current: [0.03] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_current | current: [0] | max: [0]" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_current_max | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_description | current: [A lovely bawk bawk chicken!] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_item | current: [Chicken] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_item_select_all | current: [Chicken] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_location | current: [On leash] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_macro_text | current: [@{whisper_pc} &{template:general} {{color=@{color_option}}} {{name=@{character_name}}} {{subtag=Item/Equipment: @{equipment_item}}} {{link=@{equipment_link}}} {{freetext=@{equipment_description}}} {{quantity= @{equipment_quantity}}} {{quantity_max=@{equipment_quantity|max}}} {{uses=@{equipment_current}}} {{uses_max=[[ @{equipment_current|max} ]]}}] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_magical | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_quantity | current: [1] | max: [0]" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_show_carry | current: [1] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_show_type | current: [1] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_sync_armor_flag | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_type | current: [4] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_attackdmgtype | current: [] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_damagelarge | current: [] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_damagesmallmedium | current: [] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_length | current: [] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_misc | current: [] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_range | current: [] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_rateoffire | current: [] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_space | current: [] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_speed | current: [] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weapon_type | current: [0] | max: []" "repeating_equipment_-mu0pmbl4hdxnmuiveb_equipment_weight | current: [0] | max: []" "----------------------------" If anyone wants how I do the above, happy to share it.