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

[Help] Sending players to individual pages on login.

Can I send players to a specific page on login? Like, separate from the player bookmarked page. Basically I'd like to put together an API like: -On player:login check player ID -Send ID to player-spicific page "Page1" That way they can have a personal page for whatever. And when we're ready to start the game I can just put in a command to pull all player ID's to the bookmarked page. Hope this is clear enough, any ideas?
1433044606
Lithl
Pro
Sheet Author
API Scripter
Sure, you can watch the change:player:_online event to see when they log in, and use Campaign().set('playerspecificpages', ...) to put them on the appropriate page. The only challenge at that point is knowing which page a player should be on. I'll see if I can whip up something simple in a little bit.
1433047489
Lithl
Pro
Sheet Author
API Scripter
Napkin programming: on('chat:message', function(msg) { var args = msg.content.split(' '), command = args.shift().toLowerCase().substring(1); if (msg.type !== 'api') return; if (command !== 'setpages') return; if (!playerIsGM(msg.playerid)) return; if (!state.setpages) { state.setpages = {}; } _.each(args, function(arg) { var tuple = arg.toLowerCase().split(':'), player, page; if (tuple.length !== 2) return; player = filterObjs(function(obj) { if (obj.get('type') !== 'player') return false; return obj.get('displayname').toLowerCase().indexOf(tuple[0]) === 0; })[0]; page = filterObjs(function(obj) { if (obj.get('type') !== 'page') return false; return obj.get('name').toLowerCase().indexOf(tuple[1]) === 0; })[0]; if (player && page) { state.setpages[player.id] = page.id; } else if (player && tuple[1] === 'reset') { delete state.setpages[player.id]; } else { sendChat('System', '/w gm Could not find player ' + tuple[0] + ' and/or page ' + tuple[1]); } }); }); on('change:player:_online', function(obj, prev) { var playerspecificpages = Campaign().get('playerspecificpages'); if (!obj.get('online')) return; // Just logged off if (!state.setpages) return; if (state.setpages[obj.id]) { if (!playerspecificpages) { playerspecificpages = {}; } playerspecificpages[obj.id] = state.setpages[obj.id]; } else { if (playerspecificpages && playerspecificpages[obj.id]) { delete playerspecificpages[obj.id]; } if (playerspecificpages && _.keys(playerspecificpages).length === 0) { playerspecificpages = false; } } Campaign().set('playerspecificpages', playerspecificpages); }); So you would set players' pages like !setpages Kerberos:Minty's Brian:Town to set you to the page with the name starting with "Minty's" and me to the page starting with "Town". You could also do it as two separate !setpages calls. To remove the default setting, you would use !setpages Kerberos:reset . The script should then move them to the appropriate page the next time that player loads the VTT. Note: This script is untested.
1433334693
The Aaron
Pro
API Scripter
Neat!