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

[Script][Update]Page Navigator V2.X - Thread 2

1518023287

Edited 1523121113
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
This most recent update fixes several undefined variables that were crashing the sandbox. Previous Forum Post: This is a major overhaul of Page Navigator that I have been working on for the last couple months. This version changes much of the script's function and commands. Because of this, when you start up a game that has previously had Page Navigator v1.X installed, you will be prompted to approve the upgrade or downgrade yourself back to the previous version (by going to your api scripts page). Code can be found in my repository and will be pushed for one-click install after a couple weeks of beta. Summary of Major Changes: Command syntax changes: The command syntax has changed dramatically to allow more streamlined command parsing and to make it easier for users to control all aspects of the script via macro Teleportation improvements: Token teleportation is now much faster. In addition, if you have token removal enabled, the script will copy the current state of a character's pre-existing token on the VTT (it will copy the first one it finds), rather than only creating a token based on a character's default token. Destination Token Setup Wizard: There is now a setup wizard for destination tokens. Access it by entering !nav --setup while having a token(s) selected that you want to make into a destination token or update its parameters. Page Tags: You can now tag your pages to more easily find them in the script menus by putting your tag on the end of the page's name and surrounding each tag in single square brackets. This also changes how pages are tagged as player accessible. The players tag is created by default and tagging a page with [Players] will add it to that folder and make it player accessible. In addition, you can change player access to any folder from the script's config menu. See below for the full help text Thanks to Aaron and Stephen S. for their insight into several issues during the overhaul. Thank you to Keith Curtis for the banner artwork. Page Navigator allows you to more easily move your players from page to page. Movement can be triggered by chat command or token movement. The script will also handle creation of tokens on the new page for moved players. Movement Commands & Token Setup Chat Triggered page change: All players, only those currently in the player ribbon, or specific players can be moved to any page in the game, or returned to the player ribbon. The basic syntax for a move command is: !nav --move,page=PAGENAME,landing=LANDINGTEXT|whole/current/characterid|characterid|characterid|... Token movement triggered page change: Using this function requires that destination tokens be set up. Whenever a token controlled by a player ends its movement on a destination token, a chat prompt is sent to ask if the character should be moved to the page linked to that destination token or not. The prompt is sent to players only if the destination page is contained in a page folder that players have been given unrestricted access to. See the "Other Options" section below for more information about folders. In order to setup a destination token, the token must be named the same as the page to which it links with the exception of any folder names the page has been tagged with. Token Teleportation: When moving players to a page, the script can create tokens for each player at a destination token. The default characters to create tokens for for each player can be set in the config menu. In order for teleportation to function, destination tokens (from above) must contain a JSON in their GM notes field of the following format: { "landingLocation":"Location text of linked token", <=- Optional "location":"Location text", <=- Optional "chat":"Chat message/API command to send when moving to this destination token", <=- Optional "polygon":["Array of polygons limiting token generation"] <=- Only needed if location text is entered } You can setup destination tokens by using the Destination Token Setup Wizard via the command !nav --setup. You must have a token selected when you enter the command. Miscellaeneous Commands and Other Functions !nav --config Brings up the config menu. Folders are designated by tagging pages with whatever folder name you would like enclosed in square brackets (e.g. [FolderName]). Each folder name should be in its own set of square brackets. Any time you reference a page by name for the script, do not incude the folder tags in the name. The script automatically creates two folders, an "All" folder (which pages do not need to be tagged with) and a "Players" folder which can be used to tag pages as with any other folder name. Access restrictions for folders can be set in the config menu. If a page is contained in any folder that has player access, players will be able to send themselves to that page and any destinations therein without GM approval. When teleportation is enabled an additional option will be created in the config menu to automatically remove other tokens for teleporting players before creating new tokens for them. Example Use Cases Assuming pages named Scrapwall [Numeria][Scrapwall] with locations of "Clockwork Chapel"(LinkLocation:entrance) and "Raider Hideout"(LinkLocation:entrance), Clockwork Chapel[Numeria][Scrapwall] with a location of "entrance"(linkLocation:"Clockwork Chapel"), and Raider Hideout with a location of "entrance"(linkLocation:"Raider Hideout"). And characters named Jonos,Kindle, and Violet. Move player(s) controlling Jonos to Raider Hideout: !nav --move,page=Raider Hideout|@{Jonos|character_id} Move as before and create default token(s) for the player(s): !nav --move,page=Raider Hideout,landing=entrance|@{Jonos|character_id} Return Jonos to the player ribbon: !nav --move,page=return|@{Jonos|character_id} Return as before, but query where to generate a token: !nav --move,page=return,landing=?|@{Jonos|character_id} Full Command Syntax Guide This is the full guide of the chat commands available. Syntax is given with optional arguments enclosed in square brackets (e.g. Required Argument vs. [Optional Argument]). Mutually exclusive arguments are separated by a forward slash (/). Move Command: !nav --move,[page=PAGENAME/pageID=pageid],[landing=LOCATIONTEXT/?]|[PLAYERNAME/PLAYERID/CHARACTERID]|[PLAYERNAME/PLAYERID/CHARACTERID]|... page=PAGENAME: The page name, without the folder tags, of the page to move to. If the command is sent by a player, itwill be ignored if the page is not contained within a player accessible folder. pageID=PAGEID: The page id of the page to move to. This will probably only be used by the script itself or other APIs as there is no way for users to access the page id. landing=LOCATIONTEXT: This is the location text of the token where tokens should be created. If a "?" is entered as the location text, a menu prompt will be sent to the messaging player to ask what destination to use. PLAYERNAME/PLAYERID/CHARACTERID: The player name, player ID, or character ID to be moved. If no page is specified a prompt will be sent to the messaging player to ask what page to send players to. If no player or character is specified the command will not be processed. Configuration Option Controls: !nav --config,[remove=on/off],[teleport=on/off],[folder=FOLDERNAME,access=gm/players],[control=whole/current/self],[dmarker=statusmarker name/name only] If no additional options are entered, then the config menu will be displayed. Will only use the first of these the script encounters. remove: This sets token removal on or off. Token removal causes all other instances of tokens representing teleporting characters to be removed before creating new tokens at a designated destination token. folder: Designates what folder that you would like to change the access state of. Folder access information is stored in the Page Navigator character in an ability called Page Folders . access: This sets player access for the indicated folder. control: Sets player's ability to move others to new pages (whole=all players, current party=only those currently on the player toolbar, self=only themselves). dmarker: Sets what status marker is used to define destination tokens. Can be the name of a statusmarker or "name". If "name" will only look for tokens that are named the same as a page. teleport: Sets token teleportation on/off. Destination Token Setup Wizard: !nav --setup Wizard Buttons: Token Name: Clicking this button will bring up a query with options for the names of all current pages. You can also enter the name of yet to be created name by selecting the "PAGE NOT CREATED YET" option Boundary: Select polygonal paths that you want to use to bound the token creation area for the destination token and then click this button. All polygons selected should create a closed shape as the script determines whether tokens can be created from a destination via a flood-fill algorithm. Location Text: Clicking this button will bring up a query similar to that of the Token Name for selecting or entering custom text to describe the location of this destination. linkLocation Text: As the button for Location text, but describes the location of the destination token this token links to. Chat Command: Allows you to enter a line of text to be sent to chat when players are moved to this destination. Can be used to have the script send API commands based on party movement. Menu Image Examples Config Menu Movement Approval Dialog Unspecified Page Movement Dialog Destination Token Wizard Changelog: v2.11523114136 Fix for multiple errors that were preventing function V2.11518021707 Fix for undefined variables V2.1 Fixed several bugs that made the script unusable V2.0 Improvements to teleportation logic and storing of character tokens improved command syntax Destination Token Wizard Folders (tags) v1.x See the previous thread
1518025111
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Wow, a lot of work! I'll have to give this a spin before I get back in the big chair.
1518025220
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Almost all of that is from the last release, the only update here is that the script won't crash on start up anymore.
1518029575
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Well, I'm behind on things, then. :)
1518081635
Ziechael
Forum Champion
Sheet Author
API Scripter
Scott C. said: the only update here is that the script won't crash on start up anymore. The missing piece of the puzzle! Will give it a spin and see if I can break it ;)
1523121021
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
V2.11523114136 Fixed multiple errors that snuck through the last release that prevented much of the function of the script. It should now work as intended.
1523164738

