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

I made a automap load request, is this possible with the API?

This is what I am looking for :

"
I feel in my campaign, I am looking for a better system for world travel. I want to create maps, and have players be able to travel fairly quickly. All of my previous attempts at this just seem to bog things down. I try to use the zoomed out map and say, "you make it to here, etc"

However I am looking for chaining intermediate size maps together. Such that each square is 220 feet. So each 120x120 would equal one of my world map squares of 5 miles.

What this would allow me to do is keep a chain of yes (a lot of maps - auto archive???) where players can travel along and travel the world. A feeling I feel every attempt I try to replicate on roll 20 fails.

To make sizable amount of maps possible and automatically interconnect them would require a link on the side of maps to move the players, and load them on the new map. I don't mind having to copy and paste the tokens, etc.

Currently I am thinking I might have to find some other software for the players to use for this purpose, and just use roll 20 for all of the "destination and encounter" maps.

What does everyone else think about this?
"

Could an API script be told what map to load and set the players to as well as copy and paste the selected tokens?
August 06 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
Currently, the API cannot make Pages, but it can certainly modify the maps currently on a page; it can create tokens just fine; it can move the players by setting the player page.

So, the answer to your question is "yes", it can be told to load a particular map, it can set the players to that map, and it can place the tokens on it, provided it doesn't have to create the page.

Probably what you would do is have 1 or maybe 2 pages setup that the API script knows to use. It would then change everything on the page to "be" the map you want, then move the players onto it. I suggest 2 pages, as then it can modify the one the players are not on, then swap the players to it when it's ready. (Kind of like the back buffer in old video games!)

One other consideration: the API cannot delete things, so it would probably need to take all the assets currently on the page and reuse them if possible, and move them to a convenient place to have you delete if it didn't need them (upper left corner of the GM layer, for example).
Right.

So, I'm not looking for it to create(sorry if there was confusion). Essentially I want to set it up all ahead of time. Where there could be a token with a token action that I could click which:

1. Moves the Selected tokens to the top Left (hidden) on current page.
2. Creates selected tokens if token ids don't exist on loading map.
3. Place tokens / Move tokens to that edge of the map.
4. Move players to that map with whatever map ID/Name (if ID I need a way to find map ids.)
In all honesty, I guess I am looking for just moving to the new map.

I think just copying the current and deleting them should work well enough right?

I think if you delete what you have copied it still keeps them copied?
August 06 (11 years ago)
Paul S.
Sheet Author
API Scripter
So all you're really needing - since you're going to have 100s if not 1000s of these 5 sq mi (how big is your world?) maps already made - is an API that moves players by setting the player page. Not sure if API can unarchive then auto-archive a map. Probably? I'll dink around and see what I can come up with.

For map ID - I'm assuming you can name the files uniquely or use unique tags for each map.
August 06 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
The API can set the Archived property on pages
Dang, I just realized it is probably 300 x 300 total miles. So only 3600 maps? :O

I might have to pick a different medium scale.

Perhaps 25 miles x 25 miles? Each Square would then be 1100 feet, rather than 220. So a mile would be 4.8 squares.

I would only need 144 maps?

I will say it would be one kick butt world and allow for the level of detail I am looking for.

It would make night travel nearly impossible though. with 60 feet of darkvision :/
August 06 (11 years ago)
Paul S.
Sheet Author
API Scripter
Yep - just saw that in the wiki. I'd have the character-linked tokens on a "start" page and use those as the source for copying tokens from page to page I think. In my mind that'd be easier.

So - you've got:
Unarchive a map page
Change players to unarchived map
On change - archive old map
Copy tokens on Start page to unarchived map

Sound about right? The problem I'm seeing is his concept of having lots of maps...

My experience with API is VERY limited (trying to teach myself as I go here).

He'd basically have to input the name of the map to be loaded and the name of the map to be archived correct? I can't think of a way to automate this (without having naming conventions like Map01, Map02 - but then he wouldn't be able to load a map out of sequence).


August 06 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
That's part of the reason I think it would be easier to have two pages that just become the map you want. It would be much faster to create a mapping of art assets to coordinates. The hardest part would be generating the urls for the images, but come clever javascript in the console of the library page can write it for you complete with name, then you'd just have to copy it into the script as a lookup. Probably you could have a standard naming convention for the files ( map_overland_5_13.jpg, map_detail_5_13_12_28.jpg, etc) then the dynamic generation of the lookup and the creation of the tiles is pretty easy.

You could even have the overworld map automatically seeded with transparent tokens on the gm layer with a macro to load the players on that detail map.

Really though, do you want to make that many maps? It might be better to look into procedurally generating appropriate maps for the wide open spaces (seeded off of the coordinates so they are always the same when you visit) and override that with specific maps for places of interest.
August 06 (11 years ago)

Edited August 06 (11 years ago)
"
Really though, do you want to make that many maps? It might be better to look into procedurally generating appropriate maps for the wide open spaces (seeded off of the coordinates so they are always the same when you visit) and override that with specific maps for places of interest.
"

Not sure how this would be done.

I have no problems with somehow making this easier :)

