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

Looking for API that can help with managing party splitting.

1639226940

Edited 1639227014
I am helping run a westmarch campaign, and we have a lot of players that have their characters on a central HUB server. Currently individual games are hosted on different servers, and we transfer character sheets over to the new game. What I'd like to do is set the HUB as the one-stop do-all. So to do this, there are a few things I am looking to accomplish, and I am not sure if it is within the power of API or not. 1. Players to be able to type a command to move themselves between designated maps that we allow freeform RP at, such as the Guild Hall, and Arena. Example "!goto --arena" to move themselves to the arena, without GM needing to do it for them. 2. Localize chat and rolls to be visible only to those who are on the same page. I know something along the lines of the DM creating a character named "Group_1" and all players type "/w group_1 hello!" could work...but making it a little more automated would really clean things up, and format it to look closer to regular messages.  Can any existing API do these things? Or is it within the realms of what API can do?
1639227895
Kurt J.
Pro
API Scripter
Page Navigator looks like it might work for players moving around:  Community Forums: [Script] [Update] Page Navigator v2.X | Roll20: Online virtual tabletop I haven't used it, but it does have a configuration option to allow players to move themselves. The chat isolation would probably be fairly simple to write with the API, but the players would need to use an API command to utilize it, something like "!localchat Hello there, fellow kids!". On the back end, the API script could watch for that command and then get the page that player is on, loop through all the other players, and whisper them the text if they are on the same page. I don't know if such a thing already exists.
Thanks for the suggestion, I am going to take a look into that and see if it does what I am looking for! Could the chat isolation be a togglable feature? like "!local --on", Ideally it would do anything they put in such as chat, emotes, and rolls to local.
1639231394
Kurt J.
Pro
API Scripter
Rob F. said: Thanks for the suggestion, I am going to take a look into that and see if it does what I am looking for! Could the chat isolation be a togglable feature? like "!local --on", Ideally it would do anything they put in such as chat, emotes, and rolls to local. There isn't a way for the API to prevent a message sent in chat from being processed by Roll20, so the only way to achieve this would be having the players communicate via an API command. The code below implements !localchat, so if a player types "!localchat help!" it will be whispered to any players on the page. const localchat = (() => { on("ready", function() { on('chat:message', function (msg) { if (msg.type === "api") { if (msg.content.toLowerCase().startsWith("!localchat ")) { var messageContent = msg.content.substring(11); var sender = getObj("player", msg.playerid) || undefined; if (sender) { var sendPage = findPageIDForPlayer(msg.playerid); allPlayers = findObjs({type:'player'}); _.each(allPlayers,function(p){ log(findPageIDForPlayer(p.id)); if (sendPage == findPageIDForPlayer(p.id)) { WhisperTarget = p.get("displayname"); sendChat(msg.who, `/w "${WhisperTarget}" ${messageContent}`); } }); } } } }) }) function findPageIDForPlayer(playerid) { var playerPage = Campaign().get("playerpageid"); var playerspecificpages = Campaign().get("playerspecificpages"); if (playerspecificpages[playerid]) { playerPage = playerspecificpages[playerid] } return playerPage; } })();
1639233097

Edited 1639233143
awesome, really apricate you taking the time to write that, I tried out page navigator as well...it was a bit...complicated to say the least, I did read the comments and found MapChange is a little easier to set up, and does about the same thing.  Going to test out the API you wrote as well. Is there an easy way to quickly make all roll the macros in every character sheet begin with '!localchat' ? 
1639283704
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Just a note as the author of page navigator. It is currently not fully functional. Map change may be able to do what you want.
1639460530
Victor B.
Pro
Sheet Author
API Scripter
Sorry folks, but the Roll20 environment doesn't really allow change between maps.  I've tried it.  Too many limitations.  
1640091307
Pat
Pro
API Scripter
um, Teleport can work for this. It can transfer players between maps based on teleport pads or commands. It still lacks the anti-crowding features, and won't re-combine the player ribbon yet, but it can split parties pretty well. 
1640092117
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Victor B. said: Sorry folks, but the Roll20 environment doesn't really allow change between maps.  I've tried it.  Too many limitations.   What limitations did you run into? I use MapChange all the time for giving my players the ability to move to a set of public maps and back. 
Map Change, and the API Kurt posted -almost- does everything that I want it to do, the local chat is a little wonky to use, since  you have to type !localchat before every message, i'd much prefer a toggle feature for it to work, as well as allow rolls, and be a little cleaner looking. But I defer to Kurt's knowledge on this, that if this is the best that can be done with the limitations of roll20+api, then to be thankful that he took the time to write out what he did make for me.