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] anonymous - Hide name and icon of NPC until it is time to spring them on your players (pre-release)

1541104750

Edited 1541128807
Ammo
Pro
github: <a href="https://github.com/derammo/der20/releases" rel="nofollow">https://github.com/derammo/der20/releases</a> anonymous is the first usable plugin of a family of completely over-engineered Roll20 API Scripts I am creating using a framework of reusable TypeScript components I am calling der20 . Plugins are distributed together in releases via github. &nbsp; I am looking for contributors, so I am publishing this now even though a lot of work could still be done. &nbsp;There is also some developer-style output in GM whispers, because this is really a demo. &nbsp;These will be removed in the next release. The command reference is at <a href="https://derammo.github.io/der20" rel="nofollow">https://derammo.github.io/der20</a> . Usage: select all tokens you want to anonymize, then execute !anonymous set &nbsp; &nbsp; The icon will be taken from a character called 'Anonymous' or another character in your journal that you can configure via&nbsp; !anonymous character My Other Character Technical note: The 'cache defeat' query string at the end of the image URL is set to midnight of the current day, so images are cached for around 24 hours. The name of the token will be changed to the creature type from the Journal. &nbsp;The intent is that you can narrate what sort of creature the player characters are seeing (like a 'small, rotten corpse') instead of knowing the exact creature stats just from the picture or name. Either during the first round of combat or when your players get a turn, you can decide with which creatures they are familiar, and reveal their true identity by selecting multiple tokens and executing !anonymous reveal Oh god, DM... Why???
1541122986
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Looks interesting Ammo. Can I get some clarification though? Is this an API script? or an external script that interfaces with Roll20?
1541128746

Edited 1541128791
Ammo
Pro
this is an API script. &nbsp;I will change the post also to make it clearer.
1541132157

Edited 1541132535
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, tried using the script, and I can set the character to pull the anonymous image from a character, but !anonymous set doesn't seem to work. Does it require certain sheet attributes? Also, I haven't spent a lot of time digging into the code, but one thing that strikes me is that if you are going to design these to use a set of shared resources, why not create the resources as separate scripts that you can have these scripts require as dependencies. This would make your code cleaner, and allow for less duplicated code. It would also allow for easier contribution by the community. EDIT: And, why are you setting the cache defeat chain? just remove all the numbers after the image type (e.g. .png) and set the token image to that. EDIT: API console error log from !anonymous set is:&nbsp;"2018-11-02T04:05:27.946Z anonymous: error caught from work function: Cannot read property 'get' of undefined"
1541134145

Edited 1541134585
Ammo
Pro
Please look at the source repo. &nbsp;This is written in TypeScript, which is stored as many many separate source files in a very maintainable repo. &nbsp;Each API Script is then compiled down to a single frozen JavaScript file so there are no dependencies. Contributions would be done to the TypeScript code. &nbsp;I think you were trying to read the output JavaScript, which clearly would not appear to be very maintainable code :) &nbsp; &nbsp;Please read the source and not the compiled output. Thanks for giving this a test run. &nbsp;The exception you are seeing probably explains why it didn't work. &nbsp;I will put in some more guards and figure out what happened.
Ok I posted a new version 0.16 that fixes a problem that you were probably running into: &nbsp;if any token selected is not an NPC it would throw that exception. &nbsp;This is resolved. Also, icons that aren't already thumb size are now fixed. If you want to look at the source for just this plugin, the source code that is plugin-specific &nbsp;is here <a href="https://github.com/derammo/der20/tree/v0.16/src/anonymous" rel="nofollow">https://github.com/derammo/der20/tree/v0.16/src/anonymous</a> &nbsp;(this tag is the source for the release I just pushed) If you want to run the fixed version, just grab the release 0.16 from&nbsp; <a href="https://github.com/derammo/der20/releases" rel="nofollow">https://github.com/derammo/der20/releases</a> Regarding you question about the "cache defeat" query: &nbsp;What I believe Roll20 does is put the last modified time of every image in your library (divided by 1000 to make seconds rather than milliseconds) into a query string on the end of the URL that is in the library. &nbsp;Then they can use a "dumb" platform without any version checks to serve their images, because every time you make a new version, it changes that query string to a new number, invalidating all the caches along the way. &nbsp;The query string apparently doesn't do anything else, but the API requires that you put it there. &nbsp;&nbsp; Since we can't access the library to get the ACTUAL last-changed time, I just take the most recent midnight. &nbsp;So what that means is that every time you set some image with this API Script, you get a URL that is new and not cached, unless you did it earlier today. &nbsp;Tomorrow, it will set another query parameter that is considered "fresh" and invalidates caches along the way so you actually hit the origin server and get the latest version, but at most once per day. The impact is that if you actually DO change an image in your library, this plugin won't show it until the next midnight, because it doesn't know to change the query string (not knowing that you changed the file on the origin server.) &nbsp;It is working around the somewhat naive (but very efficient) caching strategy Roll20 uses. &nbsp; The only real downside is that delay, where you won't get your new image until tomorrow, if you edit an image in your library (which people don't really do anyway.) &nbsp;&nbsp; The upside is that caching actually works and you don't hit the origin server with every request!
version 0.17 pushed&nbsp;<a href="https://github.com/derammo/der20/releases/tag/v0.17" rel="nofollow">https://github.com/derammo/der20/releases/tag/v0.17</a> &nbsp; &nbsp; implemented debug output option for all plugins&nbsp;<a href="https://derammo.github.io/der20/#PLUGIN/option_debug" rel="nofollow">https://derammo.github.io/der20/#PLUGIN/option_debug</a> &nbsp; &nbsp; added stack traces to console output on errors &nbsp; &nbsp; fixed option delete command to take effect immediately &nbsp; &nbsp; implemented optional validation on configuration input &nbsp; &nbsp; &nbsp; &nbsp;
========================================================== !anonymous Release v0.22 ========================================================== [ github commit b04efdd by Ammo Goettsch on 2018-11-10 ] failure message now shown if marketplace image selected [ github commit 572180d by Ammo Goettsch on 2018-11-10 ] implemented interactive selection of anonymous character ========================================================== !anonymous Release v0.21 ========================================================== [ github commit cea2f28 by Ammo Goettsch on 2018-11-10 ] anonymous set or reveal applied to unbound token fixed no longer throws error if selected token does not represent a journal character fixes #4 ========================================================== !anonymous Release v0.18 ========================================================== [ github commit 0415ada by Ammo Goettsch on 2018-11-06 ] anonymous now supports common options