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

API for editing/deleting system Macros

1439771342

Edited 1439771902
Since the system macros are restricted for editing (to their creator), and situations come up where macros must be updated when originator is unavailable... Is there an API solution for removing or editing system macros?  (I am referring to macros under the settings tab).
1439781569
The Aaron
Pro
API Scripter
I'm not aware of a script that exists for this, but the API is capable of edition the necessary fields, so it could be written. 
Right on @The Aaron.  This is what I used, and I believe it is built on one of your contributions. It seems to work fine. I am sure there is a fancier way, but I wanted to review the list to control which ones I would delete. In my case, I found tons of useless or broken macros, left over from players not even around anymore. There needs to be a better way to clean up macros. Objects hidden from admin view can become naughty devils in an untidy world. This script produces a list of all a campaign's system macros, by name and ID. Then we use the ID to remove the macro. // First search for all the macros, showing a list of the macro names and their IDs.  We will use the ID to remove each macro, one by one after review. on('ready',function(){ log('@@@@@@') var macroExist = findObjs({ _type: 'macro'}); _.each(macroExist, function(macro) { var macroName = macro.get('name'); var macroId = macro.get('_id'); log('*** ' + macroName + '***' + macroId) }); // I comment out this second part of the script until after I've got the specific macro IDs I wanted to remove. This is the business end, where the macro object is deleted. You need to run the list first, so you can grab the IDs, entering them into the getObj('macro','ID-HERE'); line. // var naughtyMacro = getObj('macro','-JucyhqucduWuyrZzuBV'); // naughtyMacro.remove(); log('&&&&&&') });