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] TableToTable - an interface to easily copy/edit/port/share your rollabletables

1667920639

Edited 1669125713
timmaugh
Pro
API Scripter
TableToTable FILE LOCATION: &nbsp; My Personal Repo &nbsp;and 1-click (currently in the merge queue for 22 Nov 2022). DEPENDENCIES :&nbsp; TableToTable&nbsp; needs&nbsp; Messenger&nbsp; and libTable&nbsp; (both are in the 1-click merge queue for 22 Nov, but can also be found in my repo: Messenger is here &nbsp;and libTable is here ). ABSTRACT: TableToTable&nbsp; (or&nbsp; T3 ) &nbsp;provides an easy way to work with rollable tables, including an interface for quickly loading up table data. T3 helps to edit, update, export, import, or share rollable tables. Use a third-party editor (like MS Word, MS Excel, or Google Sheets) to make your changes, then just paste your new data into the T3 handout interface. The script will do the rest. Introduction Editing tables can be a pain. It can take forever. The steps to edit an entry are a series of discrete actions, just different enough to make you have to think about each, and which you have to chain together in proper sequence. Then you have to repeat that series of steps again for the next entry you want to change. TableToTable (or T3) aims to give you an easy interface for building, updating, trimming, or expanding your rollabletables. The basic idea is that you can load a table into a handout interface with much more functionality, and then from there copy/paste it into your favorite third-party software better suited for editing table-structure data. T3 helps you: take a Roll20 table elsewhere to edit import a table to Roll20 from elsewhere share a table with someone else backup your tables easily assign image avatars to table entries (multi-sided tokens) view table entries side-by-side and quickly make adjustments ...more... Here's what you need to know to get up and going. Videos If you would rather watch a video to learn about the script or see it in action, I've prepared a short series on the various things TableToTable can do. Watch them all or grab the one that has the information you need: Installation --&nbsp; <a href="https://youtu.be/uO0IaYow5tg" rel="nofollow">https://youtu.be/uO0IaYow5tg</a> The T3 Interface Part 1 --&nbsp; <a href="https://youtu.be/aJCl_vMrgj4" rel="nofollow">https://youtu.be/aJCl_vMrgj4</a> The T3 Interface Part 2 --&nbsp; <a href="https://youtu.be/hmrvfRUvu88" rel="nofollow">https://youtu.be/hmrvfRUvu88</a> The T3 Interface Part 3 --&nbsp; <a href="https://youtu.be/l1ZaUIWljsU" rel="nofollow">https://youtu.be/l1ZaUIWljsU</a> Building a Library --&nbsp; <a href="https://youtu.be/ofAhf_PtZ6s" rel="nofollow">https://youtu.be/ofAhf_PtZ6s</a> Workflow: External Editors --&nbsp; <a href="https://youtu.be/4OTbW-Pp5VM" rel="nofollow">https://youtu.be/4OTbW-Pp5VM</a> Creating a T3 Interface --&nbsp; <a href="https://youtu.be/UA3CaiVDmoU" rel="nofollow">https://youtu.be/UA3CaiVDmoU</a> Getting Your Roll20 Library --&nbsp; <a href="https://youtu.be/NN0kk-1ftDk" rel="nofollow">https://youtu.be/NN0kk-1ftDk</a> Or, here, in a Playlist: TableToTable Series --&nbsp; <a href="https://youtube.com/playlist?list=PLog-TsiQzGZYZ7zW884Px9dW9M66vsHBC" rel="nofollow">https://youtube.com/playlist?list=PLog-TsiQzGZYZ7zW884Px9dW9M66vsHBC</a> Installation T3 is available at the link above (in my repo), as well as (soon) the one-click library. It also has a small number of script dependencies (like Messenger and libTable) that it requires to properly function. If you get the script from the one-click, these will be installed automatically. If you got the script from my repo, be sure to grab the latest versions of these scripts, too. Once installed with all of its dependencies, T3 will automatically create your first handout interface, called&nbsp; T3 Workspace . If you delete that handout, don't worry; T3 will recreate it the next time the sandbox reboots or you open this help panel. You can click the button from the notification to open the handout interface (or just open the handout, yourself). Handout Types T3 utilizes (and can setup) 2 kinds of handouts for you to use: interfaces and libraries. Interface handouts are where you will interact with tables and port them out of and into your Roll20 game. Libraries are places to view image files from your Roll20 media library, and from which you can quickly assign images to a table entry in an interface. Any handout can be used for either purpose. T3 provides buttons on the control panel for initiating the process of setting up either sort of handout, and will give you a prompt asking you to pick the handout you would like to use. Access the control panel by entering !t3 at the chat interface, or by clicking the gear icon button from an existing T3 interface (see image of an interface, below). The buttons for setting up an interface or a library are pictured here: Bear in mind that setting up a handout as an interface or library will overwrite the contents of that handout (you will receive a confirmation through the chat panel; click&nbsp; Yes&nbsp; to proceed). Make sure you understand what is required before using these buttons. Multiple Interfaces, Many Libraries You may only need one interface at any given time (you will see how to use and reuse it, below), though you could create others, especially if you and another player will need to use the script at the same time. You may find more of a use for having multiple library handouts prepared, as these might provide you a way to group images into a concise or discrete set. Setting Up a Library A library presents a series of images as clickable/choosable items that makes it easier to assign them to items in tables you are currently working on in a T3 interface. Using a library is explained below in the discussion of interface handouts. To set a library up, paste URLs of&nbsp; images in your library* &nbsp;in the body of a handout in your game. The URLs don't have to be the only thing in the handout, but setting up a library will consume everything in the handout and leave only the images behind. That means that you could use an existing import table script, for instance, and have T3 detect the URLs in the body of the text. Once the URLs are in the content of the handout, either enter the below command in chat, or simply use the&nbsp; Make Library &nbsp;button and choose the handout you wish to set up. !t3-setup --ho=&lt;handout name here&gt; --type=lib * - scripts cannot access marketplace images, so if you are going to use an image in a rollable table, make sure you've uploaded it to your personal library. Though Roll20 scripts cannot access your Roll20 library in order to provide you a list of the images available to you, there is an easy to use bookmarklet that can let you easily capture all of the URL addresses for your Roll20 library, making them available to T3 or other scripts to access. I'll include that as a subsequent post in this thread. The Interface A handout prepared as an interface will have a set of controls near the top. The controls provide the methods to execute most of the things you'll need to do. Navigating the Interface The set of icon buttons (level with the header) gives you access to the Control Panel, the Help Panel, refreshing the table list, and resetting the interface. Each of these buttons has a hover-tip to better explain what they do. Below these buttons are a set of buttons to help you interact with your game's rollable tables. The&nbsp; GET ,&nbsp; NEW , and&nbsp; APPEND&nbsp; buttons will get a table structure added to the interface. The&nbsp; GET&nbsp; button will ask you to choose an existing rollable table and it will load up the data into a handout table. The&nbsp; APPEND&nbsp; button is similar in that it will ask you to which table you want to append the new entries you will create, but it will not load up already existing data from the table you choose; instead, it will give you a handful of new rows for you to make new entries for that table. The&nbsp; NEW&nbsp; button will ask you to provide the name of the new rollable table you'd like to create. Note that NONE of these will actually alter the data in your table until you choose the&nbsp; PROCESS &nbsp;button, at the right. The&nbsp; PROCESS&nbsp; button will read the contents of the interface to determine if there is any work for it to do. If it sees a Header1-formatted line saying REPLACE, APPEND, or GET, it will attempt to fill that request. Note that if any line is marked as a GET line, this processing pass will only perform GET operations, turning that line into a REPLACE line that will await your next press of the&nbsp; PROCESS&nbsp; button. Since the&nbsp; GET&nbsp; button will get the table data for you, it actually creates a REPLACE line so that you can immediately start making alterations to your data and it will be ready the next time you press the&nbsp; PROCESS&nbsp; button. This means that there won't actually be a GET line in the handout unless you manually add one. The general workflow you would most often use would be to click the&nbsp; GET&nbsp; or&nbsp; APPEND&nbsp; button, make your changes, then click the&nbsp; PROCESS&nbsp; button. At that point, you should see your changes reflected in your game's rollable table. The REPLACE or APPEND line will have been replaced with a line beginning PROCESSED. You will also see a chat report of the work T3 performed, including the number of items it created. Table Buttons There are two sets of buttons for a table. Outside of the table, even with the REPLACE or APPEND line, are the table control buttons: The first button is used to turn a PROCESSED line back into a REPLACE line (to effectively "turn it on" again, thus the power icon), in case you see something you need to correct. For obvious reasons, you don't want to got from APPEND =&gt; PROCESSED =&gt; REPLACE, as that will overwrite whatever other rows were in your table originally. The second button (with the image icon) is called the&nbsp; Unwrap&nbsp; button, will render the table into something more easily cut-and-pasteable. Images in the AVATAR column will be unwrapped to show their URLs, and the extra columns to the right will be removed. Use this button if you want to work in another software to make changes to your table data. The last button (red X) is the&nbsp; Delete&nbsp; button. It will remove this HTML table entry from your handout interface. Your rollable table (as a Roll20 object) will remain, of course. Row Buttons The second set of buttons are the row control buttons, and you will see these in every row of your table: The Assign Avatar buttons will let you add or remove an avatar from this row. The anchor icon indicates that you want to use the library image currently on your T3-clipboard (see&nbsp; Using a Library with an Interface ). The reticle icon will ask you to target an existing token for the source of the image (using the standard Roll20 targeting interface). Be careful that you choose a token whose image comes from your library, again, as scripts don't have the ability to use marketplace images. Last, the empty-set icon will remove the avatar image from that row. The Row Management buttons are straightforward, letting you either add a row at that position, or delete the row you are in. Data Validation You do not need to enter a Weight for a given row; if a weight is not supplied, it will be defaulted to a 1. Other coercions will happen to text or decimal numbers to ensure that the value of the weight field is an integer. Besides that, a row need only have data in&nbsp; either&nbsp; the Name or an Avatar fields for it to be a valid entry. Using a Library with an Interface Once you have a library handout created with images from your library, click on those images to see a green box appear around them. This box is indicating to you that the image is now on a special clipboard built into the T3 script. If you then click on the anchor icon button for a row in a given table in a T3 interface, you will effectively "paste" that image into the Avatar field. To work quickly, have the handouts side-by-side and click from one to the other, choosing the image in your library handout and choosing the anchor button in your destination row. This should make avatar-image-designation much quicker for you, so even if you use a third-party software to do your table-row editing, it might be worth it to bring the table back into Roll20 to assign the images. Read the&nbsp; Table Editing in a Different Software &nbsp;section for more information. Table Editing in a Different Software If you want to edit your table in another software, T3 has you covered. First load your table using the&nbsp; GET&nbsp; button, then choose the&nbsp; Unwrap&nbsp; button to render the table in a state that is ready to be copied. Copy the table, paste it into your other software, and make your edits/additions/deletions. When you're ready, copy your data again and return to the T3 interface of your choosing. Unfortunately, since scripts don't have access to your&nbsp; computer's &nbsp;clipboard, this part must be handled with a bit of manual effort. Choose the button to Edit your handout (the Roll20 button at the top of every handout). Paste your table below a Header1 line that reads:&nbsp; Replace: &nbsp;followed by the name of the table you want to replace. If you are working in the same handout interface from which you initially copied this table to your third-party software, you may need to delete the existing table and paste the new one in. Save your changes to the handout. Your Pasted Table Will Not Have Buttons Only a table created by the interface will have the handy buttons that make working in the table easy. For that reason, once you have saved your interface with the pasted table, you will probably want to click the&nbsp; PROCESS&nbsp; button to assign those entries to the designated table. At this point, you can clear the HTML table from the interface handout (clicking the table's&nbsp; Delete&nbsp; button, if you started with one), or just clicking the&nbsp; Reset&nbsp; button from the top block of controls. This will give you a clean slate. Now you can choose the&nbsp; GET&nbsp; button to load the table again, this time with all of the attendant bells, whistles, and buttons of a T3 interface table. (Note you may need to click the&nbsp; Refresh&nbsp; button to update the list of tables that your&nbsp; GET&nbsp; button will use.) Column Order You don't need to start in T3 to construct your table (copying and pasting from a T3 interface to your other software). You can build a table from the ground-up in your other software, then select and paste it into a T3 interface as mentioned. In this case, T3 will not care about the order of the columns, provided that the first row of the table indicates the header designation for which column is which. Use column names of 'Name', 'Weight', and 'Avatar' to have T3 recognize which column is which. Tested Software I tested Microsoft Word, Microsoft Excel, Microsoft Access, and other HTML-table producing softwares with success (meaning T3 was able to interpret the structure of their tables). I had mixed results with Google Sheets (it sometimes failed to include the last cell in a click-drag selection of cells). Scrivener would not work at all. If you try another software that you think should work but does not, drop a message in the forum thread or shoot me a PM and I will see if I can update T3 to recognize what that software title produces. Working Manually You don't actually have to use the interface T3 sets up for you. All T3 needs to function is a Header1 formatted line beginning&nbsp; Get: ,&nbsp; Replace: ,&nbsp; Append: , or&nbsp; New: , followed by the name of a table (an existing table, in the cases of Get or Append). For anything other than a Get line, you must follow the Header1 line with an HTML table with the appropriate column headers. You could even just use the built-in table option in the handout editing interface to construct and enter your data. When you are ready to process the data into the designated Roll20 rollable table, use the command: !t3 --&lt;handout name here&gt; T3 will carry out the actions requested by the Header1 lines. About version: 1.0.0 (release to 1-click) 22 Nov 2022 version: 1.0.0.b1 This bit of scriptometry brought to you by&nbsp; timmaugh, the Metamancer .
1667920648
timmaugh
Pro
API Scripter
Getting Images for a Library When T3 examines a handout to convert it to a library, it looks for URL references to image files, and turns those into clickable buttons. The rest of the content is discarded, and we are left with a panel of all of the detected images. The source of these images could be a list, an HTML table, or a macro... as long as the image URLs can be detected, pasting that content into a handout and requesting T3 to make a library from it will work. As mentioned, scripts cannot access marketplace images, so we need to make sure we use images we have access to (typically because they're in our or another user's library). How do we get that list if we can't have a script go aggregate it for us? Here are a few options. Use an Existing Macro As just mentioned, and as is demonstrated in the&nbsp; Building A Library &nbsp;video, you can use an existing macro that contains image URLs. Typically this might be an importtable macro or something similar. Use an Existing Table You've Stored Elsewhere It doesn't matter the surrounding formatting or organizational structure around the image URLs. They could be comma delimited, or nicely housed in an HTML table. So if you have worked with images from your library before and you have them stored in a MS Word table, an Excel spreadsheet, a Google Sheet, or something else, paste them into your handout and T3 will be able to detect those images and convert your content into a library. Use This Bookmarklet to Get All of Your Library Images Credit for this one goes to The Arcane Scriptomancer himself,&nbsp; The Aaron . In this post, Aaron provided a small bit javascript to use as a Chrome bookmark. The goal of the original was to make it possible to download all of your Roll20 library content again in the case that you lost your local copies... so if that's what you need, be sure to visit that link and get the original code. I repurposed that code to get the URLs of your Roll20 library images so that they can be easily used in a T3 library. Here is the code, and how to go about using it. The Code javascript: (function () { var links = $('div.library_result').map(function (idx, block) { var $block = $(block), img = $block.find('img'); return $('&lt;p style="color:#222;"&gt;' + img.attr('src').replace(/\b(?:thumb|max)\b/, 'original') + '&lt;/p&gt;'); }).toArray(); $('&lt;div style="position:absolute;width:100%;top:10em;left0;z-index:10000;background-color:#eee;color:#222;"&gt;&lt;/div&gt;').html(links).appendTo('body'); }()); Using It 1. Create a bookmark in Chrome &nbsp; &nbsp; 1.1 Open Bookmark Manager by hitting CTRL + SHIFT + O, or by clicking the 3-dot menu, then Bookmarks &gt; Bookmark Manager &nbsp; &nbsp; 1.2 Navigate your bookmark structure to get to the place where you want the bookmark &nbsp; &nbsp; 1.3 Below your bookmarks/folders in that location, right-click in open space and choose&nbsp; Add new bookmark &nbsp; &nbsp; 1.4 Enter a name for your bookmark like "Get My Library" in the&nbsp; Name &nbsp;field &nbsp; &nbsp; 1.5 Paste the code into the&nbsp; URL &nbsp;field and click&nbsp; Save 2. Navigate to&nbsp; your library page . 3. Scroll down until all of the images in your library have loaded. 4. Click the bookmark you created, and scroll to the top of the page You will see that the bookmark has added the URLs for all of your library images to the top of the page. Copy the addresses, paste them into a handout in your game, and convert that handout to a library. Video Demonstration I demonstrated this process (everything but creating the bookmark) in&nbsp; this video , if it helps to see the process.
1669127051
timmaugh
Pro
API Scripter
Update: v1.0.0 (1-Click Release) TableToTable is in the queue to be merged with this week's (22 Nov 2022) pull request, as are the supporting dependency scripts (Messenger and libTable).