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] XRay - Sheet Walker and Character Inspector

1598647020
timmaugh
Pro
API Scripter
NOTE: This is a cross post from the InsertArg script thread . I added this basic text to the very first post of the IA script thread sometime after posting initially, and I realize that people might miss this script if they think they won't have a need for IA and so don't go back to that thread. Although XRay is dependent on IA behind the scenes, you can use XRay without ever manually invoking a call to IA. So, to give this script a little room to breathe (and receive discussion/feedback on its own), I figured I would open a separate thread for XRay, here. XRAY (Sheetwalking Script) Xray is a helper script that can tell you a good bit of knowledge about a character sheet, whether for the purposes of building your own script, building a call to InsertArg, or just looking up information in game without having to flip over to your character sheet. You can get the latest version from my repo (at least until I get it into the Roll20 library). You will need 3 files: InsertArg.js, IA Core Lib.js, and xray.js. Note that Xray requires InsertArg, but InsertArg runs just fine without Xray. However, for certain calls to InsertArg, a bit of knowledge about your character sheet is necessary. For instance, the way repeating sections are constructed (a group of related sub attributes sharing a common id in the middle of their names) requires you to know the sub attribute that provides the name for the element in the repeating section (i.e., the "Magic Missile" spell in your repeating section for spells), and which one provides the value or action/execution text. Xray couldn't be easier to run. Although there are a few constructions that can get you where you want to be immediately, 99% of the time that you would use Xray you'd just start from the top and enter into chat: !xray That's it. That will show you buttons for each of the characters you can control. Click on a button to continue drilling down on that particular character. Here I'll click on Heretic... ...to see a button for Abilities, Attributes, and every repeating section Heretic has an entry for (this samples sections for which the character has an entry, not every section available from the sheet, so certain characters may have more/less sections). Clicking on a button lets you continue to drill down on that section. For Abilities and Attributes, the default number of items to show in a single chat output is 25, and they will be alphabetized. You'll have Next and/or Previous buttons where appropriate to continue stepping through that section. For the repeating section, the output you will be presented with will be the view of all of the sub-attributes for an element in that section. You'll be asked for what entry to show (a number between 0 and 1 less than the number of elements in that section for that character). Don't worry if you enter one out of scope, you'll be informed what the highest value is. Your output will then look like this: ...you'll see a Next/Previous button as necessary, letting you walk through the entries in this repeating section. The first column is the suffix of the sub attribute (the full name will be more like repeating_powers_-Mssfn220_sjafdipsf0_power_name). You may also see a series of buttons for a given sub-attribute in this section, as you do for the sub attributes 'use_power_formula' and 'use_power2_formula'. These buttons indicate that the value of the sub attribute was detected to be executable. You can choose to View the text (maybe you want to know what it says to make sure it is the field you're looking for, or you want to know how to hook a replacement for an InsertArg call). You can choose to Exec(ute) the attribute and send it to chat, letting you confirm how it outputs. The last button, Build, will take a cross-sample of the repeating section with the associated sub-attribute as the action/executing script. Meaning, if I click on the Build button for use_power2_formula, I will get an output of buttons for all of the elements in this section (the "powers" section), and for each of them the value sent to chat will be their individual use_power2_formula. In this way, you can identify the naming sub attribute and the action sub-attribute for a call to getrepeating... as that requires sfxn (naming suffix) and sfxa (action suffix) arguments. For abilities and attributes (simple) output, the "Build" button is replaced with two buttons. "Starts" will give you a filtered list of the attributes/abilities that share the first 5 letters of the name of the associated attribute/ability. "Ends" will filter the list where the attribute/ability matches the last 5 characters. Interaction with InsertArg If you up-arrow in the chat, you can see that the call producing that output is a call to InsertArg, in this case: !ia --whisper --show#msgbox{{!!c#The following abilities were found matching the first 5 characters of the chosen ability. This list can be further refined. !!t#ELEMENTS !!btn#getabils{{!!c#-M4jpPEy0ScLWE54K2gM !!op#b !!f#^f#`WayOf`}} !!send#true !!wto#Heretic}} That gives an example of how InsertArg calls are built, though if you really want to know more, there's more information is available in the InsertArg thread. Changelog Current Release - v1.1
1598647483
The Aaron
Roll20 Production Team
API Scripter
Neat!
1599303134
timmaugh
Pro
API Scripter
1.11 Version Update Minor bug correction. If you didn't have a config profile, it would break the sandbox. I have corrected that. New files are in the repo.
1599625992
timmaugh
Pro
API Scripter
Since this script was so dependent on the InsertArg library of functions, I rolled it into the single script for IA. That unified file can be found here .