Active Effect Help

And it should be the actual ActiveEffect document for the effect, not just the id. I don't have the brain right now to figure out the best way to get that.
E
Ethck974d ago
I really thought I could figure it out, but the updates just aren't going through. Here is the current state of the macro:
console.log(args);
if(args[0] === "each"){
let effect = args[2].efData.document; //the active effect which adds the AC bonus
//the Item for Armor of Agathys, set up as innate spellcasting with 0/1 uses.
let armorOfAgathys = game.items.getName("Armor of Agathys");
let bonus = parseInt(effect.data.changes[1].value);
if(bonus < 6){
console.log(effect.data.changes[1].value, effect);
effect.update({"data.changes[1].value": bonus+3});
} else {
armorOfAgathys.update({"data.uses.value": 1});
}
}
console.log(args);
if(args[0] === "each"){
let effect = args[2].efData.document; //the active effect which adds the AC bonus
//the Item for Armor of Agathys, set up as innate spellcasting with 0/1 uses.
let armorOfAgathys = game.items.getName("Armor of Agathys");
let bonus = parseInt(effect.data.changes[1].value);
if(bonus < 6){
console.log(effect.data.changes[1].value, effect);
effect.update({"data.changes[1].value": bonus+3});
} else {
armorOfAgathys.update({"data.uses.value": 1});
}
}
Some stuff still needs to be adjusted.
E
Ethck974d ago
DAE list:
No description
E
Ethck974d ago
(I don't think it pings on thread creation??? So just throwing out a ping. Sorry if it actually did! @badideasbureau
DT
Daniel Thorp974d ago
Maybe you need to await the updates?
E
Ethck974d ago
I thought that as well but tried it and no dice :( The problem (as far as I understand it) is that the effect.update is not going through. I've double checked the keyname and it is a valid name. I also just tried a really simple key name, but the data wasn't modified either, so I think there's something else going on but I have no idea what. If anything I'm thinking it might be that I have the wrong effect selected? But that really should be the right one...
B
BadIdeasBureau974d ago
Honestly not sure - try throwing in a console.log(effect) to check it's the right one?
E
Ethck974d ago
I did. Here's the output (afaik it's the right one???).
No description
B
BadIdeasBureau974d ago
OH! effect.update({"changes[1].value": (the "update" applies to "data", so you skip the first "data") I think you still want the "data" in armor of agathys, since that's system defined data (so it's actually item.data.data.uses.value)
E
Ethck974d ago
That would make sense, but it still doesn't work.
No description
E
Ethck974d ago
Are you allowed to use array indexing in the key field? I'm starting to think it might be because of this? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#computed_property_names Okay, it's definitely because of that If I change the key to "label" then it immediately works I'm going to throw a general question over into #development
Want results from more Discord servers?
Add your server
More Posts
TOL JEs@badgerwerks I haven't had a chance to poke around in TOB/BoL yet, but I wanted to ask how you did tCI 2 minute windowAlright, I've got a Gitlab CI pipeline I'm reasonably pleased with as a result of yesterday's effortGitLab CI PipelinesToday's project is Gitlab CI. Wow me with your pipelines if you got em.Storybook Shennanegins@wyrmisis I have a headcannon for you, one who also uses Storybook. _What if_ we could load foundryjsxDammit I want this...react librarySo far I've seen Vue 2, Vue 3, Alpine, and Svelte pulled into Foundry. No one has yet been crazy enoweb componentsA comment @n1xx1 made over in #development-basics (https://discord.com/channels/732325252788387980/7UI element JS Classeshttps://discord.com/channels/732325252788387980/734922093967310910/882979923483037696 @wyrmisis > Imid-milestone ping feedback@dnd5e **No Action Required** Wanted to ping you to make you aware that the 1.5.0 milestone is >50%Hot ReloadingIs there a way to do something like hot module reloading/live reloading on change for Foundry?Tagger Code ReviewWould anyone be keen to code review Tagger? I'd like to git better 😄 https://github.com/Haxxer/Founsocket woesnot the socket firingpreUpdateSo for some reason ItemPF#_preUpdate changes aren't sticking.. what is PF1 doing that prevents this?mergeObject`mergeObject` is a beast of a function which lets you smash two objects together and that options arselect in sheetAlso, is the data actually saved on the actor? You can inspect the data in the console opened with FIC 5e DocsI'm not looking to ping about this but for anyone who sees this: I'm interested to know if anyone hecustom hud elementMaybe I'm missing something simple here. I'm making my own custom hud element (NOT based on a FoundrCover@badgerwerks how does the cover application for 5e helpers work? I know you do black magic to calculGitpod WorkflowHas anyone figured out a codespaces workflow?Dynamically get Object property from user inputAnyone know how I can do this? I have an Actor (`myactor`) and I'd like to have an input box which