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] UnSanity - A Unicode Sanitation Testing Script for Game Masters, Script Masters, and Sheet Masters

February 02 (3 years ago)

Edited February 02 (3 years ago)
timmaugh
Pro
API Scripter

UnSanity

FILE LOCATION: My Personal Repo & 1 Click Installation (you'll want to get it from 1-click Installation -- see why, below)

ABSTRACT: UnSanity allows you to test the various unicode sanitizers of the Roll20 interface, informing you if particular characters will survive where you want to use them. This is useful for GMs in prepping for a game, as well as Scripters and Sheet Designers in constructing their code.

Introduction

Not all unicode characters survive being sent to each destination within Roll20. At the same time, not every destination within Roll20 sanitizes the same unicode characters in each location. In days gone by, the process of discovering whether the emoji or unicode character you wanted to use was available to you was a matter of trial and error -- which can be a drawn-out affair if you have to submit through the one-click process before learning the answer. Because of that, I decided to write a script that would send any/every unicode character at the various destinations (on demand) so that in some future circumstance I could know what was available.

BACKSTORY (Use Case): In all of my scripts, I have code that drops a small "signature" in the API log output every time the sandbox boots up, but only once no matter how many scripts of mine you have. It looks like a torii, and if you see it when your sandbox boots up, you know you have one of my scripts:

  _____________________________________________   
   )_________________________________________(   
     )_____________________________________(     
           ___| |_______________| |___           
          |___   _______________   ___|           
              | |               | |               
              | |               | |               
              | |               | |               
              | |               | |               
              | |               | |               
______________|_|_______________|_|_______________

OK, fine. I'm tagging your log. I'm spray-painting graffiti on the walls of your API. I feel terrible about it and... and... and I promise never to do it again unless you have to reboot your sandbox. =D

The point is that when I initially built that signature, I built it with unicode characters that were much prettier.

I decided I needed a way to know what characters might be available to me. And since there are various destinations in Roll20, the solution would have to be able to send output to each.

Roll20 Destinations

You can check unicode sanitization in 4 locations, using this script:

  • In the script's code (visible if you import rather than install)
  • In the API Console Log
  • In Chat
  • In a Handout

In Code

At the bottom of the code is a text table of every unicode character in UTF-16. If the character appears there, it means that it survived the 1-click sanitization.

In the Console Log

Test sending special characters to the script log by using the --log  argument. These will appear in the API Console Log. These characters (and those for the destinations that follow) are generated at run time, so even if the character would not pass the sanitation process to appear in your code as a character, they might still appear properly in the console log, or in the other destinations.

In Chat

Send a panel of characters to the chat window using the --chat argument.

In a Handout

Use the --handout argument to send specified characters to a handout. Use the --name argument to specify a name for the handout (default name is "UnSanity Output").

Syntax Highlights

All commands to this script should begin with the basic handle: !unsanity . In fact, if you send a command through consisting of only that handle, you will get a help panel output providing you with more usage information:

That panel really covers things, but in case the image ever gets lost, here is a text version of the same information:

Output Arguments:
  --chat      ...sends selected output to chat
  --handout   ...sends selected output to a handout
    --name    ...name for the handout; default is 'UnSanity Output'
  --log       ...sends selected output to the script log
  --all       ...sends output to all of the above
Range Arguments:
  --low       ...low bound of selected output; use integer for row index, or hexadecimal to obtain row index of given unicode character
  --high      ...upper bound of selected output; use integer for row index, or hexadecimal to obtain row index of given unicode character
  --char      ...hexadecimal value translated into the row index that contains that unicode character NOTE: all hexadecimal values must be between 0x0020 and 0x10FFFF
EXAMPLES:
!unsanity --chat --low 0 --high 50
  > outputs rows 0 - 50 to chat
!unsanity --log
  > outputs all rows to log
!unsanity --handout --low 0x01F300 --high 0x01F400
  > outputs to a handout (default name: UnSanity Output) the rows including and between those given characters
!unsanity --handout --name Wompus
  > outputs entire data set to a handout named 'Wompus'
!unsanity --chat --char 0x01F300
  > outputs the row of the specified character to chat

Output Panels

Chat

Here is a sample chat output for 0x01F300 (low) through 0x01F4E0 (high):

Handout

And here is a handout output for 0x01F300 (low) through 0x01F40F (high):

Updates and Releases

v0.0.1 - Initial release

February 02 (3 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

As someone whose unsanitary scripts have been unexpectedly borked by this, I salute you!

February 02 (3 years ago)
timmaugh
Pro
API Scripter


It's niche, I know.

But if you need it, you need it now... not a week or more down the road when you can get something through the one-click.

February 02 (3 years ago)
Gold
Forum Champion
thanks for the API Script for the Community