Advanced Macros produces an error when reading .split in complex script macros. Simple uses of .split like the simple macro below work, but more complex macros like applyBuff for PF1e produce the error.
Repo Steps
Using PF1e 0.82.2 and Foundry v10.290, activate libWrapper and Advanced Macros.
Add the linked macro above as a script macro named applyBuff
Use @Macro[applyBuff]{Apply Mage Armor} on a token.
Outcome without Advanced Macros Active: Buff named Mage Armor applied on token/actor
Outcome with Advanced Macros Active: Error below
Error
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'split')
[Detected 1 package: advanced-macros]
at HTMLAnchorElement._onClickContentLink (Macros.js:587)
Simple Macro
const str = 'The quick brown fox jumps over the lazy dog.';
const words = str.split(' ');
console.log(words[3]);
// expected output: "fox"
const chars = str.split('');
console.log(chars[8]);
// expected output: "k"
const strCopy = str.split();
console.log(strCopy);
// expected output: Array ["The quick brown fox jumps over the lazy dog."]
There was a major rewrite of the module with the latest Pull Request (#44) and that issue was already fixed when I tried to fix it.
Next release shall have this issue fixed.
Advanced Macros produces an error when reading .split in complex script macros. Simple uses of .split like the simple macro below work, but more complex macros like applyBuff for PF1e produce the error.
Repo Steps
applyBuff
@Macro[applyBuff]{Apply Mage Armor}
on a token.Outcome without Advanced Macros Active: Buff named Mage Armor applied on token/actor
Outcome with Advanced Macros Active: Error below
Error
Simple Macro