I've modified Marco R's script for creating a Loot Macro Mule to create a Macro Mule character of my own. I'm stuck on one little bit where I'm trying to remove/replace any Collection Macros that are generated by the script, but currently it is deleting all Collection Macros. Here's the section of code: if(msg.type=="api" && msg.content.indexOf("!createCollectionMacros")==0){
macroList =[
[`Menu`,`%{${mmName}|Menu} &{noerror} `],
[`Stats`,`%{${mmName}|Stats} &{noerror} `],
[`Rolls`,`%{${mmName}|Rolls} &{noerror} `],
[`Spells`,`%{${mmName}|Spells} &{noerror} `]
]
mmCollectionMacro = findObjs({type:'macro'})[0];
if(mmCollectionMacro){
macro = getObj('macro',mmCollectionMacro.id);
var existingMacros = findObjs({type: 'macro'});
_.each(existingMacros, function(macro) {
macro.remove();
});
_.each(macroList, function(item){
createObj('macro',{
name:item[0],
action:item[1],
visibleto: "",
playerid: msg.playerid,
istokenaction:true
});
});
} else {
let macro = createObj('macro',{
})
_.each(macroList, function(item){
createObj('macro',{
name:item[0],
action:item[1],
visibleto: "",
playerid: msg.playerid,
istokenaction:true
});
})
}
sendChat(`${scriptName}`,`/w gm Collections Macros for "${mmName}" were created`);
log(`Collections Macros for "${mmName}" were created`);
}
}) I'm pretty sure I just need to modify this line, but I can't figure out how to reference the list of names from the macroList: var existingMacros = findObjs({type: 'macro'}); I've been trying variations of things like this, but they're not working and I'm at the limit of my javascript coding skills: var existingMacros = findObjs({type: 'macro', name: macrolist[0]}); Any help would be appreciated!