Edited 1523164790
Thanks, Scott C., I'll try it and get back to you soon.
Hi Scott, this is working great. I love it, but (you knew there was a but) the typo in line 1588 is still there. It's the only instance where loadfolders gets calles though the function name is LoadFolders. As always, thanks for putting great amounts of work into those scripts, they help immensely!
1523282425
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Thanks Florian, I think I missed that report. I'll take a look.
1523288426
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The typo of loadfolders vs loadFolders has been fixed.
I have retested, the issues I reported and they are from what I can see completely fixed. This version is working like a charm and great fun to use. (Don't ask how often I have just teleported the party around, because I can )
1523374581

Edited 1523374902
I think I found another issue. Somehow regardless of how I set up the permissions in the script the players are unable to move themselves. I can reproduce this with any command I could imagine but for the sake of testing this minimal example will yield the above result. Test-Command (always run with token selected): !nav --move,page=Übersicht|@{selected|character_id} Running this command from a player account, shows the Query from the script about where to go "Please specify where you would like to move...". Clicking the button shows the dialog with the correct maps in the Players folder. After that nothing happens. Running the same command from a GM account the move is initiated. I tried every possible value of the "Players can move" setting and assigned a token (which shouldn't actually be necessary I believe unless I need teleportation). Edit: Just looked around a little bit further. The following command works when issued by a GM, but not when issued by a player (and is a smaller testcase): !nav --move,pageID=-KxgtkchGJ-rrBnOKLnE|-KzEMEqy_QxwKZO2J0qb
1523378177
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Thanks Florian, I'm working on a fix.
Maybe you already found out what the issue is, if not I have digged deeper into the issue. The problem lies in the moveToPage function, where the if statement handling inaccessible pages always hits the return clause. Commenting out the code below fixes the problem (but that is of course no solution): if(!_.some(folders,(f)=>{log(folderAccess[f]); return folderAccess[f]==='players'}) && !gm){ //Handling for inaccessible page return; } Furthermore I believe there is an issue with the storeFolders function that might be related. You're parsing the Ability there as if it were a JSON string, storedFolders = JSON.parse(folderAbility.get('description')); but when storing it back you try to write the object directly to the description field: folderAbility.set('description', folderAccess); This corrupts the folderAbility description so the values will get reset during the next startup of the script.
1523541033
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Thanks Florian.
1523563952
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ok, try this version and see if it allows player movements for you (it does in my dev game). 2.11523563299 Fix for how folders are examined for player access As for the storedfolders that you looked at Florian. The ordering of the object gets changed, but that doesn't actually affect anything.
Now the moving works for the players too. One thing I noticed that when using !nav --move|@{target|character_id} every player can move every character, even the "Players can move" setting is set to "Only themselves", Now I'm not sure is this setting thought to be respected for manually issued moves, or is this setting only applied when stepping on a teleporter token?
1523628809
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, should apply to all moves
1524102123

Edited 1524103348
Been having trouble with setting the status marker for destinations:  For reference, the error message generated was:  ReferenceError: statusQuery is not defined ReferenceError: statusQuery is not defined at configHandler (apiscript.js:10139:35) at _.each (apiscript.js:10383:29) at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9) at handleInput (apiscript.js:10368:15) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1634:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) Edit: Now !dev --config displays nothing, and no errors are thrown
Are you using the OneClick version? I believe the newest version hasn't been merged yet which will fix the error you receive. In the meantime you can use the latest version from Scotts repository. The most current version can be found here