itmeJP Community


Automated Status Screen

roll20
blades
blades-in-the-dark

(TheShootHappy) #1

Hello, everyone!
In an effort to make my life as a DM slightly easier (and to learn Javascript), I've written a script to automate a status screen like the one @OneSevenDesign uses. Unfortunetly, it requires you to be a Pro member on Roll20 since it uses the API (that's the $10 subscription, not the $5 one). Setup time for me is about 10 minutes, but it's probably a bit longer for someone doing it for their first time.

I have an audioless youtube video at the bottom which shows all the steps in case you're confused about something. It's also possible to do it manually if the automated setup isn't working for you, but it's a bit tedious and too long to write out if no one needs it. Just comment below if you do need it and I'll be happy to help.

Note: This is one of the first pieces of code I've ever written and I've copied and stitched together pieces from various sources to get it working. As such, the code is fairly messy, but it does the job and I'm fairly confident I've ironed out the any bugs/errors for the core script (the setup is not as solid, I'll see if I can work on it some more).

The script should no longer reset your stress, trauma and the 3 armor fields, but you might want to write them down before hand just in case.

Roll20 recommends you backup any game that uses scripts, and I would say this is solid advice. There's nothing in the script that should cause any harm but better safe than sorry!
I haven't actually done this myself but I'd hate to destroy someones game just because my script somehow went haywire (don't think that's actually possible and there's the rollback function in the unlikely event that it does, but still).

Step 1: Download the images and decide on the style

There's 2 main designs (red and black), and another 2 variants (trauma border vs no border) of those depending on what you fancy (mixing also works if you'd like to have black stress but red trauma, etc).

Link: https://drive.google.com/open?id=0B3G7DJD-H2KgVnlKSEdodFNkR0U

Step 2: Setup Rollable Tables inside roll20.

The API can't access your image library, but it can access the rollable tables so we use those to setup all the images. We want to create a total of 6 rollable tables, which is a bit of work, but I think it definitely pays off.
1. Go to the "Collections" tab on roll20 and click "+add" at the bottom.
2. Name the 6 tables "stress", "trauma", "armor", "heavy", "special" and "injury".
3. Enter the images into their respective table (Important start with image 0 and keep them in order!)

I recommend dragging the images into roll20 one "category" at a time in order to upload several at once (something that doesn't seem to be possible through the menus) but still keep them semi-organised (the upload jumbles the order).

Step 3: Add the script

Copy the script from here: https://github.com/TheShootHappy/StatusScreen

  1. On the page for your campaign, click settings > API scripts
  2. Create a new script and call it whatever you want (I suggest status,js)
  3. Save the script

Step 4: Setup

Write down all the stress, trauma and armor fields as these will be reset!

  1. Once you've added and saved the script, go into the game and write "!status -- <name>" but with all the characters name seperate by --. As an example, John would probably (depending on the sheet names) type
    !status --Rune --Carriless Firm --Aldo --Miss Cattaby
    to set it up for rollplay blades (It's VERY important you have no duplicate names/characters and that you spell everything exactly the way they are in the Journal!).
  2. The script should create everything for you on the page with the player banner.
  3. If you wish, you change the color of the block next to the portrait in the top left from one of the presets or with a hexcode. The script generates a random hexcode on setup for you.

If you wish to move things around, I highly recommend you set the grid size to 0.25. Unfortunetly, I didn't account for the color banner thing when I created everything, but the main screen and portait should snap into place (Note: you have to right click and click "isDrawing" to unselect that first as that disables snapping).

Feel free to comment if you're having issues, I'll do my best to help out :slight_smile:
...I hope that's everything.


Assets used in Roll20.net?
(Xaphere) #2

Bravo for the effort. Now go and put it on github so other people could provide fixes and changes. Pastebin is not a good way to share code.


(Goa_gubben) #3

I started looking into scripting on Roll20 yesterday when JP mentioned something about it on twitter. This looks great in the video, it's a shame you need to be a pro member to get access to that stuff.
The code seems a bit messy but I'm not sure how much of that is Pastebin. I try my best to avoid javascript whenever I can but in general if you need some sort of delay to make something behave like you want then you're doing something wrong.


(TheShootHappy) #4

Sorry for the late reply, I've been busy and haven't had a change to take a proper look at github. I was going to upload it on there initially, but all fancy features and stuff scared me away. Would it be sufficient to create a repo and upload the file or do I need to download git bash or w/e and do it through there?

I'm a newbie so all of this is new to me! :slight_smile:


(TheShootHappy) #5

Thanks! while it is a shame, someone in the roll20 forums said a large part of the server costs come from the API/scripts, so I think it makes sense that it would cost extra.

The code is definitely on the messy side, yeah, but I've worked on it today and changed things around a bit. Should be a bit clearer and also not need the delay, but I'll have to test it a bit more to make sure it doesn't spontaneously combust...


(Xaphere) #6

It should be enough. I mostly use terminal, so I'm not well-versed in what the web page could do.
But if you are keen on learning how to program I would suggest to find the time and go trough the tutorial . It will help you a lot.


(TheShootHappy) #7

Thanks for the link, I'll check it once I run out of ways to crash the current version of the script!
I'm usually on the artistic side of things but I thought it could be fun to at least learn the basics of some programming languages. So far HTML has been real easy, CSS a personal hell, and Javascript somewhere in between.

Although I've heard the discussion around whether or not HTML & CSS counts as programming languages is similar to the discussion about pluto and planets, so maybe they don't count.


(TheShootHappy) #8

New version is out, and it's now on github! Yay!


(shardofliquid) #9

I’m currently trying to get this script to work in my game, but I keep getting the same error:

“Error: toFront() must be given an object either from an event or getObj() or similar.
undefined”

Any idea what this means or what I could be doing wrong?


(TheShootHappy) #10

oh damn, I completely forgot about this. I haven’t actually used roll20 for a while now, much less this script, so I can’t remember much about it unfortunately.

By the sounds of it the script is trying to make sure something is on top / in front, but it’s not finding the thing it’s trying to send forwards. Double check to make sure you named all the rollable tables right. If that doesn’t do it, send me a PM and I’ll have another look at it ^^


(Tubilak) #11

Hey, did you ever manage to find that bug? I’m getting it too, and it seems like it’s tied to the character name somehow? It only works for one of the three players in my group and only if I don’t change his name to something else.
It just draws the coloured block and then quits.

Error: toFront() must be given an object either from an event or getObj() or similar.
undefined


(TheShootHappy) #12

No, he never got back to me so I assumed he fixed it somehow. Are you sure you got the names right? Spaces and special characters and all that?


(Tubilak) #13

I’ve tried a bunch of different names for all the characters :stuck_out_tongue:


(TheShootHappy) #14

Hmm, I don’t know then. It’s been so long I can’t even remember how it works, tbh, but if you make a new game and import all the relevant characters there I can have a look at it and see if I can’t relearn javascript :stuck_out_tongue:


(Tubilak) #15

Not sure how to send a PM on this board so I’ll just post the invite link publicly o.O
(link removed :wink: )
It’s for a copy of the game so at least my players will shielded from any spam :stuck_out_tongue:

If I make you a GM you should be able to trouble shoot right?..


(TheShootHappy) #16

I’ve joined. It’s 2am, but I’ll have a look tomorrow or in the weekend ^^


(Tubilak) #17

You’re promoted to GM there. And now the forum is berating me for replying too much to the same person :smiley: