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

quickest way to make a multisided token or rolltable from a selection/folder of images?

I subscribe to  czepeku  map and token artists, one of their best features is that they produce many versions of the same map for different purposes. I use these in roll20 by creating a rollable table and adding all the map variants to it so that I have a multisided token that I use to flip between different versions of the map. Right now I'm basically doing this manually and it is a laborious task. I've just come to a map from them with 83 odd variants and was hoping there was a way i could automate at least some of the process, i'm looking at TableToTable's library function and tokenmod's imgsrc function but i can't see what exactly will work best. Really the ideal would eb if there was a way for em to just drag and drop the images into a folder in roll20 and then run something that makes all the images in said folder into a multisided token or a rolltable. any thougths?
1755699398
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi lark86! I'm adapting an answer I gave elsewhere the other day, but I'm going to see if I can find more directed advice, from timmaugh, the creator of Metascripts. With Pro, this is much quicker. Go to your mods page and install TokenMod. Make sure that any images you want to add to a token are on the page with the token. Select the base token and run this command: !token-mod --set imgsrc|+@{target|token_id} --ids @{selected|token_id} When prompted, click the image you want to add. There's probably a way to select all at once and do them with one command using a metascript, but this way you can be sure of the order.
1755722705
timmaugh
Forum Champion
API Scripter
Hey, lark86... First, let's get on the table that what you're going to be able to do will be in large part measured by whether you take the step to download the images and then re-upload into your library. That is going to give you full control over using the images, without the limitations of marketplace images. There are some things you can do on the experimental sandbox, but the xbox is not reliably boot-into-able, and I've seen the "things you can do" become "things that break the sandbox" because of other development. Because of that, we'll stick with a default sandbox approach that requires the images to be something other than marketplace images. TableToTable would let you drag all of the images to a map, then manually construct the order (based on which order you clicked the maps into the table), but it would be, as I said, manual. If you want a somewhat quicker, somewhat more automated manner, we can start with Keith's suggested command line, and augment it with the Metascript Toolbox. Once you have TokenMod and the Toolbox installed in your game, go to a map and drag out all of the map art. If you click on one entry in your library, you should get a pop-up dialog of your "Uploads". Multi-select the art you need, and drag it all to the board. I suggest using a new map, to minimize the potential for mistake and so you don't have to manually select your tokens... but I'll show what you would do on a map that HAS other tokens and a map that does NOT have other tokens. On a New Map - No Other Tokens If you're on a map with no other tokens, you DO NOT have to select your tokens at this point. You would run this command: !forselected token-mod --set name|NameSet{&i} {&select *} On a Map With Other Tokens Present If you're on a map where there are other tokens, you will need to select the artwork you just dragged out. Then you would run this command: !forselected token-mod --set name|NameSet{&i} Explanation Both of those will perform a "rename" of the tokens to be of a pattern like "NameSet1", "NameSet2", etc. You can change the "NameSet" stem to be anything that works for you. The point, here, is that we're giving them a name that matches a pattern so that no matter which direction you've gone, we'll now be able to select those tokens by that pattern in our next command line. So, no matter which of the paths you chose, just above, you're now going to run the SAME command line, below. Step 2 Next, select ONE of the map art tokens and double-click to open the token properties. Delete the token name (it will no longer be caught by sharing the name pattern we used in the first step. I'd suggest moving this token to a place on the board where you can keep track of it, because this is going to be the token that collects all the other artwork. After all that is done, run this command: !forselected(^) token-mod --set imgsrc|+@^(selected|token_id) --ids @{target|token_id}  {&select NameSet*} ...where "NameSet" matches whatever you used as your naming stem in the first step. This will automatically select all of the tokens on this page that share the pattern "NameSet"-followed-by-anything, and will iterate over them to copy their art to the token you choose with the targeting interface. So, for the token to target, click on the token where we deleted the name. That token will have all of the art in its list of sides. At this point, configure the token with the properties you need, then use it as the default token for a character so you can drag it to whatever page you need. I just created a character called "MapMule", left the token selected, and edited the character properties. On that screen you can click a button to use the selected token as the default token. Let me know if you have any questions. The commands are straightforward enough if you understand why they matter in each situation, but in order to make sure I'm conveying enough information so that someone else can understand why they matter, the whole explanation gets more verbose and gets in the way of the whole "straightforward" thing. =D
ok first off, a massive thank you to both of you SO much for your extremely helpful and quick replies. I have had a go at implementing your instructions Tim and it works exactly as promised but an issue has come up: I have an excel spreadsheet that I use to create a list of the different maps and their corresponding side on the multisided token so i can pick which side without having to scroll through them all. This is done by selecting all the files in their folder and copy pasting the path into a column in the spreadsheet, a series of excel formulas then process that down into a list of just the part of the filename i want and then puts all of them together into a string written in a  format i can copy past into a roll query as a dropdown list which then uses the tokenmod set current side function to select the right side. This only works if the sides on the token are in alphabetical order according to the original filenames of the maps. the system you've created doesn't seem to quite do that, is there any way to fix this?
1755786029
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
lark86, have you considered looking at the Director script ? It sounds like all of your images are the same size. If you made your page 140 pixels larger than your standard map image, it would give you a visual, named directory of the maps, and even call up the tokens associated with that map. It's not precisely what the script was written for, but it might serve your needs more easily than a spreadsheet.
I've just given that    Director script   a go and it's a bit beyond me, can't seem to get it to actually populate the page with a background. Even if i could it looks like you have to add each image one at a a time and have named them in roll20 which is not really what I'm looking for, thanks though. What I want is a way to upload a load of variants of a given map in one go and then have some kind of visual representation of each variant or a written list that I can then select from to be the background of the page. Using a multisided token on the map layer and having rollquery list that corresponds to the correct sides was working but it's just a bit labour intensive to make that work as i have to manually create the multisided token, i was hoping your scripts would sort that but it seems as the order they add images to the token can't be perfectly controlled it won't align with the list i create from the original filenames alphabetised. I was then hoping i might be able to use Keith's TableToTable Library function to have a thumbnail style preview of each map but i can't see a way to then use that directly to populate the background layer of the page.
1755790148
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
TabletoTable isn't mine. :)
keithcurtis said: TabletoTable isn't mine. :)     doh
1755792967
timmaugh
Forum Champion
API Scripter
Well, TableToTable is my script... so... when you say you have an Excel list, do you already have the URLs of the uploaded artwork? That's really where the wrench gets monkeyed, because in uploading the images you create a new data point (the URL of the upload) that you have to associate back to the image in your rollable token. In other words, you have an alphabetized list now, but what you really need is to have the URLs of the images (which you only get after you upload them) sorted according to the associated name. The TokenMod command (using metascripts) previously suggested is the quickest way to get the images in a list if you don't care about the order. Since you DO care about order, then I think TableToTable is going to be the quickest. It's not going to be fully automated, but you can assign images by a series of clicks rather than having to type or tab between applications. It will mean that you can recognize each map image in order to properly associate it with the correct row in your table. The task can be broken down into sub tasks: 1) uploading artwork (mass upload, not labor intensive) 2) collecting URLs (can be automated, not labor intensive) 3) building a TtT library handout (automated) 4) using the TtT interface, building a new table based on your existing Excel list (quick) 5) assigning the images from the library handout to each row in your table using the "clipboard" interface (2 clicks per row) That is about as quick as the process is going to get with having the major disconnect of having to manage the URLs that only get created once the images get uploaded... however, some workaround might occur to you from taking the list of URLs collected in Step 2 (above) and pasting them into your Excel sheet (somehow assigning/sorting them in that interface in a way that preserves their fidelity). If so, I'll leave that to you. But, if you'd like to proceed with using TtT to manage this, I can walk you through the steps. Let me know.
1755794016
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Since this requires more of a programming approach, I wonder if there's a ScriptCards solution that can order the processing...
1755794176
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Faces script can also change token faces through a visual interface. It can read the images from a table, and change a token to have any of those faces through a graphical UI in chat that includes displaying the name of the image. Not sure if it helps any, but throwing that out for consideration.
1755802322

Edited 1755802392
timmaugh said: Well, TableToTable is my script... so... when you say you have an Excel list, do you already have the URLs of the uploaded artwork? That's really where the wrench gets monkeyed, because in uploading the images you create a new data point (the URL of the upload) that you have to associate back to the image in your rollable token. In other words, you have an alphabetized list now, but what you really need is to have the URLs of the images (which you only get after you upload them) sorted according to the associated name. The TokenMod command (using metascripts) previously suggested is the quickest way to get the images in a list if you don't care about the order. Since you DO care about order, then I think TableToTable is going to be the quickest. It's not going to be fully automated, but you can assign images by a series of clicks rather than having to type or tab between applications. It will mean that you can recognize each map image in order to properly associate it with the correct row in your table. The task can be broken down into sub tasks: 1) uploading artwork (mass upload, not labor intensive) 2) collecting URLs (can be automated, not labor intensive) 3) building a TtT library handout (automated) 4) using the TtT interface, building a new table based on your existing Excel list (quick) 5) assigning the images from the library handout to each row in your table using the "clipboard" interface (2 clicks per row) That is about as quick as the process is going to get with having the major disconnect of having to manage the URLs that only get created once the images get uploaded... however, some workaround might occur to you from taking the list of URLs collected in Step 2 (above) and pasting them into your Excel sheet (somehow assigning/sorting them in that interface in a way that preserves their fidelity). If so, I'll leave that to you. But, if you'd like to proceed with using TtT to manage this, I can walk you through the steps. Let me know. I think this is the method i'm gonna use going forward keithcurtis  said: The Faces script can also change token faces through a visual interface. It can read the images from a table, and change a token to have any of those faces through a graphical UI in chat that includes displaying the name of the image. Not sure if it helps any, but throwing that out for consideration. but i'll def look at this thanks loads both of you
1755866213
timmaugh
Forum Champion
API Scripter
OK. I just ran a test case to verify the steps you have to do, and I realized I never updated TableToTable when Roll20 added a new storage location for uploaded files. It's basically another pattern I have to match when looking for and/or building an image location. Shouldn't take long to get incorporated. Let me do that, first, then I'll come back with the new code and the steps to do what you're looking to do.
will say I've been getting a funny bug where if my pointer is over the library button of the chat buttons for tabletotable the pop up keeps repeatedly blinking on and off and prevents me from clicking the button, only way I've found to fix it is to put more text in chat until the popup can fit aligned below the button instead of above. hadn't mentioned it coz i assumed it was to do with my setup. I use chrome on a pc
1755876658
timmaugh
Forum Champion
API Scripter
Yes... that's a quirk of the Roll20 interface, itself. This is not the only script it affects this way... but not every script uses pop-ups like this, so you might not notice it on other scripts. I use pop-ups on a few of mine, so I tend to notice it a lot. It's just a matter of how Roll20 draws the "tipsy" class on their canvas, so not really anything we mortals can do anything about. I'll raise the issue with the devs and see if they can do anything about it. In the meantime, the updated code is finished (available at my repo until it goes through the merge next week to be a part of the one-click), so now I'll turn to writing up the instructions for what you're looking to do.
1755880910

