Page Navigator v1.46 This thread is out of date. Please see the v2.x thread Page navigator simplifies moving your players from map to map and allows them to interact with destinations on the map directly by moving their token to the destination. Player movement between maps regardless of the trigger is controlled by the GM, unless the GM has defined a page or pages as player accessible, or has turned off the player movement restriction. Starting back in v1.4, I've been trying to get token's to be automatically created on the new page (aka teleportation). With v1.43, this functionality is completely live and I have been unable to find any bugs. See below for a complete guide on using the script. Dependencies: This script uses Path Math, Token Collisions (I recommend v1.3 or later because rectangles are useful), Vector Math, and Matrix Math. You will need to have all of these installed. Please let me know what you think and what you'd like to see changed. Thank you to Stephen for his wonderful utility functions and his help in figuring them out, and as always thank you to Aaron for allowing me to pester him with naive questions about javascript. -Scott C. Gif of teleportation and token removal in action. With many tokens as shown in the gif, it can take awhile. How to use the Script (v1.4): Page Navigator allows you to more easily move your players from page to
page. You can utilize the script through API commands or by relying on
token collisions to provide a more interactive map for your players. Commands The api command to trigger the script is !nav . The commands that can be passed with !nav are: help — Shows the Help screen pages — Brings up a dialog of all non-archived pages in the Campaign for specifying a page to send players to. The exact behavior is dependent on the next argument, which can be: whole — To move all players to the selected page. current — To move only those players currently in the player ribbon to the selected page. player — To move a specific player(s) to the selected page. This must be followed by at least one token or character id and will move the owners of that token/character to the selected page or will only move the messaging player if the gm has set player control to only themselves. return — If sent by the gm; returns all designated players (via token/character id) to the player ribbon. If sent by a player, returns that player to the player ribbon. config — If sent by the gm; brings up the configuration options. Has no effect if sent by a player. Defining Destinations In order for Page Navigator's token collision functionality to work, you must properly set up the destination tokens. The script looks for the following token properties when determining if a token is a destination or not: Layer — The token must be on the GM layer. Marked as destination — The token must be marked as a destination correctly. The script looks for the flying-flag status marker by default, but it can be set to look for any status marker or to look for tokens based on name only. Token Name — The name must exactly match the name of whatever page you want it to link to. This includes the player accessible tag you have designated in the configuration options for player pages. Buttons There are several API button dialogs that may be generated while using this script. These are descriptions of what each button will do. Dialog for a token colliding with a destination-token: Whole Party — Will move all players in the game to the player ribbon, and will move the player ribbon to the page described in the dialog. Current Party — Will move the player ribbon to the designated page, but will not affect any players split from the party. Controlling Player(s) — Will move any players set to control the token or its associated character (if it represents a character) to the designated page. Dialog for the pages command: The dialogs that are produced by using !nav pages produce a button for each page that the sender of the message has access to. These buttons will send players to the indicated map based on how pages was called. Access Page Navigator functions differently based on the access allowed by the triggering player. Setting Access — Pages are GM access only by default. To set a page to Player access, simply add the tag that you have selected to the end of the page name. By default the tag is set to .players . Any text after the tag will not be shown in any button labels or dialogs. Example: Test Page - GM only page vs. Test Page.players - player visible page GM Access — If the !nav pages ... command is sent from a GM, all pages are populated as API buttons. The GM receives a whispered movement prompt for all token collision prompted navigation requests. Player Access — If the !nav pages ... command is sent from a player, only those pages flagged as player pages are populated as API buttons. Players only receive a whispered movement prompt when their token collides with a player accessible destination. Config Page Navigator now has several options that you can adjust according to your preferences. Players can move: This button cycles between allowing players to move everyone in the game (default), only those currently in the player ribbon, or only themselves. Players can access all pages: Sets the access state to restricted (default) or open. This defines whether a player can directly access only player pages or all pages respectively. Player page tag: Triggers a roll query prompt to specify what tag you would like to use to mark pages as player accessible Destination tokens marked by: A list of all status markers that can be applied to tokens along with an option for name only . The currently selected one is highlighted in green. Teleport on/off Buttons to set the default characters of each player as well as toggle the removal of tokens on or off. Update Destinations & Pages Triggers the scripts update behavior to update the stored pages and destination-tokens. Use after you have added a page and/or a token linked to a page. Change log: Version 1.47 Removed several lines of code that I used for debugging and developing features. This will remove several extraneous logs in the API dashboard. Was also an incorrect state variable definition that I was using to auto-set a script setting prior to having the control in the config menu; this would not cause a problem for anyone who had previously installed the script, but would cause a crash for new users. Version 1.46 The removal of teleporting tokens can be toggled on/off. Will limit the number of tokens representing a given player controlled character to only those generated by the script (all tokens controlled by players being moved are deleted before new tokens are made). Version 1.44 Minor Bug fix that was causing values stored in the state to be wiped with any update. Should be no changes in functionality. Version 1.43 Features You can now set a player's default token to "none" which will wipe the memory for that player's settings. Bug Fixes Fixed a bug where the script would crash if there was not enough room for all tokens that were being generated Increased the amount of time the script spends looking for an open square for a given token from 20 seconds to 25 seconds. This probably won't get any longer as it's already closer to the 30 second trigger of the infinite loop detection than is probably wise. The script now stops iterating through characters as soon as it is unable to find enough space for a character's token. A note about interactions with some new scripts: The script stores all of a character's default token information in the state, so if you are using something like TokenSwapper to modify characters' default tokens on the fly you will have to update PageNavigator's memory before the tokens it creates will reflect the change. My next iteration will probably switch to pulling this information from the characters as it is needed, but that probably won't be for a while as it is going to require rewriting how token generation is handled to accommodate asynch resolution. Version 1.42 No new features, just fixes for the bugs that plagued v1.4. Teleport functionality is now working without crashing the API. I don't know how this was working for me when I released it, but it should all be kosher now. Version 1.4 (BUGGED, only use if you do not plan to turn the token teleport functionality on) New features: !nav pages return can now return all players to the player ribbon by adding whole to the end of the command. (Only works for the GM) The script now has a teleport option. It is off by default. Turning teleportation on adds an additional section to the configuration menu where you can designate up to 6 default characters for every player in the game from a list of characters that that player controls (characters controlled by 'all' are not included in this list). When teleportation is turned on the script will look for JSON text in the GM notes of the destination tokens on the destination map in this format: {
"location":"Descriptive Text",
"linkLocation":"Descriptive Text"
} "location" - this describes where on the map this destination token is (i.e. Front Entrance) "linkLocation" - this describes where on the destination map the destination token links to (i.e. Front Entrance) In order for a token to be created on the new page, the origin Token's linkLocation text must be the same as the location text of a destination token on the destination map. The script will only work if there is a single match. Once the script has found a match it creates the designated default tokens as specified in the config menu. The script will only create a token in a square if there is a direct path between the square and the landing site that is not blocked by a DL path. The script will respect token size when looking for an open square. I have not tried it with small tokens, but I would assume that it will work with them, although it will probably not pack multiple small tokens into a single square. The script assumes that you are using the default 70px X 70px squares in the page's settings. Using another setting will throw off square alignment, but should not otherwise provide a problem. Version 1.3(Currently in One-Click) Large Update with a lot of changes. Read the changelog and the updated instructions above before upgrading to this version if you are currently using a previous version. msg.selected support enabled - The script will now respond to what you have selected when you trigger any of the !nav pages commands, assuming you don't enter anything in the 4th argument. (e.g. !nav pages [pages command] [4th argument]) The script now stores the destination tokens and pages in the state rather than finding them with each trigger. Please use the update button in the config dialog to update the stored destinations and pages before using the first time. The tag for defining pages as player accessible is now customizable. It's default is no longer "players" ; it is now .players . This change was due to programming necessities for making it customizable. Any command except for !nav help and !nav pages ... requires gm access. Gm's should not use any of these commands except for !nav config as they are meant to handle the pressing of an API button and have very specific requirements for arguments. WARNING!: If you use these hidden commands, you risk breaking the stored variables and the script. Erroneous chat commands being sent when there were no valid pages or players has been stopped. An error message is now generated instead. There are now error messages if the conditions required by each command are not met. Handling for non-controlled characters/tokens has been added The Help screen now appears if the next argument after !nav was invalid, or if only !nav is entered. - will add handling for further down incorrect arguments in the next beta/release iteration. The Help screen has now been updated to reflect the new capabilities of the beta version. New Commands !nav pages return - If sent by the GM, returns the controlling players of all selected tokens to the player ribbon. If sent by a player, returns that player to the player ribbon if the ribbon is on a player accessible page; sends a request to return to the GM if it is not. !nav config - The script now has several settings that you can modify to customize the navigation behavior: Player Control - Adjust whether players can move the whole party, the current party, or themselves only via the !nav pages commands (the exception is !nav pages return which only allows players to move themselves regardless). Possible Values: Whole Party (Default), Current Party, Themselves only. Access all pages - Toggles whether or not players have access to all campaign pages or not. Possible Values: off (Default), on You can now set how you want your campaign's destination tokens identified. Possible Values: any status marker (Default: flying-flag) or name only Update - Updates the stored destination tokens and pages. Version 0.1.031 Minor update. The help dialog has been adjusted so that it does not present one block of text. Instead specific help topics are available via API button. The handling of page names has been changed so that the "players" tag no longer shows up in buttons and dialogs. Because of this change, the tag must now be at the end of the page name. Any text after the "players" will not show up in buttons or dialogs. Version 0.1.03 Had also not updated the help screen with what buttons are created. Help screen has been updated as shown to the left. Version 0.1.02 Had forgotten to update the help, or this post with changes to the command syntax for the script. There is a new syntax for using !nav pages all. It now uses !nav pages whole instead. Thanks for pointing this out Ziechael. Version 0.1.01 Fixed the issue with splitting the party. The party can now be split as much as you would like in any way you would like. The script now has logic for determining what pages the GM would like players to have access to and which they shouldn't have via looking for "players" (including "") in the page name. The script will whisper formatted API buttons based on whether pages are flagged with "players" or not. Version 0.1.0 All players who control a triggering token will now be separated from the party if the "specific players" button is pressed. There is now a command to manually move players to any nonarchived page. Players are now notified via chat when players are being moved to new pages. Version 0.0.5 Noticed that I had programmed the script so that it would trigger if there was any collision with a destination token during the move. The script will now only trigger if the moved token finishes its move sharing space with the destination token. Version 0.0.4 Release Planned Features - May not happen, but things I'd like to add - Allow tokens to be removed when teleporting allow handling of chat output/API commands to be executed on a move to a specific page/destination EDITED 5/12/16 10:20pm CST: To be more specific that the buttons are whispered to GM only in order to maintain GM control over player exploration. Edited 5/17/16 2353: To show that the multiple specific players functionality mentioned above is completed. (Thanks Paprikacc for pointing out I had neglected updating this part of the post). Edited 6/1/16 1845: Added Version 1.3 to the changelog. Updated the top description to be less rambly. Moved list of edits to the bottom.