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 .
×

Show handouts to "current party only".

I run games for organised play, meaning I run the same game many times for different groups. When I have shared handouts like maps, info and rewards, I need to remember to take away the access for everyone to see it again, before the next group comes in.  I posted a suggestion to have an option to "Show to currently defined party". This way the current players will have access, but a player in the next group will not see the handout if the join the game before I have tidied. This may also be relevant for long term campaigns with a rotation of players, where only players that were present in certain sessions will get access to the information gathered there. It is of course possible to give only the current players access to the handout one by one, but that takes a lot more work than clicking the "Show to players"-button. Can this be scripted? I have recently been lured out on the API path and still very basic. 
1778163749

Edited 1778164110
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Simira! Yes, this can be scripted. This script should do most of what you are asking for. Copy the code from this link , and install it using the new script button on your mods page. Once installed, in your game type: !sharehandout into chat. The script will whisper a menu to you, showing all characters in the currently defined party. There is then a block of buttons that allows you to share the handout with any individual party member, or a button for the whole party at once. Click your choice. The script will then ask you for a handout name. This is presented as a dropdown list of all handouts in the game. You can scroll through this list or just start typing the name of the handout. The script will assign permissions accordingly. There is one drawback. The API system cannot auto open the handout for the players, the way the Roll20 engine can. So instead, it whispers a link to each affected player. They can click the button in the message to open the handout. Here is a screenshot of what you will see:
1778164218
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Party and players are listed separately. A defined party might include NPCs, pets, steeds, familiars, etc.
Thank you! Need some players in my API room, will test over the weekend!
1778168343
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Actually, the script will work regardless of whether players are logged in or not. But a player in the room would ensure that the script works properly from beginning to the end.
Just got around to test this now. It sets the access and makes it easier for me to manage that, but the initial thought was an alternative to the "Show to players"-button, and I realise that during game that popping the handout up for the players will be the more important functionality. For feedback though, there's a few adjustments I assume is possible to do for someone who knows code: The script gives access to the whole party or only one player. If is possible to make a selection, ie. the two players/characters who are members of just that faction, or earned just that story award? Remove access. I would love to be able to remove one, more or all players access to the handouts.  More than one handout. If the above could include giving or removing access from more than one handout at the time, it would be absolutely awesome, but I also expect this is a somewhat more complicated matter.
1778516957
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Removing access would not be hard to add. Show to Players (i.e. opening the handouts for them) is impossible. That's part of the GUI and not available to the API. Affecting more than one handout at a time is problematic, as you would need a defining characteristic of said handouts, other than title, to choose which particular handouts to share. As is, you can share a different handout every time you click the button, without needing to rebuild the menu. And selecting handouts from the drop down can be as quick as typing the first few letters of the name. As for selecting subgroups of players, you run into the same problem: how do you define that subgroup at runtime. The only way I can think of to quickly do so is to work off the tokens that are selected. There could be an additional button for "selected tokens"?
Script working on selected tokens would definitely be a good option.
1778526649
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I have updated the code in the above link. This now has options to share only with the players of selected tokens, and also to remove all sharing from the chosen handout.
This is great, thank you! The remove sharing is really nice.