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] AreaMapper

1435461336

Edited 1441650635
<a href="https://github.com/RandallDavis/roll20-areaMapper" rel="nofollow">https://github.com/RandallDavis/roll20-areaMapper</a> This is a major script that I've been working on silently for the last few months. Type !api-area &nbsp;to get started. Features: Area maps are created and managed using a robust user interface and Roll20's drawing tools. User interface can be in whispers or in a handout. Areas are saved in state, and can be hidden and redrawn (on any page - even multiple pages simultaneously). Create as many areas as you want - it's easy to switch between them. Dynamic lighting is handled automatically. Doors, chests, and trapdoors have interactive logic so that players can toggle them. These can be locked, trapped, and hidden. Interacting with them results in animations that everyone can see. Assets (floor, wall, door, chest, and trapdoor images) can be imported via the user interface. They can also be edited through the user interface to fix unwanted border transparencies, bad centering, etc. It's really easy to change which assets an area is using. Unique assets can be used. This makes it really easy to import a map and use it as the floor image of an area. Blueprint mode is available. AreaMapper v.1.0 demo Features implemented since the video: Toggleable trapdoors. Toggleable light sources. Attached objects. UX improvements. Tutorial videos: Getting started Area lists Area drawing
love this script - simple, easy and intuitive to use, and great for on the fly creation of pretty much any scenario you might need to map out.
1435472244

Edited 1435472774
This godly. You win the world Rand, the world... jesus.
I think I just found a reason to try out the mentor subscription.
Hey Rand, If I hide an area, how do I reveal it once more? In my list of areas, I have 1 marked as hidden and none within the drawn instances. I can still select it as an active area, but draw instance doesn't appear to advance it to the list of drawn areas unless I'm interpreting the commands wrong. To get it to the state, I simply selected hide in the manage section when the area is active (I have no other active areas.)
Ken L. said: Hey Rand, If I hide an area, how do I reveal it once more? In my list of areas, I have 1 marked as hidden and none within the drawn instances. I can still select it as an active area, but draw instance doesn't appear to advance it to the list of drawn areas unless I'm interpreting the commands wrong. To get it to the state, I simply selected hide in the manage section when the area is active (I have no other active areas.) To draw an instance of an area, make sure it's active. Then activate "Draw Instance" (it has a blue border when it's activated). Drawing anything with the drawing tool tells the script where to draw the instance (and on which page). You can do this on multiple pages simultaneously if you want (a change to one area updates all instances). Also, only one instance of an area is allowed on a page, so you can use this to move the area on the page - it will replace the old instance with a new one.
Ah, I wasn't aware that I had to draw something, but I see you're using it as an activation trigger, very cool. The polygon logic for this beast must have been quiet annoying, my hat to you.
Ken L. said: Ah, I wasn't aware that I had to draw something, but I see you're using it as an activation trigger, very cool. The polygon logic for this beast must have been quiet annoying, my hat to you. Yeah - the polygon stuff was the major inspiration for doing this, and was by far the hardest thing to do. It was fun and I'm happy with how it turned out, but I'm dreading the onslaught of bug reports that might be coming. :)
Hah, I see what you mean. I don't think people realize exactly how powerful this script actually is. Perhaps we should make a Wiki, as I admit that it took some time figuring out how to use it from the video above.
yea, it takes a while to learn, but it certainly cuts down on work when both prepping and running a game once you've figured it out - so easy to redraw a map through all layers to include something like a passwall spell, or to indicate collapsed walls and ceilings on the fly, even during gameplay.
Getting started seems to the issue for me. Insalled both Visual Alert and this, typing !api-area returns "-=&gt; Visual Alert v1 &lt;=-" "-=&gt; Visual Alert v1 &lt;=-" I am sure I'm missing something somewhere but my tired eyes aren't catching it
Denathil "The Mutt" Verasi said: Getting started seems to the issue for me. Insalled both Visual Alert and this, typing !api-area returns "-=&gt; Visual Alert v1 &lt;=-" "-=&gt; Visual Alert v1 &lt;=-" I am sure I'm missing something somewhere but my tired eyes aren't catching it It looks like VisualAlert is running but AreaMapper is not. Is AreaMapper disabled maybe? Also, I find that sometimes you need to open the scripts window in a new browser or it uses old scripts rather than the latest (this doesn't happen often though).
Ken L. said: Hah, I see what you mean. I don't think people realize exactly how powerful this script actually is. Perhaps we should make a Wiki, as I admit that it took some time figuring out how to use it from the video above. Some instructions can be handled easily in the UI... for instance, based on your justified confusion with drawing instances, I just added an instruction when that command link is active (see the screenshot below). It'll be a little harder to make it clear what to do (without being spammy) on "navigation links" (command links with yellow borders that do something once) - either a wiki or more in-app help documentation would probably be good.
OK; I think I solved it, I had not assumed the order they were added to the API menu acted as a load order, switching VisualAlert with AreaMapper now launches. Now to play around and learn the app itself :) Doors; I am sure I am missing something, but attempting to put a door into a wall states that it failed to find two points. Other than that going well so far!
1435668214

