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] Door Knocker v1.3

1665426528
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
This is a long overdue update for my Door Knocker script to bring it into compliance with several changes to the Roll20 system. For those that don't want the full details, here's the change log: Change log 1.3 Old window setups will be transitioned to native Roll20 window setup on script start. Window color also changed to wall color by default. Windows can now be any of the defined door type colors and will respect access for that type of door. Fixed issue with new path color format in Roll20 Fixed issue with searching/manipulating doors when a grid is not enabled (uses 70px as the equivalent of 1 square when no grid is enabled; this mimics the actual Roll20 behavior) Door Knocker v1.3 Welcome to Door Knocker. This script helps quickly open and close doors by controlling the dynamic lighting lines. If you have any questions, comments, or find a bug; please drop by the&nbsp; Door Knocker forum thread . Using Door Knocker The script will move dynamic lighting lines used as doors to the map layer and make them transparent, opening the door. It determines what is a door and a wall based on the stroke color of the polygon and will only open doors within 1 square of the door knocker token. If the grid is not activated on the page, then the script uses 70 pixels as the equivalent of 1 square. Basic Command Syntax The script uses a standardized API command syntax. All Door Knocker commands will begin with&nbsp; !knock . This will then be followed by a space a double dash preceding a keyword and options group. This looks like this: !knock --keyWord|option1|option2|... Opening and Closing Doors Open and close using the&nbsp; key &nbsp;or&nbsp; push &nbsp;keyword followed by an option to tell the script whether to open doors, close doors, or toggle doors. You can also pass an optional second option to tell the script to open/close/toggle all doors within range of the knocker token, on the page, or in the campaign. These commands look like: Affecting obvious doors !knock --key/push|open/close/toggle|all/page/campaign/range Affecting hidden doors !knock --key|reveal/hide/togglehide|all/page/campaign/range Affecting obvious and/or hidden doors !knock --key|anydooropen/anydoorclose/anydoortoggle|all/page/campaign/range Affecting Windows Windows have been switched to the native Roll20 implementation. The script will clean up old window lines from the script's version of windows and convert them to the native Roll20 window lines. Affecting any doors !knock --key|anyopen/anyclose/anytoggle|all/page/campaign/range key/push: &nbsp;This is the keyword that tells the script to manipulate door dynamic lighting lines. The&nbsp; key &nbsp;keyword operates on both locked and unlocked doors and is GM only. The&nbsp; push &nbsp;keyword only operates on unlocked doors. open/close/toggle &nbsp;This option tells the script to open, close, or toggle (open closed doors and close open doors) the closest door (or all doors if also using the all option described below). reveal/hide/togglehide &nbsp;This option tells the script to open, close, or toggle the closest hidden door (or all doors if also using the all option described below). anydooropen/anydoorclose/anydoortoggle &nbsp;This option tells the script to open, close, or toggle the closest obvious or hidden door (or all doors if also using the all option described below). openwindow/closewindow/togglewindow &nbsp;This option tells the script to open, close, or toggle the closest window (or all windows if also using the all option described below). anyopen/anyclose/anytoggle &nbsp;This option tells the script to open, close, or toggle the closest obvious door, hidden door, or window (or everything in range if also using the all option described below). all/page/campaign: &nbsp; Optional argument &nbsp;This option tells the script to operate on all doors within range, all doors on a page, or all doors in the campaign. The&nbsp; page &nbsp;and&nbsp; campaign &nbsp;keywords are GM only and do not work with the&nbsp; push &nbsp;keyword. Range and the all/page/campaign keywords can be entered in any order relative to each other. range: &nbsp; Optional argument &nbsp;This option tells the script to operate at a custom range, entered in the units of the map (e.g. ft, meters, kilometers). Range and the all/page/campaign keywords can be entered in any order relative to each other. Setting up the Door Knocker Set the wall, door, and locked door stroke colors in the settings menu using hex color codes (e.g. #000000). You can also set these values by selecting an already created DL line. This functionality is only accessible to the GM. The command syntax for using a selected DL line looks like: !knock --preset|wall/door/unlocked/hidden|hex color preset: &nbsp;This is the keyword that tells the script to change it's settings wall/door/unlocked: &nbsp;This option tells the script to update the color setting for walls, doors, and unlocked doors hex color: &nbsp; Optional argument &nbsp;Passing a hex color here will set the script to consider all polygons on the Dynamic Lighting layer with a stroke of this color (or the rgb equivalent) to be doors/walls. If this option is not passed the script will look for a selected polygon to pull a stroke color from. Setting up your maps The only map setup needed is to ensure your dynamic lighting doors are the appropriate color. This functionality is only accessible to the GM. If you are adapting a module or add-on to an already existing door color scheme you can select a door line and run the following chat command: !knock --adapt|door/wall/unlocked/hidden/window|campaign adapt: &nbsp;This is the keyword that tells the script to update all polygons on the dynamic lighting layer with the same stroke color as the selected polygon(s) to have the script's door/wall stroke color wall/door/unlocked: &nbsp;This option tells the script to update the stroke color to that of walls, doors, or unlocked doors campaign: &nbsp; Optional argument &nbsp;adding this optional argument tells the script to update polygons on all pages, not just the current page. Searching for Doors When you search for doors using Door Knocker, it will copy door lines to a visible layer. If a gm initiates the search with a non-pc token selected, hidden doors are copied and all door lines are shown on the gm layer. If a player initates the search, hidden doors are not displayed and the door lines are shown on the objects layer. How long door lines are visible for (in seconds) can be set from the settings page. !knock --search|range search: &nbsp;This is the keyword that tells the script to display any nearby doors range: &nbsp; Optional argument &nbsp;Enter the search range, in the units of the map (e.g. feet, meters, kilometers). If you do not provide a range, it will default to the distance of a square on the map. Note that searching does not currently reveal windows due to how the window paths are encoded. This functionality is being worked on. Customizing the Script Door knocker token The script uses a generic key token as the door knocker token. You can customize this by changing the default token of this character. You also can run the script's commands from any selected token. Script created abilities The script also creates six abilities on this character as token actions. These can be disabled as token actions, but should not be deleted as the script will simply remake them. You can also add whatever other macros you want to this character. Attributions The default token image is from&nbsp; <a href="https://game-icons.net/" rel="nofollow">https://game-icons.net/</a> &nbsp;under the&nbsp; creative commons license . Thanks to Keith Curtis for finding this awesome token. Change log 1.3 Old window setups will be transitioned to native Roll20 window setup. Window color also changed to wall color by default. Windows can now be any of the defined door type colors and will respect access for that type of door. Fixed issue with new path color format in Roll20 Fixed issue with searching/manipulating doors when a grid is not enabled
Thank you for your great work, Scott!! Two questions.&nbsp; Have you rolled this out?&nbsp; I checked the Roll20 API scripts repository on github but it still shows 1.213 as the latest update. Do I need to have the grid activated to use the search function? (I don't usually use the grid.)&nbsp; I've been using 1.213 and got it to work once when I set a range of 40 but it hasn't worked since.&nbsp; As I mentioned in another thread I'm pretty green using API scripts so it may some kind of user error on my part.
1665447086

Edited 1665447095
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Stik! Mod pulls are usually performed by Roll20 on Tuesdays. It is likely to become available in repo and One Click layer tomorrow.
1665448496
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, as Keith said. It's been submitted; just waiting on roll20 to do their normal merge.
1665459661

Edited 1665460543
Stik
Pro
Thanks, guys.&nbsp; I was't familiar with the roll out procedures (still learning.) Any comments on my question about my problems with using the search function?&nbsp; I've tried every permutation of !knock --search| using ranges from 5 to 200 and only once did I see a door display itself.&nbsp;&nbsp; And, I have the open/close/toggle functions only when the token is overlapping the door by about a third (if less, it requires double clicking the macro buttons or it doesn't function at all). Like the search function, adding a range seems to have no effect (nor does all, however page does work). Thanks again.&nbsp; Thought I'd strike while I caught your attention.
1665463965

Edited 1665464108
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Do you have the grid enabled on the page that you are having issues with Stik? And how did you set the color? Either of these two issues would be fixed by the coming update. EDIT: I missed that you already said that you didn't have grid enabled. There was a long standing bug with the script that prevented it from working reliably without the grid. This update should fix that.
Thanks for the quick response.&nbsp; I'm very glad to hear that I'll be able to use your great API with out the grid (which i've always found to be too confining) and look forward to using it.&nbsp; I've got a group of players that have played in my worlds off and on since 1980 (yeah, we're old) that are chomping at the bit to play their first online D&amp;D adventure starting this Sunday.&nbsp; Your timing couldn't be better.
How do I know that I have the latest version? The help when I select Doorknocker says v1.1
1665534072

Edited 1665534128
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
It hasn't been merged yet. Not sure when Roll20 will be doing an API merge next. The help will update to look exactly like the forum OP here (starting at the Door Knocker v1.3.
Hello,&nbsp; Has it been put on any github while roll 20 uplaods it ?
1665583768
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You can find it on my fork of the roll20 repo
Thanks Scott C. but I think I will wait for Roll20. I have an apprentice DM that would like to use it too but I am not comfortable walking him through the process of copying the code inserting it into his script library.
1665592547

Edited 1665593193
Hi Scott, thanks for the link.&nbsp; I'm encountering the same kind of issue that other scripts with UDL. When i "Open a door" either with the special key token, or with a token and the according macro, i have to move the token again for the DL line to disappear (same for closing).&nbsp; looks like the dl line isn't updated unless a token is giggled a little.&nbsp; Is it something that you experienced too ? Thanks for your answer.&nbsp; EDIT : actually i checked the sand box when opening or closing a door (i use !knock --key|anyopen) and the sandbox goes crazy listing about 20.000 lines on every command. and then eventually opening or closing a door.&nbsp; I can invite you in the game in you wanna check things out if you want.
1665594384
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, odd, even on a complex map, it shouldn't do that. Are your dllines draw with the freehand tool potentially?
1665599577
David M.
Pro
API Scripter
If they are freehand and are extensive, you may want to look at the "Simplify" option of the PathEditor mod (Example in use&nbsp; here ). It might save you some time without having to re-draw everything. Though, you may want to try it out on a copy of the path(s) first to see if the default settings will work for your specific case.
Nope, very easy map, just a few walls and a few dorrs, straight lines, all drawn with the line tool....
Happy to report that 1.3 is working well for the most part.&nbsp; Search now works at the ranges I've tried.&nbsp; And push is working with ranges. However, it appears there is a typo in the instructions which says to use "/" instead of "|" before range/all/page/campaign. (It was "|" in the last version's&nbsp; instructions.&nbsp; Push works at ranges using "|" for the separator. (I haven't tested using all/page/campaign) It worked as GM and also as player on my dummy account.&nbsp;&nbsp; However, I'm seeing similar issues as Lionel V. for key.&nbsp; When I use open (with or without range) the console spits out ~2400 lines of code and opens the locked door after 5-6 attempts.&nbsp; For close, it's only 400-650 lines of code and closes after 2-5 attempts.&nbsp; Toggle shows a similar amount of code as open but I could never get it to work regardless of the number of attempts. As before I'm not using the grid.&nbsp; I tested on a very simple tavern map using the polygon tool to draw all straight lines.&nbsp; I also used adapt on both the walls and locked doors to make sure that color wasn't an issue.&nbsp;&nbsp; (There are no unlocked doors on this map. I tested push on another map with no issues and switched to this more simple map when I discovered that key was being problematic.) Thanks again for improving this excellent API.&nbsp; Most important to me is my players being able to search and then open unlocked doors so I'm very happy with the results.&nbsp; I hope this info is helpful and I look forward to trying out hidden doors in the future.
1665668026
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, odd. Thanks for the info Stik and Lionel. I'll try to replicate this weekend.
Hello. I´m finding this addon quite useful. However I´m having an issue trying to write a macro for closing all doors of the page at the same time. I´m trying !knock --key|toggle|page but it doesn´t work. What am I missing?
1666311512
Kraynic
Pro
Sheet Author
From looking at the instructions on the sheet, it looks like it would be: !knock --key|anydoorclose I haven't tested this, but it should be worth giving a shot.
Hi, as asked in another thread, include my first bug report and the asked ones too Hi I don't see the update live so i imported it from your merge It looks like it works for all the actual doors, but when i try to create new ones, when i search they "glow" as a valid door, but when i try to open, the new ones never toggle, even with gm keywords/account But all the previous ones works perfectly i discovered that while trying to toggle a window, so i was changing his color and type of path, and nothing worked ... so i investigated. screen : (1st i search, then i try toggle) here are the requested additions : <a href="https://imgur.com/a/FB5PksH" rel="nofollow">https://imgur.com/a/FB5PksH</a>
Found a few more clues After creating the new wall (or changing the color, which replicate the bug on my side), i can search it but not open it with a !knock --push|toggle|2, BUT if i do specifically a !knock --key|toggle|2 command which output a lot of text (i pressed the "Toggle Doors" ability linked to the DoorKnocker Token) but not the |open or |close command, THEN the door is closed and can be toggled with the push or key|toggle, but there is still issues with some open/close commands after that :x Hope it helps !
1666341184

Edited 1666343458
Kraynic said: From looking at the instructions on the sheet, it looks like it would be: !knock --key|anydoorclose I haven't tested this, but it should be worth giving a shot. Unfortunately didn´t work. For now I am going to need to close all doors one by one when the spooky stuff starts for my doomed adventurers Edit: I found what I was missing. I just placed a player token in the map and wrote a macro as a token action and it worked!
1666484283

Edited 1666484361
I pulled version 1.3 and installed it, but I can't say it's working.&nbsp; The search function seems to work fine. However, attempting to open or toggle unlocked doors, when it works, is very slow. Looking at the output console, the slowness may be explained.&nbsp; I probably hit the macro button to call the toggle command about 20 times, waiting for it to work. It output roughly two hundred thousand lines of code. That's about 10k lines per click, all of them in the format you see below: "|seg pos:2653.04,1454.643,1 / 2641.902,1449.475,1" "|distance:2368.298935782601 vs 63" "|seg pos:2641.902,1449.475,1 / 2637.51,1452.054,1" "|distance:2363.7965756418216 vs 63" "|seg pos:2637.51,1452.054,1 / 2638.373,1455.505,1" "|distance:2363.7965756418216 vs 63" "|seg pos:2638.373,1455.505,1 / 2634.056,1460.063,1" "|distance:2360.0067811565714 vs 63" "|seg pos:2634.056,1460.063,1 / 2629.745,1462.408,1" "|distance:2355.605015168927 vs 63" "|seg pos:2629.745,1462.408,1 / 2625.431,1464.996,1" "|distance:2351.1928359403023 vs 63" "|seg pos:2625.431,1464.996,1 / 2624.569,1467.584,1" "|distance:2350.2326984400925 vs 63" Is that helpful to anyone? I'm using a rectangle drawn as one-way in UDL, with the transparent side on the outside. This is a nice effect for players to be able to see the image of the door in the map layer and an indentation in the wall.&nbsp; The fact that the door search functions correctly would seem to indicate that the color designation is not the problem.&nbsp; Any help would be appreciated.
I've installed the github repo version and verified that 1.3 is loading in my game, but I'm still getting the issue where doorknocker doesn't work on new lines drawn since the change in the colour picker from hex to rgb.&nbsp;
1666542445
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I was able to get it to work by using the adapt command. But selecting a line drawn on the DL layer with the new color picker did not respond to the settings panel method.
Well, after two sessions with my gang of six that play in my game, the results have been odd.&nbsp; With just myself, my dummy player account and one of the players, searching and opening/closing/toggling unlocked doors works perfectly for me and either player.&nbsp; BTW, this was for unlocked doors that I just chose the correct blue from the color picker to designate.&nbsp; I did not use the adapt command.&nbsp; Of course, locked doors still exhibit the runaway code in the console. However, when it's me and the six players, while t he search function still works perfectly,&nbsp; no amount of action by player using his selected token or me will open/close/toggle an unlocked door.&nbsp; &nbsp;I didn't notice any unusual activity on the console like when trying to activate locked doors.&nbsp; Oddly, the only way I could open an unlocked door was to repeatedly activate the --key|open function and it would eventually open (the --key|close worked the same way).&nbsp; The runaway code was in the console. On everyone quite the game, open/close/toggle worked for me and my dummy account again so I assume that the number of players is at least part of the reason --push didn't work during the session but it seems odd that it seemed to have no effect on the --search or --key functions. I realized I had a bunch of unneeded maps, images, character sheets, etc. in my journal that I think were affecting my graphics performance.&nbsp; I cleaned&nbsp; up and minimized after the session.&nbsp; I don't know if that would also affect API performance but I'lll find out Sunday at our weekly session. I hope some of this info can help resolving the problems this API seems to be having.
Hello Scott, have you been able to spot out the issue ? I still have the same issue with those numerous lines appearing in sandbox when trying (with no success 2 out 3 times) to open or close doors...
keithcurtis said: I was able to get it to work by using the adapt command. But selecting a line drawn on the DL layer with the new color picker did not respond to the settings panel method. I finally got some time to test this and agree with keithcurtis - using adapt seems to be the only thing that works. For everyone else that doesn't want to spend a ton of time trying to figure out how to do this, here are the steps I followed (this assumes you already have DoorKnocker installed.) On Dynamic Lighting layer, select a drawn line that you want to use for unlocked doors (typically a green line.) Type the following into chat:&nbsp;&nbsp; !knock --adapt|unlocked|campaign and hit enter. On Dynamic Lighting layer, select a drawn line that you want to use for walls (typically a blue line.) Type the following into chat:&nbsp;&nbsp; !knock --adapt|wall|campaign and hit enter. On Dynamic Lighting layer, select a drawn line that you want to use for locked doors (typically an orange line.) Type the following into chat:&nbsp;&nbsp; !knock --adapt|door|campaign and hit enter. Once those steps were complete, unlocked doors seem to work without any delay.&nbsp; Locked doors have about a 2-3 second delay. -Adam
1668628753

Edited 1668629852
I've been following this thread since its beginning, trying all the suggestions that have come up. I've installed the new version of doorknocker (1.3) and am still having weird issues. I have&nbsp; !knock&nbsp;--key|toggle &nbsp;set up as a token action for myself as GM; When a player moves their token near a door and tells me they want to open it, I activate the command (or tell them it's locked). This worked 100% of the time before Roll20 made its changes. All of my maps use a grid. After the changes and after deleting Door Knocker and installing the new version (1.3) the above only works about half the time for some tokens (always with a few seconds delay) and not at all for others. Sometimes, for a certain token, it only works for doors drawn with horizontal lines but not vertical ones. Sometimes it's the other way around. It doesn't seem to matter whether it's a marketplace token or one that's custom made. I have drawn a new door in a wall and tried&nbsp; !knock&nbsp;--key|toggle &nbsp;with a token pulled from the journal and had it not work, then pulled a different token from the journal and it did work. I have made duplicate maps on different pages and had the command work (or not) in a manner completely different from the original map. I REALLY liked the Door Knocker MOD when it was working. On another note that may be pertinent to this issue, I've noticed that the API sandbox goes down A LOT lately. I have the heartbeat &nbsp;MOD loaded but don't even bother looking at it anymore; I just keep a browser tab open to the API page and restart the sandbox whenever there's a pause in the action. Chrome Version 107.0.5304.107 (Official Build) (64-bit) Browser Extension: Malwarebytes Browserguard 2.5.4 Hardware acceleration is ON
Hello- I just installed Door Knocker in my campaign,but i keep getting this error when i try to open doors. Any help would be appreciated, Thanks! Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined at apiscript.js:738:34
Excellent Mod. I'm using it until the Built in Door functionality is improved.&nbsp; However,I've run into a problem. The Hidden doors don't do anything except act as another section of wall. They don't reveal, they don't open, they don't toggle, even when using the DoorKnocker UI Token. I've fiddled with the Adapt setting, changed line colors, but no success. There's no output to the Mod Output Console either.