art assets in terms of urls instead of having the pages already made? Not sure how that would work.


I think the most minor issue is the player tokens. I can always drag and drop from the character list (tag : adventurers) if I forgot to copy before clicking the button to load the appropriate map.

The problem I have with roll20 in this instance is there seems not be any solution for large worlds(lots of maps). The horizontal page scroll and archive system seems archaic :/ ( I say this after just buying a year sub)

August 06 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
Procedural generation is a way of creating content by supplying the pieces and an algorithm to assemble them. Think Minecraft world, or Angband dungeon, or pretty much all of Dwarf Fortress. On the simple scale, it's just like the charts in a DMG that lets you create a random dungeon; just a set of rules for how to place things.

As for art assets, I'm talking images in your library. If you did draw every map for your world, instead of creating 144 pages and archiving/unarchiving them, you could just name them so that the name explicitly describes the location, then get all the names from the library (manual step sadly, by which I mean running a script on that page and taking the results and putting them in the script) along with the urls. Then the script could take something like !loadmap overland 5 13 and turn that into the url for the right map to load. Then the image url can be used with a graphic on the page to setup the map.

You could even rename the page to save it for later use and apply similar rules to naming it.
It sounds like I'd go from.

1.Creating the maps,
2. uploading them into roll 20,
3. creating a page(naming it, settings etc),
4. adding the image,
5. setting it's size,
6. adding any dynamic lighting(if necessary)
7. Add any tokens with token action script links

to:

Adding the images to there as well as some other URL???

1. Creating the names with specific names
2. Upload them into roll20
3. Create a page(naming it, settings etc)
4. Running a script??? -
5. resize image, ???
6. Add any dynamic lighting?
7. Add any tokens with token action script links

Are you saying the naming convention will allow the loading script to work?

Are you refering to the script loading the image?
August 06 (11 years ago)

Edited August 06 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
Explicitly, what I'm saying you would do is:
1) Name your files in a structured way such that a program can easily extract where that map should be (and other qualities if needed, like size in tiles).
2) Upload those images to your library (https://marketplace.roll20.net/library)
3) Use client-side javascript to build a lookup table of those names -> uploaded url (I would help you do that)
4) Insert that lookup table in the map script
5) Add 1-2 pages with a name like "Dynamic Map"

During play, then you'd execute something like !go-to-map detail 54 23 and the script would:
1) Build the name of the map based on your info ( map_detail_54_23 )
2) Look for a page already named that (if you preserved one)
3) Otherwise, lookup the map in the lookup from 4) above.
4) Find a "Dynamic Map" and place the map on the map layer there.
5) Add character tokens in prescribed location
6) Move players there.

To me, that just seems like the logical way to do it as it requires the least effort. You really only have to name your maps after where they are and setup the lookup table (a mostly automated process with a few manual steps) and everything else just works.
August 06 (11 years ago)

Edited August 06 (11 years ago)
Wow, I didn't know you could access your library out of game. (yes, you can laugh now).

However I didn't have a need before???

I would do all of them 120x120,

Seems like it would work really well.
August 06 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
You know, not many people know about that library page, so don't feel bad. =D
August 06 (11 years ago)
Paul S.
Sheet Author
API Scripter
I agree with Aaron's approach as easiest. However, it wouldn't allow you to have a set of pre-gen encounters for each map. You'd basically have to build each encounter on the map after it loads. Which would take some time in game to accomplish.

If you go with the archive/unarchive option, you could build all your maps with pre-gen encounters.
August 06 (11 years ago)
The Aaron
Roll20 Production Team
API Scripter
Well.. speaking of encounters... =D

Actually, I can imagine some pretty compelling ways to speed that along, particularly with procedural generation of the map.. Would be a large project, but the whole community would benefit...
Right, I just don't see any other tool out there to do what I want. Which is to create an interlinked world. Currently I attempt to do "world travel", but I honestly am terrible at it. I have encounter maps that are 5 feet a square, and a world map that is 5 miles a square.

I tried to make a massive world travel map but it was too big for roll 20.