Edited 1435668309
Denathil "The Mutt" Verasi said: Doors; I am sure I am missing something, but attempting to put a door into a wall states that it failed to find two points. Other than that going well so far! So for placing doors, you're drawing a polygon that captures two wall segments to connect them with a door. The script first looks for wall segment endpoints to use as the sides of the door. If it comes up short on finding endpoints, it makes a point at the middle of the part of the segment(s) you selected. Another thing to note is that walls are drawn a little longer than they actually are (so that they overlap and look seamless), so you might be "missing" the actual wall in your polygon - if you use blueprint mode, you'll see the actual wall dimensions. Let me know if that helps. It's pretty complex code that does all this, so there could be legit bugs that you're stumbling upon - try to give me meticulous details about what you do to trigger a bug (even screenshots PMed to me would be awesome), and I'll stay on top of fixing it.
Version 1.01 is live. This version brings trapdoors as interactive objects / managable assets.
@Den, you need to draw a polygon as opposed to a line so 3 points are needed to form a triangle, it took me awhile to figure out that one as well.
Ken L. said: @Den, you need to draw a polygon as opposed to a line so 3 points are needed to form a triangle, it took me awhile to figure out that one as well. Right - pretty much everything in this script is done with polygons (except for drawing inner walls). Also, it closes polygons off for you, but it needs at least 3 points to do so.
I guess I'll write a help doc in the script going over that... let me know if anything else comes up that isn't intuitive.
1435713099

Edited 1435713232
I updated the script to give explicit drawing tool options / instructions for all of the area modification drawing modes.
I added a help doc for assets... there was a lot to cover, so if you see room for improving clarity, please speak up. Also I fixed some minor art issues with assets.
How difficult would it be for me to mod in a distance -&gt; asset choice relationship? Basic premise is that you can have several size categories for an asset theme depending on the length of the wall to prevent stretching. For unclean divisions it'll find a smaller sized asset if one exists and fit it, or at least the next smallest. The end result being that we're minimizing fidelity loss for long walls and attempting to preserve aesthetics. |========]|========]|========][++++] Off the top of my head I'm guessing there would need to be a hierarchy for assets. Wood-&gt;wood 2x-&gt;wood 4x-&gt;wood 8x Stone-&gt;stone 2x-&gt;stone-4x-&gt;wood 8x Known lengths of the images, and other specific information as some assets might not allow variable size.
Yeah - this is a cool idea... I'm mulling over some of the implementation details, but let me get back to you tonight / tomorrow morning.
Just let me know where I should poke and I can mod it. I'll commit to your repo.
Ken L. said: Just let me know where I should poke and I can mod it. I'll commit to your repo. I created an issue - let's discuss implementation details there... it'd be awesome to have you contribute to this project.. just do it on another branch so that we can do a clean Pull Request <a href="https://github.com/RandallDavis/roll20-areaMapper/issues/176" rel="nofollow">https://github.com/RandallDavis/roll20-areaMapper/issues/176</a>
I'll get back to you sometime this Saturday on issue tracker as I'll have to digest some of your code before I can bring some considerations in.
Cool :)
Hey there Rand, great work here! I'm hitting a snag when trying to create new assets. I have the image selected, I select the "Create" button, but then the script freezes up. When I go to the API Console, I see the following error message: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Cannot call method 'substring' of null at TrackedObj._validateAttrs ( I'm sure I'm being an idiot and overlooking something somewhere. Any ideas on what exactly that might be?
Gilfreezy said: Hey there Rand, great work here! I'm hitting a snag when trying to create new assets. I have the image selected, I select the "Create" button, but then the script freezes up. When I go to the API Console, I see the following error message: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Cannot call method 'substring' of null at TrackedObj._validateAttrs ( I'm sure I'm being an idiot and overlooking something somewhere. Any ideas on what exactly that might be? Is the image that you selected in your image library? I think that this error could be masking a failure to create the asset as a core issue.
It is indeed in my library, but only because I marked it as a "favorite". Should I try downloading and then uploading the image?
Gilfreezy said: It is indeed in my library, but only because I marked it as a "favorite". Should I try downloading and then uploading the image? No - marking it as a favorite is the correct thing... I'm not really sure what went wrong. Somewhere in your state, you probably have a null value for something that is expected to never be null (basically an obscure bug). If you're around tomorrow, and are comfortable making me a temporary GM, so I can do some troubleshooting, I can try to figure out what went wrong. Hopefully I'll learn enough to prevent this from happening going forward.
Sure thing, I'd be comfortable with that! I'll PM you an invite to the campaign and then promote you to GM once you accept. I'll be at work most of the day, but I can stay logged in to Roll20 at the office and check it intermittently in case you need anything from me.
This seems like a pretty great script but I'm having a heck of a time getting it to work. It'd be helpful you had a "Getting Started" video (slower than the one on this page) or just a little more step by step readme. Doesn't need to be indepth, but just things like what layer you should be drawing on and stuff like that.
Brian B. said: This seems like a pretty great script but I'm having a heck of a time getting it to work. It'd be helpful you had a "Getting Started" video (slower than the one on this page) or just a little more step by step readme. Doesn't need to be indepth, but just things like what layer you should be drawing on and stuff like that. Sounds good - I have a lot going on over the next few weeks, but I'll be investing more into this script / making it workable for people in my spare cycles.
Gilfreezy said: Sure thing, I'd be comfortable with that! I'll PM you an invite to the campaign and then promote you to GM once you accept. I'll be at work most of the day, but I can stay logged in to Roll20 at the office and check it intermittently in case you need anything from me. Your issue is fixed... there's now safer handling of asset creation with better error messaging.
Rand, Again, thanks for making this. I had two questions. One: What does draw instance do? Two: How do you place a hidden door in a wall? I see that option on the asset list, but I don't see how to actually do it. Thanks
Brian said: Rand, Again, thanks for making this. I had two questions. One: What does draw instance do? Two: How do you place a hidden door in a wall? I see that option on the asset list, but I don't see how to actually do it. Thanks I definitely need to make those instructional videos. I'll hopefully be able to do that this next week. 1) An area is completely represented in state, so it can be removed from view entirely (actually deleting all of the images) and redrawn at any time. "Draw instance" puts you in a mode where you can tell the script to draw the area on a page. When you enter this mode, just use the drawing tool, so that the script knows which page and where on that page to draw the area. They are called "instances" because you can draw the area on multiple pages at once (up to one instance per page), and any changes to one syncs up with all of the others. "Hide" deletes all instances on all pages. With this mechanism, you can reuse a page and just hide / draw different areas on the page really easily. 2) After you make a door (or any other interactive object), select it and click "run script". This will bring up options about the door. If it's closed and you make it hidden, it will be drawn as a wall instead. When you do this, a blue border will appear on the door so that you can tell that it's hidden - this is on the GM layer so that players can't see it.
1.) Thank you for the explanation. I am still not sure I totally understand how the instances work, but let me play with them a bit before you try to elaborate. I think I may understand more readily once I've seen them in action. 2.) That really helps a lot. I hadn't been able to figure out what run script did yet. Thank you for answering my questions.
1437239454

