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

How do I get a script to create handouts?

What sort of code is needed to take an input file (maybe one big handout) and turn it into a series of handouts?  How do you manipulate (create, destroy, populate) handout entities?
The Aaron
Forum Champion
API Scripter
You can create handouts just like other objects, save for a minor complication with writing the contents.  Here's the code I use for my MotD script: createMotDNote = function() { var motdNote = createObj('handout',{ name: motdNoteName }); motdText='Welcome to the Game!'; motdNote.set('notes',motdText); motdNoteId =; }, The bold lines are the important parts.  You have to create the handout object first, then set the contents of the note in a separate call.  It doesn't work to do it on creation. As for updating, it's the same way; you get the note object (however you like) and then set the contents. Removing is just handoutObject.remove(); The only other complicated part about handouts is getting the contents.  You have to use the asynchronous form of .get() to retrieve the contents.
Many thanks!
The Aaron
Forum Champion
API Scripter
No problem!
Vashtar will you share your script? We would like to be able to have API make Blank handouts.

Edited 1470015709
DM Warlock, here is a Handout API script that will generate a handout visible to everyone, and editable by the person who runs the command. Used by '!handout' on('ready',function(){ &nbsp; "use strict"; &nbsp; on('chat:message',function(msg){ &nbsp; &nbsp; var player,handout; &nbsp; &nbsp; if('api' === msg.type && msg.content.match(/^!handout/) ){ &nbsp; &nbsp; &nbsp; &nbsp; player=getObj('player',msg.playerid); &nbsp; &nbsp; &nbsp; &nbsp; if(player){ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; handout=createObj('handout',{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: 'Handout for '+player.get('displayname'), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inplayerjournals: "all", &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; controlledby: (playerIsGM(msg.playerid) ? '' : msg.playerid) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sendChat('','/w "'+player.get('displayname')+'" Created a handout for you: &lt;a href="<a href="'" rel="nofollow">'</a>'" style="color:blue;text-decoration:underline;"&gt;Handout for '+player.get('displayname')+'&lt;/a&gt;'); &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } &nbsp; }); });
Thank you!