Edited 1755898769
timmaugh
Forum Champion
API Scripter
OK, if you've grabbed the updated code from the previous post (or if you're reading this after the merge goes through and you have the latest TableToTable code from the one-click), then you're ready. Let's get to it! Step 1 - Uploading Artwork I'll leave this to you (and the extant resources available) since this isn't a process that is unique to the TableToTable workflow. The only necessity is that the images you want to reference are in your library (or, specifically, not marketplace images -- there are other ways to reference images). Step 2 - Collecting URLs from Your Library There are 2 methods for collecting the URLs that I'll mention. Option 1 Use a bookmarklet created by The Aaron to get the URLs of images in your library. The steps are outlined in this post .  Pros: it's quick Cons: the library page is deprecated by Roll20, so it might not function forever the links generated are for all of the artwork you let load onto the page (by scrolling down), so it can provide more than you actually need... although your newer uploads should be near the top, so this might not be as big a drawback, depending on your library (having more URLs than you need will not break the process, it just might clutter your workspace later) If you take this option, be careful how you select the links that get written to the page. If you drag-select "up" (i.e., to the beginning), it might look like you have stopped your selection at the start of the first URL... but if you copy this selection and then paste it in a Roll20 handout, you might find that you've selected a whole lot more than just the text. You can get around this (while maintaining the "drag-up" direction) by stopping one letter short of the start of the first URL. You can later add this letter (an "h") before you paste, or you can extend your selection (via SHIFT+LEFT) by one letter prior to copying the URLs. Option 2 For this option, you're going to drag out the maps as tokens/graphics to a new page in your game. The quickest way I've found to do this, once you're on the new page in your game, is to navigate to your Art Library tab in your game (1), then click My Library (2): Click on one of your assets to open your "Uploaded Assets" window: Use this window to multi-select the maps you want to drag out, then drag them to your new page. Here I have selected and dragged out 3 images (they are stacked on top of each other when they hit the VTT): Next, run this command from your chat input: !forselected(^) *@^(selected.imgsrc_short)* {^&simple}{&select *} That will select everything on the page (why we went to a new page), and output the text of the image source property, one at a time. Note that the asterisks are required so that the images do not render AS images in your chat: Every 6 messages, the chat interface will reprint your current "Speaking As" name, and since you're working in the dozens (if not hundreds) of maps, you'll see it: You can clean this up pretty quickly in something like Notepad. Select all of the URLs (it will scoop up your Speaking As names), and copy it. Paste that into Notepad and do a search/replace on your name followed by a colon. For instance, from the above image, I would search for timmaugh: ...and I would replace it with nothing. Pros: does not use deprecated functionality allows you to be exact in the maps you use so that you only are dealing with the URLs you need Cons: slightly more manual (creating a new page, selecting your maps from your Uploaded Asset window, replacing instances of your name from the text) Result Congratulations, you have the URLs of your artwork. On to the next step... EDIT: you might notice that the images are all named "max". Images in your library can be referenced via "original", "thumb", and "max". Using "max" as the name will work for constructing a rollable token, but I haven't explored what it would mean when you use that multi-sided token as a map on a page. "Max" might work better than "original," or it might be that you need "original" because it works better. Once you figure that out, you can run another replace for "max" and replace it with "original" pretty easily.
1755881783
timmaugh
Forum Champion
API Scripter
Step 3 - Building a T3 Library Create a handout and name it something useful. I'll call mine, "MapTokenLibrary". Edit the handout, and paste into the Notes section the set of URLs you just derived. Save your changes. Run this command from chat to open the TableToTable Control Panel: !t3 From the resulting panel, choose the second button from the right (as you noticed, the popup will sometimes make this difficult, but you can make it work -- or you can enter text below the panel until the popup renders properly without interfering). You'll get a query asking you to select the handout to use to make the library. Pick the handout you just created. You'll get a confirmation message whispered to you in chat. Choose 'Yes'. After a moment, you'll notice (if you left the handout open) that the contents have updated to show the images represented by the URLs. If you click on any of them, you should see the artwork become ensquared with green. (Yes, I just made up 'ensquared'.) The script will only allow one image to be selected in this way, so clicking on other images in the handout will move the green square to that image, instead. (This is effectively putting the image on your script "clipboard" -- not your system clipboard for copy/paste, but rather instructing the script to remember this image as the one you're currently working with. This will come back in Step 5.)
1755885842
timmaugh
Forum Champion
API Scripter
Step 4 - Getting Your Excel List into a T3 Interface This is the trickiest part of the whole operation, but nothing terrible. First, in Excel, get your data into three columns and give yourself a header row. Name the columns: Name Weight Avatar It doesn't matter the order they're in; the text is just there so T3 knows how to recognize the data. Also, you don't need a value in the Weight column; T3 will assume you want it to be a weight of 1 if there's nothing there. Also-also, you won't have any data in your Avatar column, since that is meant to hold the URL of the image, which we won't connect until Step 5. Next, go back to your game and use the T3 Control Panel (accessible by running !t3 from chat). Click on the first button from that panel to open the default T3 Workspace. Your workspace should open. If you have any tables already loaded or in the workspace, get rid of them by using the red 'X' button (1) to the right of the title: ...then choose the NEW button (2). In the resulting query, enter a unique name for your rollable table. I will call mine "Chapter1Maps". Your interface should look like this: Now go back to Excel and copy your data (including the header row): Back to your game and the open interface, click to edit the handout. In the notes, select the entire table beneath the entry for your new table and delete it: In that same position, paste your data from Excel, then hit Save. Your workspace should now have your Excel data beneath your table entry: Click the Process button. TableToTable will create the rollable table for you, populating the entries with the names from your list. It will report what it does (including creating the table and the rows) in a chat panel: In your workspace, you'll notice that your table has gone from labeled "New" to being labeled "Processed." Use the red-X button to remove it again. Then click the Refresh Table List button to rebuild the list of tables you are able to load (you just added one, so we need our interface to recognize it). Next, click the GET button and select your new rollable table from the list. Notice that it loads this time as a "Replace", and that it has all of the rows you brought over from Excel:
1755886466
timmaugh
Forum Champion
API Scripter
Step 5 - Assigning the URLs to Rows Already TableToTable has created your table and automated the process of getting your rows entered. The rows are in the order that they were in when you built your list in Excel. Now we just need to assign the URLs from the images to the appropriate/associated row. To do that, we're going to have open both the Library handout (I called mine "MapTokenLibrary", remember), and our Workspace handout (where we just loaded up our table). I like to position these right next to each other. When you click an image in your library (on the left), it will get the green square letting you know you've placed it on your "clipboard". In your Workspace (on the right), each row will have a green button with an anchor on it. This is your associated "paste" button for the script's clipboard. So, at this point, you just have to click an image in the left handout (to select it and place it on your clipboard), then click the anchor button from the appropriate row of your table. You'll see the image get added to that row in the Avatar column. Be Aware: This has not yet updated your rollable table! This has only updated our handout, where we're prepping the data to be written back to your rollable table. Once you have all of the images assigned to their proper row, click the Workspace's "Process" button to commit all of these changes to your rollable table. NOW you've updated your rollable table. Close the handouts and open the rollable table you just created to see the entries updated to include the appropriate art... or, better yet, get a token from the table and give it a try changing sides. fin