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] Graphic/Token snapshot saving/loading for building your own macros

I've put together a handful of commands using the API that I think could be pretty helpful. It is based off my original !reveal command, but with the addition of the !alter command and the !save_snapshot functionality I thought it was worth a new post. Hopefully that isn't too against the forum rules, but the functionality is expanded quite a bit and no longer matches the old topic.

How to use:

1. Name some tokens with ".foo" somewhere in the name. This tells the script that this object can be modified by talking about "foo".

2. Arrange and otherwise modify your tokens.

3. Enter the command: !save_snapshot snap1 foo

4. This will create a new snapshot named "snap1" for each "foo" object.

5. Make some more changes, then: !save_snapshot snap2 foo

6. !load_snapshot snap1 foo

7. !load_snapshot snap2 foo

There is also a command for modifying objects in bulk by class: !alter foo > {layer:"gmlayer"}


https://gist.github.com/rlittlefield/5516481

Edit: I should note that until the "state" object persists, you will not be able to load snapshots from previous sessions. I know this limits the usefulness of the script, but hopefully they will add that soon.

May 04 (12 years ago)
Riley D.
Roll20 Team

I'm not going to lie, I think this is fantastic. So much so, that I'm going to move saving the state object up to the top of my list...so look for that here soon :-).

May 04 (12 years ago)
Alex L.
Pro
Sheet Author

for now you could use my script to save the state as a json string in a handout. :P

I'd like to think of a way to specify that you only want to load part of the snapshot, such as excluding the positioning or health statistics. I'd probably just use a different load command that skips a few attributes.