Edited 1437251353
Brian said: 1.) Thank you for the explanation. I am still not sure I totally understand how the instances work, but let me play with them a bit before you try to elaborate. I think I may understand more readily once I've seen them in action. Yeah - the best way to think of it is that an "area" is everything that the script knows about the area, and it can be actually drawn on the page or not. An "instance" of an area is a drawn copy of the area. If you click on "list areas", it brings up all areas, whether they're drawn or not.
1437249186
Ziechael
Forum Champion
Sheet Author
API Scripter
From what i've read (and i've been watching this thread with great interest!) i get the impression that i'm asking a rhetorical question here but it seems like i could use this script to create a dungeon which could have certain sections of it that could be changed on the fly, for example a rotating room with a variety of optional layouts which could be toggled as needed? I hope that makes sense and that i've grasped the capabilities of this script correctly? Thanks for your work!
Ziechael said: From what i've read (and i've been watching this thread with great interest!) i get the impression that i'm asking a rhetorical question here but it seems like i could use this script to create a dungeon which could have certain sections of it that could be changed on the fly, for example a rotating room with a variety of optional layouts which could be toggled as needed? I hope that makes sense and that i've grasped the capabilities of this script correctly? Thanks for your work! What you're suggesting is a more advanced feature that I've been hoping to accomplish since the beginning. Basically, the ideal evolution would be as follows: Areas that are completely contained within state and easy to manage. (done) The ability to draw multiple instances of an area and have them sync up automatically. (done) Management of global and area-unique assets. (done) Area cloning. (pending, but the groundwork has been laid) Scaling / rotating of area instances independent of each other, so that they can all be positioned uniquely. (pending, but groundwork has been laid) Neatly drawing adjacent and overlapping areas. (pending) Area "collections", so that a bunch of areas can be pieced together and managed as a single collection, where the entire collection can be drawn, scaled, rotated, etc. (pending) If all of this was done, the idea is that you'd be able to design an area (say a general throne room, a lake area of a forest, etc.) and then reuse it in larger maps (area collections). You'd have the option of leaving it tied to the original area (so that adding a chest to one throne room area affects all maps that use it), or clone the throne room and be able to alter it independently of other throne rooms. There's a ton of utility in what's already been built, but this whole mechanism would be really cool to have. There's a major technical difficulty in doing this (aside from the work involved), which is how to handle floors. Graphics in Roll20 are rectangles, but my script draws areas with polygon floors. The way that it's actually being done is that I'm stretching the floor graphic to cover the entire area floorplan, then I'm drawing a polygon mask over the unused portions of the graphic. I use the same color as the page background, so it looks like I've actually cut the floor graphic into a polygon. When we start dealing with area interlacing (drawing multiple areas in the same space), some sacrifices have to be made. Either 1) graphics aren't used at all in this, and we revert to polygons for drawing the floors (which is going to be ugly), 2) we have to stretch one floor image across all of the interlaced areas, or 3) we break floors into smaller tiles which will be imprecise compared to the wildly open polygon logic that areas currently have. I like #2 the best by far, but it's going to be weird when you have a forest area inside your castle that somehow has trees growing out of the stone floor. Anyway, my hope for this script is that it does all this down the road, but it doesn't do it quite yet. The harder (and more valuable) features have already been implemented though, and I have a few near-term features up my sleeve that are going to make individual areas even more useful.
1437261284
Ziechael
Forum Champion
Sheet Author
API Scripter
Awesome, thanks for the explanation and visibility of your to-do list :) I'll keep an eye out for new features and play around with the current setup (which is already impressive!) in the meantime
Rand said: The way that it's actually being done is that I'm stretching the floor graphic to cover the entire area floorplan.. Well when I get to it, I think that once I mod in tiled walls, tiled flooring is not that far off. It's been busy so I haven't been able to look over it in depth yet.
1437326368

