Here's a little script for that. You can call it with any of the following: !hide-journal !hide-characters !hide-handouts That should be self explanatory. =D Here's the code: on('ready',()=>{
const hideJournal = async (type) => {
if( ! ['handout','character'].includes(type)){
return;
}
const promises = findObjs({type})
.map( item =>
new Promise(
resolve => setTimeout(
() => {
item.set({controlledby: '', inplayerjournals: ''});
resolve();
},
0
)
)
);
await Promise.all(promises);
};
on('chat:message',async msg => {
if('api'===msg.type && /^!hide-(journal|characters|handouts)(\b\s|$)/i.test(msg.content) && playerIsGM(msg.playerid)){
const who = (getObj('player',msg.playerid)||{get:()=>'API'}).get('_displayname');
let args = msg.content.split(/\s+/);
switch(args[0]){
case '!hide-journal':
await hideJournal('handout');
await hideJournal('character');
sendChat('',`/w "${who}" <h3>Handouts and Characters are now hidden.</h3>`);
break;
case '!hide-handouts':
await hideJournal('handout');
sendChat('',`/w "${who}" <h3>Handouts are now hidden.</h3>`);
break;
case '!hide-characters':
await hideJournal('character');
sendChat('',`/w "${who}" <h3>Characters are now hidden.</h3>`);
break;
}
}
});
});