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

Moving Game Macros

Hey so I know that this has been asked a thousand times, but I keep getting links to old forum posts... Is there a way that I can move my macros from one game room to another without formatting them all for use from a character sheet?
1600858817
Oosh
Sheet Author
API Scripter
Using a macro mule is probably the easiest way, then you can export & import into any game you want. Depending how many you have, you might want to split them over more than one character sheet, grouped according to their use (e.g. player macros, npc macros, map macros and so forth).
1600863842
The Aaron
Roll20 Production Team
API Scripter
I have a script that will pack macros down to a handout, which you can move with transmogrifier, then unpack in the new game.&nbsp; It requires my Base64 script, which is in the one-click installs.&nbsp; Here are details: <a href="https://app.roll20.net/forum/permalink/4607824/" rel="nofollow">https://app.roll20.net/forum/permalink/4607824/</a> Here's the code: on('ready',function(){ 'use strict'; var keyFormat = function(text) { return (text &amp;&amp; text.toLowerCase().replace(/\s+/g,'')) || undefined; }, matchKey = function (keys,subject){ return subject &amp;&amp; !_.isUndefined(_.find(keys,(o)=&gt;(-1 !== subject.indexOf(o)))); }, simpleObject = function(o){ return JSON.parse(JSON.stringify(o)); }, saveToHandout = function(name,data){ var handout=findObjs({ type: 'handout', name: name })[0] || createObj('handout',{ name: name }); handout.set({notes: data}); }, getFromHandout = function(name,callback){ var handout=findObjs({ type: 'handout', name: name })[0]; if(handout){ handout.get('notes',callback); } else { callback(''); } }, packForPlayer = function(player){ let mcount = 0, macros = Base64.encode(JSON.stringify(_.chain(findObjs({type:'macro',playerid: player.id})) .tap((o)=&gt;{ mcount=o.length; }) .map(simpleObject) .map((m)=&gt;{ m.playerid=m._playerid; m.type=m._type; return _.omit(m,['_type','_playerid','_id']); }) .value())); sendChat('',`/w gm &lt;div style="border: 1px solid #eee;background-color:white; border-radius:.25em; padding: .1em .25em;"&gt;Packing ${mcount} macros to handout: &lt;b&gt;Macros: ${player.get('displayname')}&lt;/b&gt;&lt;/div&gt;`); saveToHandout(`Macros: ${player.get('displayname')}`,macros); }, createOrUpdateMacro = function(mdata){ let m = (findObjs({type:'macro',playerid:mdata.playerid,name:mdata.name})[0] || createObj('macro',{playerid:mdata.playerid,name:mdata.name})); m.set({ action:mdata.action, visibleto:mdata.visibleto, istokenaction:mdata.istokenaction }); }, unpackForPlayer = function(player){ getFromHandout(`Macros: ${player.get('displayname')}`,(m)=&gt;{ if(m.length){ m=JSON.parse(Base64.decode(m)); } let macros = _.isArray(m) ? m : []; sendChat('',`/w gm &lt;div style="border: 1px solid #eee;background-color:white; border-radius:.25em; padding: .1em .25em;"&gt;Unpacking ${macros.length} macros from handout: &lt;b&gt;Macros: ${player.get('displayname')}&lt;/b&gt;&lt;/div&gt;`); _.each(macros,(mdata)=&gt;{ mdata.playerid=player.id; createOrUpdateMacro(mdata); }); }); }; on('chat:message',function(msg){ if('api' === msg.type &amp;&amp; msg.content.match(/^!(?:pack|unpack)-macros/) &amp;&amp; playerIsGM(msg.playerid) ){ let op=msg.content.match(/^!pack/) ? packForPlayer : unpackForPlayer, args=_.map(_.rest(msg.content.split(/\s+--/)), (o)=&gt;o &amp;&amp; o.toLowerCase()), keys=_.map(args,keyFormat); _.chain(findObjs({type: 'player'})) .reject(_.isUndefined) .filter((o)=&gt;{ return matchKey(keys,keyFormat(o.get('displayname'))); }) .uniq() .each(op); } }); });
1600866947
David M.
Pro
API Scripter
Really cool, Aaron, thanks for sharing!
1600868318

Edited 1601026789
Cool, thanks for the script! It would be great to make a website about macros and how to script it. That is a very interesting niche and selling such scripts can be really profitable. If you advertise them well it will have much success. For example, you can use backlinks to be ranked high in google search.
Thank you guys. @Aaron, your tireless efforts are not unnoticed.&nbsp;