Edited 1437330413
Version 1.07 is live. This version brings light sources as interactive objects / managable assets! You can control the bright / dim light settings through the script. These can also be customized for individual light sources (select the light source and click 'run script').
!api-area to get started. I'll update the description at the top to include that.&nbsp;
ty
Hey Rand, When you archive an area, that area should disappear from that screen right and then reappear after you toggle archive, correct? &nbsp;The first part happened but when I attempted to unarchive, nothing happened. &nbsp;Looking further, it looks like it's been toggled to be hidden and I can't figure out how to unhide it. &nbsp;The hide toggle on the GUI is just greyed out even when unarchived and active. Also, I think it'd be good to have in the readme taht you can't use the handout as the gui if you've got the popout option toggled on Roll20. &nbsp;I was getting a "Not found" when trying to use it. &nbsp;Makes total sense, but it took me awhile to come to that realization.
Brian said: Hey Rand, When you archive an area, that area should disappear from that screen right and then reappear after you toggle archive, correct? &nbsp;The first part happened but when I attempted to unarchive, nothing happened. &nbsp;Looking further, it looks like it's been toggled to be hidden and I can't figure out how to unhide it. &nbsp;The hide toggle on the GUI is just greyed out even when unarchived and active. Also, I think it'd be good to have in the readme taht you can't use the handout as the gui if you've got the popout option toggled on Roll20. &nbsp;I was getting a "Not found" when trying to use it. &nbsp;Makes total sense, but it took me awhile to come to that realization. Areas have 4 states: drawn (meaning that an instance is actually drawn on a page somewhere) hidden (nothing is drawn anywhere) archived (hidden and marked as archived) deleted (it no longer exists) The "hide" button moves something from "drawn" to "hidden". Making something "archived" will move it from either "drawn" or "hidden" to archived. "Unarchiving" something just moves it from "archived" to "hidden". The "delete" button moves something from "archived" to "deleted" (just a safety measure that you can't delete something that isn't archived first). There is no "unhide" option (because that would be too complex and risky). If something is "hidden" or "drawn", you have a "draw instance" button that can be used to draw instances of the area. To do this, activate "draw instance", then use the drawing tool to tell the script where to draw an instance of the area (this tells it which page to draw it on as well as where on the page to draw it). You can draw instances on multiple pages. About the handout not working when being popped out - it's annoying, but it'd be on Roll20 to fix that. I do mention it in the "Handout UI" help page, but it's sort of a pointless thing that you learn once and hopefully remember going forward.
Totally understand about the handout thing and figured that was on roll20. Just wanted to share that in case other people had the same issue. As for rest, I understand now what happened. I thought archive unarchive would just put everything back so knowing that it doesn't makes it so much easier to understand now. &nbsp;It also helps me understand instances finally. This opens up so much going forward. Thanks.