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

GroupCheck with ApplyDamage and Combat Master+Concentration

Okay, so I'm loving the Autobutton and ApplyDamage(With GroupCheck) scripts and macros, but although they make the damage and conditions apply just fine, neither Concentration nor Combat Master seems to register the damage applied. In other words, if I have Autobutton do 10 damage to someone who is concentrating, it doesn't run a Constitution Save like it would if I applied the damage manually. Same thing with ApplyDamage. It applies the damage, but no constitution save is made. (Also, if I apply the prone condition with ApplyDamage, for example, it shows the condition, but nothing pops up in chat from Combat Master like it would if I either applied the condition through Combat Master OR applied it manually) Can someone help explain why it's working this way and if there's a way to fix it? (Macro for ApplyDamage):  Community Forums: [Script] groupCheck - Roll checks, saves, et cetera for many tokens at once | Roll20: Online virtual tabletop
1679311091
David M.
Pro
API Scripter
This is because by default, mod scripts listening for certain events ignore events initiated by another script. This helps prevent unintended infinite loops. To get this working, Autobutton and ApplyDamage would need to be modified to expose a public-facing function that the receiving mods (Concentration and Combat Master) would then need to include when registering event handlers. Take a working example: TokenMod has a public function called ObserveTokenChange (line 4025 of the one-click version) and Concentration has added the TokenMod function in its RegisterEventHandlers function (line 446 of the one-click version). The other relevant supporting functions in TokenMod appear to start on lines 1508, 1657, 1663, and 3601. Long story short, you'd need to modify all four scripts to allow them to talk to each other.
1679315812

Edited 1679317273
Is that something I can do without breaking my game? And if so, how? EDIT: The main functionality I need is the ability for CombatMaster to remove the condition symbols on command and for concentration to roll the constitution save. Anything else is nice to have.
1679319918

Edited 1679323178
timmaugh
Pro
API Scripter
I think that AutoButton just uses TokenMod commands behind the scenes to make its changes, so really I think it would be a matter of making CombatMaster become an observer of TokenMod changes. (I have no idea about how ApplyDamage works, but if it does NOT use TokenMod, then just as David said, it would have to expose its own Observer function.) CombatMaster has 5 handlers that deal with graphics, but TokenMod only exposes one "event". It would be up to the observer to determine what had been changed. If I were to do that, I would start with something like this, just above the registerEventHandlers function (so, inserting this at line 4544):     tmObserver = (o, p) => {         const propCheck = prop => o.get(prop) === p.prop;         let propObj = {             'statusmarkers': handleStatusMarkerChange,             'top': handleGraphicMovement,             'left': handleGraphicMovement,             'layer': handleGraphicMovement,             [`${state[combatState].config.concentration.woundBar}_value`]: handleConstitutionSave         };         Object.keys(propObj).forEach(k => {             if (propCheck(k)) propObj[k](o,p);         });     }, And then CombatMaster would need to actually register with TokenMod, which would happen within the registerEventHandlers() function. After all of the Roll20 registrations (starting on(... ), you would need:         if (typeof (TokenMod) === 'object') TokenMod.ObserveTokenChange(tmObserver); That *should* do it, but I don't use CombatMaster and wouldn't know how to go about testing it to confirm. Concentration has two event listeners for token changes... one for statusmarkers and one for a bar value. It only registers the bar-value change function with TokenMod... not the statusmarkers handler. Since it is actively registering with TokenMod, I figure Oosh knew what he was doing, there, and it doesn't need the other changed. But if it does (that is, if changing the value of the script-referenced bar should trigger some behavior), then it might need to have a function like tmObserver(), above, so that it can determine what changed on the token and farm the work out to the appropriate handler. All of the above is untested, btw. It's just where I would start.
1679320457
David M.
Pro
API Scripter
Ah, Autobuttons using Token-mod does make things a bit easier! Btw, here's the link to ApplyDamage. Looks like it *does* have some observer notification in it already, as well.